Use ODR instead of IDR to toggle an output GPIO
IDR represents the level on pin input while ODR is the value requested by the programmer. This makes a difference for example when using the output as open drain.
This commit is contained in:
parent
7011d47c70
commit
12a73ce052
@ -111,7 +111,7 @@ u16 gpio_get(u32 gpioport, u16 gpios)
|
||||
|
||||
void gpio_toggle(u32 gpioport, u16 gpios)
|
||||
{
|
||||
GPIO_ODR(gpioport) = GPIO_IDR(gpioport) ^ gpios;
|
||||
GPIO_ODR(gpioport) ^= gpios;
|
||||
}
|
||||
|
||||
u16 gpio_port_read(u32 gpioport)
|
||||
|
@ -111,7 +111,7 @@ u16 gpio_get(u32 gpioport, u16 gpios)
|
||||
|
||||
void gpio_toggle(u32 gpioport, u16 gpios)
|
||||
{
|
||||
GPIO_ODR(gpioport) = GPIO_IDR(gpioport) ^ gpios;
|
||||
GPIO_ODR(gpioport) ^= gpios;
|
||||
}
|
||||
|
||||
u16 gpio_port_read(u32 gpioport)
|
||||
|
Loading…
x
Reference in New Issue
Block a user