Xmega Application Note


ioport.c

Go to the documentation of this file.
00001 
00038 #include "ioport.h"
00039 
00040 void ioport_configure_port_pin(void *port, pin_mask_t pin_mask,port_pin_flags_t flags)
00041 {
00042         uint8_t pin;
00043 
00044         for (pin = 0; pin < 8; pin++) {
00045                 if (pin_mask & (1 << pin)) {
00046                         *((uint8_t*)port+PORT_PIN0CTRL+pin)=flags;
00047                 }
00048         }
00049         /* Select direction and initial pin state */
00050         if (flags & IOPORT_DIR_OUTPUT) {
00051                 if (flags & IOPORT_INIT_HIGH) {
00052                         *((uint8_t*)port+PORT_OUTSET)=pin_mask;
00053                 }
00054                 else {
00055                         *((uint8_t*)port+PORT_OUTCLR)=pin_mask;
00056                 }
00057                 *((uint8_t*)port+PORT_DIRSET)=pin_mask;
00058         }
00059         else {
00060                 *((uint8_t*)port+PORT_DIRCLR)=pin_mask;
00061         }
00062 }
@DOC_TITLE@
Generated on Fri Oct 22 12:15:25 2010 for AVR1300 Using the Xmega ADC by doxygen 1.6.3