Xmega Application Note


init.c

Go to the documentation of this file.
00001 
00040 #include "board.h"
00041 #include "compiler.h"
00042 #include "xplain.h"
00043 #include "conf_board.h"
00044 #include "ioport.h"
00045 
00046 void board_init(void)
00047 {
00048         ioport_configure_pin(LED0_GPIO, IOPORT_DIR_OUTPUT | IOPORT_INIT_HIGH);
00049         ioport_configure_pin(LED1_GPIO, IOPORT_DIR_OUTPUT | IOPORT_INIT_HIGH);
00050         ioport_configure_pin(LED2_GPIO, IOPORT_DIR_OUTPUT | IOPORT_INIT_HIGH);
00051         ioport_configure_pin(LED3_GPIO, IOPORT_DIR_OUTPUT | IOPORT_INIT_HIGH);
00052         ioport_configure_pin(LED4_GPIO, IOPORT_DIR_OUTPUT | IOPORT_INIT_HIGH);
00053         ioport_configure_pin(LED5_GPIO, IOPORT_DIR_OUTPUT | IOPORT_INIT_HIGH);
00054         ioport_configure_pin(LED6_GPIO, IOPORT_DIR_OUTPUT | IOPORT_INIT_HIGH);
00055         ioport_configure_pin(LED7_GPIO, IOPORT_DIR_OUTPUT | IOPORT_INIT_HIGH);
00056         
00057         ioport_configure_pin(GPIO_PUSH_BUTTON_0, IOPORT_DIR_INPUT |
00058                         IOPORT_PULL_UP);
00059         ioport_configure_pin(GPIO_PUSH_BUTTON_1, IOPORT_DIR_INPUT |
00060                         IOPORT_PULL_UP);
00061         ioport_configure_pin(GPIO_PUSH_BUTTON_2, IOPORT_DIR_INPUT |
00062                         IOPORT_PULL_UP);
00063         ioport_configure_pin(GPIO_PUSH_BUTTON_3, IOPORT_DIR_INPUT |
00064                         IOPORT_PULL_UP);
00065         ioport_configure_pin(GPIO_PUSH_BUTTON_4, IOPORT_DIR_INPUT |
00066                         IOPORT_PULL_UP);
00067         ioport_configure_pin(GPIO_PUSH_BUTTON_5, IOPORT_DIR_INPUT |
00068                         IOPORT_PULL_UP);
00069         ioport_configure_pin(GPIO_PUSH_BUTTON_6, IOPORT_DIR_INPUT |
00070                         IOPORT_PULL_UP);
00071         ioport_configure_pin(GPIO_PUSH_BUTTON_7, IOPORT_DIR_INPUT |
00072                         IOPORT_PULL_UP);
00073 
00074 #ifdef CONF_BOARD_AT45DBX
00075         ioport_configure_pin(AT45DBX_MASTER_SS, IOPORT_DIR_OUTPUT | IOPORT_INIT_HIGH);
00076         ioport_configure_pin(AT45DBX_MASTER_SCK, IOPORT_DIR_OUTPUT | IOPORT_INIT_HIGH);
00077         ioport_configure_pin(AT45DBX_MASTER_MOSI, IOPORT_DIR_OUTPUT | IOPORT_INIT_HIGH);
00078         ioport_configure_pin(AT45DBX_MASTER_MISO, IOPORT_DIR_INPUT);
00079         ioport_configure_pin(AT45DBX_CS, IOPORT_DIR_OUTPUT | IOPORT_INIT_HIGH);
00080 #endif
00081 
00082 #ifdef CONF_BOARD_ENABLE_AC_PINS
00083         ioport_configure_pin(IOPORT_CREATE_PIN(PORTA, 0), IOPORT_DIR_INPUT);
00084         ioport_configure_pin(IOPORT_CREATE_PIN(PORTA, 2), IOPORT_DIR_INPUT);
00085         ioport_configure_pin(IOPORT_CREATE_PIN(PORTB, 1), IOPORT_DIR_INPUT);
00086 #endif
00087 
00088 #ifdef CONF_BOARD_ENABLE_SPEAKER
00089         ioport_configure_pin(IOPORT_CREATE_PIN(PORTQ, 3), IOPORT_DIR_OUTPUT |
00090                         IOPORT_INIT_HIGH);
00091 #endif
00092 
00093 #ifdef CONF_BOARD_ENABLE_USARTC0
00094         ioport_configure_pin(IOPORT_CREATE_PIN(PORTC, 3), IOPORT_DIR_OUTPUT
00095                         | IOPORT_INIT_HIGH);
00096         ioport_configure_pin(IOPORT_CREATE_PIN(PORTC, 2), IOPORT_DIR_INPUT);
00097 #endif
00098 
00099 #ifdef CONF_BOARD_ENABLE_USARTD0
00100         ioport_configure_pin(IOPORT_CREATE_PIN(PORTD, 3), IOPORT_DIR_OUTPUT
00101                         | IOPORT_INIT_HIGH);
00102         ioport_configure_pin(IOPORT_CREATE_PIN(PORTD, 2), IOPORT_DIR_INPUT);
00103 #endif
00104 }
@DOC_TITLE@
Generated on Fri Oct 22 12:15:25 2010 for AVR1300 Using the Xmega ADC by doxygen 1.6.3