65 #include <avr/interrupt.h> 66 #include <avr/pgmspace.h> 67 #include <util/delay.h> 69 typedef uint8_t port_pin_t;
70 typedef uint8_t ioport_pin_t;
77 #define IO_ISC_BOTHEDGES (0 << 0) 78 #define IO_ISC_RISING (1 << 0) 79 #define IO_ISC_FALLING (2 << 0) 80 #define IO_ISC_LEVEL (3 << 0) 81 #define IO_ISC_INPUT_DISABLE (7 << 0) 82 #define IO_ISC_DEFAULT (0 << 0) 87 #define IO_OPC_TOTEM (0 << 3) 88 #define IO_OPC_BUSKEEPER (1 << 3) 89 #define IO_OPC_PULL_DOWN (2 << 3) 90 #define IO_OPC_PULL_UP (3 << 3) 91 #define IO_OPC_WIRED_OR (4 << 3) 92 #define IO_OPC_WIRED_AND (5 << 3) 93 #define IO_OPC_WIRED_OR_PULL_DOWN (6 << 3) 94 #define IO_OPC_WIRED_AND_PULL_UP (7 << 3) 95 #define IO_OPC_DEFAULT (0 << 3) 100 #define IO_CONF_INV_ENABLED (1 << 0) 101 #define IO_CONF_INV_DISABLE (0 << 0) 106 #define IO_CONF_SRL_ENABLED (1 << 0) 107 #define IO_CONF_SRL_DISABLED (0 << 0) 121 #define IO_SetDirection( _port, _directionMask) ( (_port)->DIR = _directionMask ) 132 #define IO_ToggleDirection( _port, _toggleMask) ( (_port)->DIRTGL = _toggleMask ) 144 #define IO_SetOutputValue( _port, _outValue) ( (_port)->OUT = _outValue ) 156 #define IO_SetPins( _port, _setMask) ( (_port)->OUTSET = _setMask ) 168 #define IO_ClearPins( _port, _clearMask) ( (_port)->OUTCLR = _clearMask ) 179 #define IO_TogglePins( _port, _toggleMask ) ( (_port)->OUTTGL = _toggleMask ) 190 #define IO_GetPortValue( _port ) ( (_port)->IN ) 202 #define IO_GetInterruptFlags( _port, _bitMask ) ( (_port)->INTFLAGS & _bitMask ) 213 #define IO_ClearInterruptFlags( _port, _bitMask ) ( (_port)->INTFLAGS = _bitMask ) 231 bool IO_GetPinLevel( PORT_t * port, uint8_t pinMask );
238 void IO_ConfigurePin( PORT_t * port, uint8_t pinMask, uint8_t slewRateEnable, uint8_t invertEnable,
239 PORT_OPC_t opc, PORT_ISC_t isc);
void IO_MapVirtualPort2(PORTCFG_VP02MAP_t realPort)
Maps a real port to virtual port 2.
void IO_ConfigureInterrupt0(PORT_t *port, PORT_INT0LVL_t intLevel, uint8_t pinMask)
Configures interrupt 0.
void IO_SetPinAsInput(PORT_t *port, uint8_t pinMask)
This function configures a pin in an I/O port or virtual port as an input.
void IO_SetPinLow(PORT_t *port, uint8_t pinMask)
This function clears a bit in the OUT register of an I/O port or virtual port.
void IO_SetPinHigh(PORT_t *port, uint8_t pinMask)
This function sets a bit in the OUT register of an I/O port or virtual port.
void IO_SetPinAsOutput_InitHigh(PORT_t *port, uint8_t pinMask)
This function configures a pin in an I/O port or virtual port as an output and sets the pin to high a...
void IO_MapVirtualPort0(PORTCFG_VP02MAP_t realPort)
Maps a real port to virtual port 0.
void IO_TogglePin(PORT_t *port, uint8_t pinMask)
Toggle the value of an IOPORT pin, which has previously been configured as an output.
void IO_SetPinAsOutput(PORT_t *port, uint8_t pinMask)
This function configures a pin in an I/O port or virtual port as an output.
void IO_ConfigureInterrupt1(PORT_t *port, PORT_INT1LVL_t intLevel, uint8_t pinMask)
Configures interrupt 1.
void IO_MapVirtualPort1(PORTCFG_VP13MAP_t realPort)
Maps a real port to virtual port 1.
void IO_ConfigurePin(PORT_t *port, uint8_t pinMask, uint8_t slewRateEnable, uint8_t invertEnable, PORT_OPC_t opc, PORT_ISC_t isc)
This function changes the configuration of a set of pins.
void IO_MapVirtualPort3(PORTCFG_VP13MAP_t realPort)
Maps a real port to virtual port 3.