From 344b60cd882276b803415ecbcbc08234feb66b35 Mon Sep 17 00:00:00 2001 From: patacongo Date: Sun, 18 Apr 2010 20:50:58 +0000 Subject: add lcd pin configuration git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2616 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/configs/sam3u-ek/src/sam3uek_internal.h | 101 +++++++++++++++++++++++--- nuttx/configs/sam3u-ek/src/up_lcd.c | 31 +++++++- 2 files changed, 118 insertions(+), 14 deletions(-) (limited to 'nuttx/configs/sam3u-ek') diff --git a/nuttx/configs/sam3u-ek/src/sam3uek_internal.h b/nuttx/configs/sam3u-ek/src/sam3uek_internal.h index 52fd3dd55..fe2bd9c1a 100755 --- a/nuttx/configs/sam3u-ek/src/sam3uek_internal.h +++ b/nuttx/configs/sam3u-ek/src/sam3uek_internal.h @@ -43,34 +43,111 @@ #include #include -#include + #include +#include + /************************************************************************************ * Definitions ************************************************************************************/ -/* SAM3U-EK GPIOs *******************************************************************/ - -/* GPIO pin definitions *************************************************************/ +/* External Memory Usage ************************************************************/ +/* LCD on CS2 */ + +#define LCD_BASE SAM3U_EXTCS2_BASE + +/* SAM3U-EK GPIO Pin Definitions ****************************************************/ + +/* LCD: + * LCD Module Pin Out: AT91SAM3U PIO: + * -------------------------------------------- -------------------------------------- + * Pin Symbol Function LCD PeriphA PeriphB Extra + * ---- ------ -------------------------------- -------------- -------- ------- ------ + * 1 GND Ground N/A --- --- --- + * 2 CS Chip Select PC16 NCS2 PWML3 AD12BAD5 + * 3 RS Register select signal PB8 (see A1) CTS0 A1 AD3 + * 4 WR Write operation signal PB23 (NWE) NWR0/NEW PCK1 --- + * 5 RD Read operation signal PB19 (NRD) NRD PWML2 --- + * 6 DB0 Data bus PB9 D0 DTR0 --- + * 7 DB1 Data bus PB10 D1 DSR0 --- + * 8 DB2 Data bus PB11 D2 DCD0 --- + * 9 DB3 Data bus PB12 D3 RI0 --- + * 10 DB4 Data bus PB13 D4 PWMH0 --- + * 11 DB5 Data bus PB14 D5 PWMH1 --- + * 12 DB6 Data bus PB15 D6 PWMH2 --- + * 13 DB7 Data bus PB16 D7 PMWH3 --- + * 14 DB8 Data bus PB25 D8 PWML0 --- + * 15 DB9 Data bus PB26 D9 PWML1 --- + * 16 DB10 Data bus PB27 D10 PWML2 --- + * 17 DB11 Data bus PB28 D11 PWML3 --- + * 18 DB12 Data bus PB29 D12 --- --- + * 19 DB13 Data bus PB30 D13 --- --- + * 20 DB14 Data bus PB31 D14 --- --- + * 21 DB15 Data bus PB6 TIOA1 D15 AD1 + * 22 NC No connection N/A --- --- --- + * 23 NC No connection N/A --- --- --- + * 24 RESET Reset signal N/A --- --- --- + * 25 GND Ground N/A --- --- --- + * 26 X+ Touch panel X_RIGHT PA15 SPCK PWMH2 --- + * 27 Y+ Touch panel Y_UP PA14 MOSI --- --- + * 28 X- Touch panel X_LEFT PA13 MISO --- --- + * 29 Y- Touch panel Y_DOWN PC14 A3 NPCS2 --- + * 30 GND Ground N/A --- --- --- + * 31 VDD1 Power supply for digital IO Pad N/A --- --- --- + * 32 VDD2 Power supply for analog circuit N/A --- --- --- + * 33 A1 Power supply for backlight PB8 (see RS) CTS0 A1 AD3 + * 34 A2 Power supply for backlight N/A --- --- --- + * 35 A3 Power supply for backlight N/A --- --- --- + * 36 A4 Power supply for backlight N/A --- --- --- + * 37 NC No connection N/A --- --- --- + * 38 NC No connection N/A --- --- --- + * 39 K Backlight ground N/A --- --- --- + */ + +#define GPIO_LCD_NCS2 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOC|GPIO_PIN16) +#define GPIO_LCD_RS (GPIO_PERIPHB|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN8) +#define GPIO_LCD_NWE (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN23) +#define GPIO_LCD_NRD (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN19) + +#define GPIO_LCD_D0 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN9) +#define GPIO_LCD_D1 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN10) +#define GPIO_LCD_D2 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN11) +#define GPIO_LCD_D3 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN12) +#define GPIO_LCD_D4 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN13) +#define GPIO_LCD_D5 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN14) +#define GPIO_LCD_D6 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN15) +#define GPIO_LCD_D7 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN16) +#define GPIO_LCD_D8 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN25) +#define GPIO_LCD_D9 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN26) +#define GPIO_LCD_D10 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN27) +#define GPIO_LCD_D11 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN28) +#define GPIO_LCD_D12 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN29) +#define GPIO_LCD_D13 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN30) +#define GPIO_LCD_D14 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN31) +#define GPIO_LCD_D15 (GPIO_PERIPHB|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN6) + +/* LCD Backlight pin definition. */ + +#define GPIO_LCD_BKL (GPIO_OUTPUT|GPIO_CFG_DEFAULT|GPIO_OUTPUT_CLEAR|GPIO_PORT_PIOC|GPIO_PIN19) /* LEDs */ -#define GPIO_LED0 (GPIO_OUTPUT|GPIO_CFG_DEFAULT|GPIO_PORT_PIOB|GPIO_OUTPUT_CLEAR|GPIO_PIN0) -#define GPIO_LED1 (GPIO_OUTPUT|GPIO_CFG_DEFAULT|GPIO_PORT_PIOB|GPIO_OUTPUT_SET|GPIO_PIN1) -#define GPIO_LED2 (GPIO_OUTPUT|GPIO_CFG_DEFAULT|GPIO_PORT_PIOB|GPIO_OUTPUT_SET|GPIO_PIN2) +#define GPIO_LED0 (GPIO_OUTPUT|GPIO_CFG_DEFAULT|GPIO_PORT_PIOB|GPIO_OUTPUT_CLEAR|GPIO_PIN0) +#define GPIO_LED1 (GPIO_OUTPUT|GPIO_CFG_DEFAULT|GPIO_PORT_PIOB|GPIO_OUTPUT_SET|GPIO_PIN1) +#define GPIO_LED2 (GPIO_OUTPUT|GPIO_CFG_DEFAULT|GPIO_PORT_PIOB|GPIO_OUTPUT_SET|GPIO_PIN2) /* BUTTONS */ -#define GPIO_BUTTON1 (GPIO_INPUT|GPIO_CFG_PULLUP|GPIO_CFG_DEGLITCH|GPIO_PORT_PIOA|GPIO_PIN18) -#define GPIO_BUTTON2 (GPIO_INPUT|GPIO_CFG_PULLUP|GPIO_CFG_DEGLITCH|GPIO_PORT_PIOA|GPIO_PIN19) +#define GPIO_BUTTON1 (GPIO_INPUT|GPIO_CFG_PULLUP|GPIO_CFG_DEGLITCH|GPIO_PORT_PIOA|GPIO_PIN18) +#define GPIO_BUTTON2 (GPIO_INPUT|GPIO_CFG_PULLUP|GPIO_CFG_DEGLITCH|GPIO_PORT_PIOA|GPIO_PIN19) -#define IRQ_BUTTON1 SAM3U_IRQ_PA18 -#define IRQ_BUTTON2 SAM3U_IRQ_PA19 +#define IRQ_BUTTON1 SAM3U_IRQ_PA18 +#define IRQ_BUTTON2 SAM3U_IRQ_PA19 /* SD Card Detect */ -#define GPIO_MCI_CD (GPIO_INPUT|GPIO_CFG_PULLUP|GPIO_PORT_PIOA|GPIO_PIN25) +#define GPIO_MCI_CD (GPIO_INPUT|GPIO_CFG_PULLUP|GPIO_PORT_PIOA|GPIO_PIN25) /* SPI Chip Selects */ diff --git a/nuttx/configs/sam3u-ek/src/up_lcd.c b/nuttx/configs/sam3u-ek/src/up_lcd.c index 25e004302..9ead815b9 100755 --- a/nuttx/configs/sam3u-ek/src/up_lcd.c +++ b/nuttx/configs/sam3u-ek/src/up_lcd.c @@ -43,8 +43,8 @@ * -------------------------------------------- -------------------------------------- * Pin Symbol Function LCD PeriphA PeriphB Extra * ---- ------ -------------------------------- -------------- -------- ------- ------ - * 1 GND Ground - * 2 CS Chip Select + * 1 GND Ground N/A --- --- --- + * 2 CS Chip Select PC16 NCS2 PWML3 AD12BAD5 * 3 RS Register select signal PB8 (see A1) CTS0 A1 AD3 * 4 WR Write operation signal PB23 (NWE) NWR0/NEW PCK1 --- * 5 RD Read operation signal PB19 (NRD) NRD PWML2 --- @@ -372,6 +372,33 @@ static int sam3u_setcontrast(struct lcd_dev_s *dev, unsigned int contrast) int up_lcdinitialize(void) { + /* Enable LCD EXTCS2 pins */ + + sam3u_configgpio(GPIO_LCD_NCS2); + sam3u_configgpio(GPIO_LCD_RS); + sam3u_configgpio(GPIO_LCD_NWE); + sam3u_configgpio(GPIO_LCD_NRD); + + sam3u_configgpio(GPIO_LCD_D0); + sam3u_configgpio(GPIO_LCD_D1); + sam3u_configgpio(GPIO_LCD_D2); + sam3u_configgpio(GPIO_LCD_D3); + sam3u_configgpio(GPIO_LCD_D4); + sam3u_configgpio(GPIO_LCD_D5); + sam3u_configgpio(GPIO_LCD_D6); + sam3u_configgpio(GPIO_LCD_D7); + sam3u_configgpio(GPIO_LCD_D8); + sam3u_configgpio(GPIO_LCD_D9); + sam3u_configgpio(GPIO_LCD_D10); + sam3u_configgpio(GPIO_LCD_D11); + sam3u_configgpio(GPIO_LCD_D12); + sam3u_configgpio(GPIO_LCD_D13); + sam3u_configgpio(GPIO_LCD_D14); + sam3u_configgpio(GPIO_LCD_D15); + + /* Configure LCD Backlight Pin */ + + sam3u_configgpio(GPIO_LCD_D15); return -ENOSYS; } -- cgit v1.2.3