nrf5/hal/gpio: Updating toggle inline function to work correctly, currently only used by LED module.

This commit is contained in:
Glenn Ruben Bakke 2017-06-05 21:59:37 +02:00
parent 2f983d3ef9
commit de3a78a097
1 changed files with 4 additions and 6 deletions

View File

@ -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 {