nrf5/hal/gpio: Updating toggle inline function to work correctly, currently only used by LED module.
This commit is contained in:
parent
2f983d3ef9
commit
de3a78a097
|
@ -91,13 +91,11 @@ static inline void hal_gpio_pin_clear(uint8_t port, uint32_t pin) {
|
|||
}
|
||||
|
||||
static inline void hal_gpio_pin_toggle(uint8_t port, uint32_t pin) {
|
||||
uint32_t pin_mask = (1 << pin);
|
||||
uint32_t pin_mask = (1 << pin);
|
||||
uint32_t pins_state = NRF_GPIO->OUT;
|
||||
|
||||
if (GPIO_BASE(port)->OUT ^ pin_mask) {
|
||||
GPIO_BASE(port)->OUTSET = pin_mask;
|
||||
} else {
|
||||
GPIO_BASE(port)->OUTCLR = pin_mask;
|
||||
}
|
||||
GPIO_BASE(port)->OUTSET = (~pins_state) & pin_mask;
|
||||
GPIO_BASE(port)->OUTCLR = pins_state & pin_mask;
|
||||
}
|
||||
|
||||
typedef enum {
|
||||
|
|
Loading…
Reference in New Issue