#define PIN_INT1 26 void rx_event_read() { volatile uint32_t pin_state = 0; //read the current pin state pin_state = nrf_gpio_pin_read(PIN_INT1); ...
Using Keil v5, ARMCC 5
Pin state equals:
Level 0 - 0x00000000 - pin low
Level3 breakpoint after read - 0x00000040
Level3 breakpoint before and stepped through - 0x50000000
This is almost shockingly unacceptable. Found this guy
I'm not even sure how this is happening because the return value in read_pin is:
return ((nrf_gpio_port_in_read(reg) >> pin_number) & 1UL);
I'm not sure if this is because Nordic is using a STATIC_INLINE. It pretty much doesn't seem like Nordic's fault because it's &1 so should be impossible to return a higher value. But this seems like something that would have to have been caught if Nordic is testing with optimization on/off.
Any idea what could be going on here!?