//***************************************************************************** //***************************************************************************** void init_lcd_gpio(void) { gpio_enable_port(LCD_GPIO_BASE); gpio_enable_port(LCD_RST_BASE); // Configure SPI CLK gpio_config_digital_enable(LCD_GPIO_BASE, LCD_CLK_PIN); gpio_config_alternate_function(LCD_GPIO_BASE, LCD_CLK_PIN); gpio_config_port_control(LCD_GPIO_BASE, LCD_CLK_PIN_PCTL); // Configure SPI MOSI gpio_config_digital_enable(LCD_GPIO_BASE, LCD_MOSI_PIN); gpio_config_alternate_function(LCD_GPIO_BASE, LCD_MOSI_PIN); gpio_config_port_control(LCD_GPIO_BASE, LCD_MOSI_PIN_PCTL); // Configure CS to be a normal GPIO pin that is controlled // explicitly by software gpio_config_digital_enable(LCD_GPIO_BASE, LCD_CS_PIN); gpio_config_alternate_function(LCD_GPIO_BASE, LCD_CS_PIN); gpio_config_port_control(LCD_GPIO_BASE, LCD_CS_PIN_PCTL); // Configure CD to be a normal GPIO pin that is controlled // explicitly by software gpio_config_digital_enable(LCD_GPIO_BASE, LCD_CD_PIN); gpio_config_enable_output(LCD_GPIO_BASE, LCD_CD_PIN); // Configure RST_N to be a normal GPIO pin that is controlled // explicitly by software gpio_config_digital_enable(LCD_RST_BASE, LCD_RST_PIN); gpio_config_enable_output(LCD_RST_BASE, LCD_RST_PIN); initialize_spi(LCD_SPI_BASE, 3); }
void uart0_init(void) { // Initialize GPIO for UART0 gpio_enable_port(GPIOA_BASE); gpio_config_digital_enable( GPIOA_BASE, PA0 | PA1); gpio_config_alternate_function( GPIOA_BASE, PA0 | PA1); gpio_config_port_control( GPIOA_BASE, GPIO_PCTL_PA0_U0RX | GPIO_PCTL_PA1_U0TX); }
void initialize_LCD(void) { // LCD initialization gpio_enable_port(GPIOB_BASE); // Configure SPI CLK gpio_config_digital_enable(LCD_GPIO_BASE, LCD_CLK_PIN); gpio_config_alternate_function(LCD_GPIO_BASE, LCD_CLK_PIN); gpio_config_port_control(LCD_GPIO_BASE, LCD_CLK_PIN_PCTL); // Configure SPI MISO gpio_config_digital_enable(LCD_GPIO_BASE, LCD_MISO_PIN); gpio_config_alternate_function(LCD_GPIO_BASE, LCD_MISO_PIN); gpio_config_port_control(LCD_GPIO_BASE, LCD_MISO_PIN_PCTL); // Configure SPI MOSI gpio_config_digital_enable(LCD_GPIO_BASE, LCD_MOSI_PIN); gpio_config_alternate_function(LCD_GPIO_BASE, LCD_MOSI_PIN); gpio_config_port_control(LCD_GPIO_BASE, LCD_MOSI_PIN_PCTL); // Configure CS to be a normal GPIO pin that is controlled // explicitly by software gpio_config_digital_enable(LCD_GPIO_BASE,LCD_CS_PIN); gpio_config_enable_output(LCD_GPIO_BASE,LCD_CS_PIN); // Configure RST, BL_EN, and CMD_SEL to be normal GPIO pins gpio_config_digital_enable(LCD_GPIO_BASE, LCD_RST_PIN | LCD_BL_EN_PIN | LCD_CMD_SEL_PIN); gpio_config_enable_output(LCD_GPIO_BASE, LCD_RST_PIN | LCD_BL_EN_PIN | LCD_CMD_SEL_PIN); initialize_spi2(); //ILI9341_Initial(); init_lcd2(); setRotation(0); fillScreen(ILI9341_RED); drawStringCenter(" P L E X U S", 0, ILI9341_WHITE, ILI9341_WHITE); drawStringCenter(" ADJUST YAW", 3, ILI9341_WHITE, ILI9341_WHITE); drawStringCenter("THEN", 5, ILI9341_WHITE, ILI9341_WHITE); drawStringCenter(" ADJUST PITCH", 7, ILI9341_WHITE, ILI9341_WHITE); drawStringCenter("AND", 9, ILI9341_WHITE, ILI9341_WHITE); drawStringCenter("FIRE", 11, ILI9341_WHITE,ILI9341_WHITE); }