diff options
author | Daniel Friesel <derf@finalrewind.org> | 2018-01-11 08:55:15 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2018-01-11 08:55:15 +0100 |
commit | 85e11a1a460f08f1791a03a6bb95c976b7117ab8 (patch) | |
tree | de254068771592db8da8c06d641e9f09094efabe /include/arduino-nano | |
parent | 044ff708d979cb5c17c1b2e0dafb6be0ccecab43 (diff) |
use inline functions for most gpio
Diffstat (limited to 'include/arduino-nano')
-rw-r--r-- | include/arduino-nano/driver/gpio.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/include/arduino-nano/driver/gpio.h b/include/arduino-nano/driver/gpio.h index 17bdfc8..6acf977 100644 --- a/include/arduino-nano/driver/gpio.h +++ b/include/arduino-nano/driver/gpio.h @@ -36,10 +36,18 @@ class GPIO { pd7 = 31 }; - void setup(); - void led_on(unsigned char id); - void led_off(unsigned char id); - void led_toggle(unsigned char id); + inline void setup() { + DDRB = _BV(PB5); + } + inline void led_on(unsigned char id) { + PORTB |= _BV(PB5); + } + inline void led_off(unsigned char id) { + PORTB &= ~_BV(PB5); + } + inline void led_toggle(unsigned char id) { + PINB = _BV(PB5); + } inline void input(unsigned char const pin) { if (pin < 8) { } else if (pin < 16) { |