Skip to content

Commit 57b69c2

Browse files
committed
resource: cast to enum values
1 parent f726a81 commit 57b69c2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/driver/resource.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ typedef uint32_t resource_tag_t;
2929
#define RESOURCE_TAG_TYPE(tag) (resource_type_t)(((tag) >> 24) & 0xFF)
3030

3131
#define TIMER_TAG(tim, ch) RESOURCE_TAG(RESOURCE_TIM, (uint32_t)((tim) << 8) | (ch))
32-
#define TIMER_TAG_TIM(tag) (uint8_t)(((tag) >> 8) & 0xFF)
33-
#define TIMER_TAG_CH(tag) (uint8_t)((tag)&0xFF)
32+
#define TIMER_TAG_TIM(tag) (timer_index_t)(((tag) >> 8) & 0xFF)
33+
#define TIMER_TAG_CH(tag) (timer_channel_t)((tag) & 0xFF)
3434

3535
#define SPI_TAG(port, pin) RESOURCE_TAG(RESOURCE_SPI, (uint32_t)((port) << 8) | (pin))
3636
#define SPI_TAG_PORT(tag) (uint8_t)(((tag) >> 8) & 0xFF)
@@ -41,5 +41,5 @@ typedef uint32_t resource_tag_t;
4141
#define SERIAL_TAG_PIN(tag) (uint8_t)((tag)&0xFF)
4242

4343
#define ADC_TAG(adc, ch) RESOURCE_TAG(RESOURCE_ADC, (uint32_t)((adc) << 8) | (ch))
44-
#define ADC_TAG_DEV(tag) (uint8_t)(((tag) >> 8) & 0xFF)
44+
#define ADC_TAG_DEV(tag) (adc_devices_t)(((tag) >> 8) & 0xFF)
4545
#define ADC_TAG_CH(tag) (uint8_t)((tag)&0xFF)

0 commit comments

Comments
 (0)