aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple/include
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2012-05-31 18:43:18 -0400
committerMarti Bolivar <mbolivar@leaflabs.com>2012-05-31 18:43:18 -0400
commit1ed01dad43f95be2af258d44d03fcafde5714942 (patch)
tree6a20bc40a5ba404692547f7acb3b82d53c306bed /libmaple/include
parent014f9a0545556f2e0d4fb3faba5607e59e1e97ad (diff)
downloadlibrambutan-1ed01dad43f95be2af258d44d03fcafde5714942.tar.gz
librambutan-1ed01dad43f95be2af258d44d03fcafde5714942.zip
<libmaple/gpio.h>: Fix gpio_write_bit().
It's exactly wrong -- val=0 makes the pin high, and val=1 makes it low. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
Diffstat (limited to 'libmaple/include')
-rw-r--r--libmaple/include/libmaple/gpio.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/libmaple/include/libmaple/gpio.h b/libmaple/include/libmaple/gpio.h
index f7773c0..ca7b2bf 100644
--- a/libmaple/include/libmaple/gpio.h
+++ b/libmaple/include/libmaple/gpio.h
@@ -63,7 +63,7 @@ void gpio_set_mode(gpio_dev *dev, uint8 pin, gpio_pin_mode mode);
* @param val If true, set the pin. If false, reset the pin.
*/
static inline void gpio_write_bit(gpio_dev *dev, uint8 pin, uint8 val) {
- val = !!val;
+ val = !val; /* "set" bits are lower than "reset" bits */
dev->regs->BSRR = BIT(pin) << (16 * val);
}