Xmega Application Note


port_driver.h

Go to the documentation of this file.
00001 /* This file has been prepared for Doxygen automatic documentation generation.*/
00058 #ifndef PORT_DRIVER_H
00059 #define PORT_DRIVER_H
00060 
00061 #include "avr_compiler.h"
00062 
00063 /* Definitions of macros. */
00064 
00075 #define PORT_SetDirection( _port, _directionMask) ( (_port)->DIR = _directionMask )
00076 
00077 
00078 
00088 #define PORT_SetPinsAsOutput( _port, _outputMask ) ( (_port)->DIRSET = _outputMask )
00089 
00090 
00091 
00101 #define PORT_SetPinsAsInput( _port, _inputMask) ( (_port)->DIRCLR = _inputMask )
00102 
00103 
00104 
00113 #define PORT_ToggleDirection( _port, _toggleMask) ( (_port)->DIRTGL = _toggleMask )
00114 
00115 
00116 
00126 #define PORT_SetOutputValue( _port, _outValue) ( (_port)->OUT = _outValue )
00127 
00128 
00129 
00139 #define PORT_SetPins( _port, _setMask) ( (_port)->OUTSET = _setMask )
00140 
00141 
00142 
00152 #define PORT_ClearPins( _port, _clearMask) ( (_port)->OUTCLR = _clearMask )
00153 
00154 
00155 
00164 #define PORT_TogglePins( _port, _toggleMask ) ( (_port)->OUTTGL = _toggleMask )
00165 
00166 
00167 
00176 #define PORT_GetPortValue( _port ) ( (_port)->IN )
00177 
00178 
00179 
00189 #define PORT_GetInterruptFlags( _port, _bitMask ) ( (_port)->INTFLAGS & _bitMask )
00190 
00191 
00192 
00201 #define PORT_ClearInterruptFlags( _port, _bitMask ) ( (_port)->INTFLAGS = _bitMask )
00202 
00203 
00204 
00214 #define PORT_SetOutputBit( _port, _bitPosition ) ( (_port)->OUT = (_port)->OUT | (1 << _bitPosition) )
00215 
00216 
00217 
00227 #define PORT_ClearOutputBit( _port, _bitPosition ) ( (_port)->OUT = (_port)->OUT & ~(1 << _bitPosition) )
00228 
00229 
00230 
00240 #define PORT_SetPinAsOutput( _port, _bitPosition ) ( (_port)->DIR = (_port)->DIR | (1 << _bitPosition) )
00241 
00242 
00243 
00253 #define PORT_SetPinAsInput( _port, _bitPosition ) ( (_port)->DIR = (_port)->DIR & ~(1 << _bitPosition) )
00254 
00255 
00256 
00257 /* Prototyping of functions. Documentation is found in source file. */
00258 
00259 void PORT_ConfigureInterrupt0( PORT_t * port,
00260                                PORT_INT0LVL_t intLevel,
00261                                uint8_t pinMask);
00262 
00263 void PORT_ConfigureInterrupt1( PORT_t * port,
00264                                PORT_INT1LVL_t intLevel,
00265                                uint8_t pinMask);
00266 
00267 void PORT_ConfigurePins( PORT_t * port,
00268                          uint8_t pinMask,
00269                          uint8_t slewRateEnable,
00270                          uint8_t invertEnable,
00271                          PORT_OPC_t opc,
00272                          PORT_ISC_t isc);
00273 
00274 void PORT_MapVirtualPort0(PORTCFG_VP0MAP_t realPort);
00275 void PORT_MapVirtualPort1(PORTCFG_VP1MAP_t realPort);
00276 void PORT_MapVirtualPort2(PORTCFG_VP2MAP_t realPort);
00277 void PORT_MapVirtualPort3(PORTCFG_VP3MAP_t realPort);
00278 
00279 
00280 #endif
@DOC_TITLE@
Generated on Wed Apr 23 08:22:06 2008 for AVR1313 Using the XMEGA I/O Pins and External Interrupts by doxygen 1.5.5