Skip to content

Commit

Permalink
resource: cast to enum values
Browse files Browse the repository at this point in the history
  • Loading branch information
bkleiner committed Nov 30, 2024
1 parent acf1f17 commit 260440b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/driver/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ typedef uint32_t resource_tag_t;
#define RESOURCE_TAG_TYPE(tag) (resource_type_t)(((tag) >> 24) & 0xFF)

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

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

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

0 comments on commit 260440b

Please sign in to comment.