Skip to content
Snippets Groups Projects
Unverified Commit 939969ed authored by Simon Duquennoy's avatar Simon Duquennoy Committed by GitHub
Browse files

Merge pull request #683 from g-oikonomou/bugfix/gpio/64bit

Improve GPIO HAL when used with 64-bit pin masks
parents c74686df 78d16284
No related branches found
No related tags found
No related merge requests found
...@@ -46,9 +46,9 @@ static uint8_t counter; ...@@ -46,9 +46,9 @@ static uint8_t counter;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/* Print gpio_hal_pin_mask_t using the correct format */ /* Print gpio_hal_pin_mask_t using the correct format */
#if GPIO_HAL_PIN_COUNT > 32 #if GPIO_HAL_PIN_COUNT > 32
#define PIN_MASK_FMT PRIx64 #define PIN_MASK_FMT "0x%016" PRIx64
#else #else
#define PIN_MASK_FMT PRIx32 #define PIN_MASK_FMT "0x%08" PRIx32
#endif #endif
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
PROCESS(gpio_hal_example, "GPIO HAL Example"); PROCESS(gpio_hal_example, "GPIO HAL Example");
...@@ -127,7 +127,7 @@ PROCESS_THREAD(gpio_hal_example, ev, data) ...@@ -127,7 +127,7 @@ PROCESS_THREAD(gpio_hal_example, ev, data)
} }
/* Test read */ /* Test read */
printf("%u: Pins are 1-%u, 2=%u, 3=%u, mask=0x%08" PIN_MASK_FMT "\n", printf("%u: Pins are 1-%u, 2=%u, 3=%u, mask=" PIN_MASK_FMT "\n",
counter & 7, counter & 7,
gpio_hal_arch_read_pin(out_pin1), gpio_hal_arch_read_pin(out_pin1),
gpio_hal_arch_read_pin(out_pin2), gpio_hal_arch_read_pin(out_pin2),
......
...@@ -189,7 +189,7 @@ void gpio_hal_event_handler(gpio_hal_pin_mask_t pins); ...@@ -189,7 +189,7 @@ void gpio_hal_event_handler(gpio_hal_pin_mask_t pins);
* \param pin The pin * \param pin The pin
* \return The corresponding mask * \return The corresponding mask
*/ */
#define gpio_hal_pin_to_mask(pin) (1 << (pin)) #define gpio_hal_pin_to_mask(pin) ((gpio_hal_pin_mask_t)1 << (pin))
/** @} */ /** @} */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment