diff options
Diffstat (limited to 'platforms/avr/gpio.h')
-rw-r--r-- | platforms/avr/gpio.h | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/platforms/avr/gpio.h b/platforms/avr/gpio.h index e9be68491d..95f15c28dc 100644 --- a/platforms/avr/gpio.h +++ b/platforms/avr/gpio.h @@ -25,7 +25,9 @@ typedef uint8_t pin_t; #define setPinInput(pin) (DDRx_ADDRESS(pin) &= ~_BV((pin)&0xF), PORTx_ADDRESS(pin) &= ~_BV((pin)&0xF)) #define setPinInputHigh(pin) (DDRx_ADDRESS(pin) &= ~_BV((pin)&0xF), PORTx_ADDRESS(pin) |= _BV((pin)&0xF)) #define setPinInputLow(pin) _Static_assert(0, "AVR processors cannot implement an input as pull low") -#define setPinOutput(pin) (DDRx_ADDRESS(pin) |= _BV((pin)&0xF)) +#define setPinOutputPushPull(pin) (DDRx_ADDRESS(pin) |= _BV((pin)&0xF)) +#define setPinOutputOpenDrain(pin) _Static_assert(0, "AVR platform does not implement an open-drain output") +#define setPinOutput(pin) setPinOutputPushPull(pin) #define writePinHigh(pin) (PORTx_ADDRESS(pin) |= _BV((pin)&0xF)) #define writePinLow(pin) (PORTx_ADDRESS(pin) &= ~_BV((pin)&0xF)) @@ -34,16 +36,3 @@ typedef uint8_t pin_t; #define readPin(pin) ((bool)(PINx_ADDRESS(pin) & _BV((pin)&0xF))) #define togglePin(pin) (PORTx_ADDRESS(pin) ^= _BV((pin)&0xF)) - -/* Operation of GPIO by port. */ - -typedef uint8_t port_data_t; - -#define readPort(port) PINx_ADDRESS(port) - -#define setPortBitInput(port, bit) (DDRx_ADDRESS(port) &= ~_BV((bit)&0xF), PORTx_ADDRESS(port) &= ~_BV((bit)&0xF)) -#define setPortBitInputHigh(port, bit) (DDRx_ADDRESS(port) &= ~_BV((bit)&0xF), PORTx_ADDRESS(port) |= _BV((bit)&0xF)) -#define setPortBitOutput(port, bit) (DDRx_ADDRESS(port) |= _BV((bit)&0xF)) - -#define writePortBitLow(port, bit) (PORTx_ADDRESS(port) &= ~_BV((bit)&0xF)) -#define writePortBitHigh(port, bit) (PORTx_ADDRESS(port) |= _BV((bit)&0xF)) |