2013-05-01 23:53:28 +00:00
|
|
|
/*
|
2013-06-15 11:37:22 +00:00
|
|
|
* This file is subject to the terms of the GFX License. If a copy of
|
2013-05-03 14:36:17 +00:00
|
|
|
* the license was not distributed with this file, you can obtain one at:
|
|
|
|
*
|
2013-07-21 20:20:37 +00:00
|
|
|
* http://ugfx.org/license.html
|
2013-05-03 14:36:17 +00:00
|
|
|
*/
|
2013-02-18 07:29:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @file drivers/gdisp/ILI9320/gdisp_lld_board_olimex_stm32_lcd.h
|
|
|
|
* @brief GDISP Graphic Driver subsystem board interface for the ILI9320 display.
|
|
|
|
*
|
|
|
|
* @addtogroup GDISP
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GDISP_LLD_BOARD_H
|
|
|
|
#define GDISP_LLD_BOARD_H
|
|
|
|
|
|
|
|
#define GDISP_REG (*((volatile uint16_t *) 0x60000000)) /* RS = 0 */
|
|
|
|
#define GDISP_RAM (*((volatile uint16_t *) 0x60100000)) /* RS = 1 */
|
|
|
|
|
2013-03-04 22:50:21 +00:00
|
|
|
static inline void gdisp_lld_init_board(void) {
|
2013-02-18 07:29:08 +00:00
|
|
|
/* FSMC setup for F1 */
|
|
|
|
rccEnableAHB(RCC_AHBENR_FSMCEN, 0);
|
|
|
|
|
|
|
|
/* set pin modes */
|
|
|
|
IOBus busD = {GPIOD, PAL_WHOLE_PORT, 0};
|
|
|
|
IOBus busE = {GPIOE, PAL_WHOLE_PORT, 0};
|
|
|
|
palSetBusMode(&busD, PAL_MODE_STM32_ALTERNATE_PUSHPULL);
|
|
|
|
palSetBusMode(&busE, PAL_MODE_STM32_ALTERNATE_PUSHPULL);
|
|
|
|
palSetPadMode(GPIOE, GPIOE_TFT_RST, PAL_MODE_OUTPUT_PUSHPULL);
|
|
|
|
palSetPadMode(GPIOD, GPIOD_TFT_LIGHT, PAL_MODE_OUTPUT_PUSHPULL);
|
|
|
|
|
|
|
|
const unsigned char FSMC_Bank = 0;
|
|
|
|
|
|
|
|
/* FSMC timing */
|
|
|
|
FSMC_Bank1->BTCR[FSMC_Bank+1] = (6) | (10 << 8) | (10 << 16);
|
|
|
|
|
|
|
|
/* Bank1 NOR/SRAM control register configuration
|
|
|
|
* This is actually not needed as already set by default after reset */
|
|
|
|
FSMC_Bank1->BTCR[FSMC_Bank] = FSMC_BCR1_MWID_0 | FSMC_BCR1_WREN | FSMC_BCR1_MBKEN;
|
|
|
|
}
|
|
|
|
|
2013-03-04 22:50:21 +00:00
|
|
|
static inline void gdisp_lld_reset_pin(bool_t state) {
|
2013-02-18 07:29:08 +00:00
|
|
|
if(state)
|
|
|
|
palClearPad(GPIOE, GPIOE_TFT_RST);
|
|
|
|
else
|
|
|
|
palSetPad(GPIOE, GPIOE_TFT_RST);
|
|
|
|
}
|
|
|
|
|
2013-04-03 16:02:38 +00:00
|
|
|
static inline void acquire_bus(void) {
|
|
|
|
/* Nothing to do here since LCD is the only device on that bus */
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void release_bus(void) {
|
|
|
|
/* Nothing to do here since LCD is the only device on that bus */
|
|
|
|
}
|
|
|
|
|
2013-03-04 22:50:21 +00:00
|
|
|
static inline void gdisp_lld_write_index(uint16_t reg) {
|
2013-02-18 07:29:08 +00:00
|
|
|
GDISP_REG = reg;
|
|
|
|
}
|
|
|
|
|
2013-03-04 22:50:21 +00:00
|
|
|
static inline void gdisp_lld_write_data(uint16_t data) {
|
2013-02-18 07:29:08 +00:00
|
|
|
GDISP_RAM = data;
|
|
|
|
}
|
|
|
|
|
2013-03-04 22:50:21 +00:00
|
|
|
static inline uint16_t gdisp_lld_read_data(void) {
|
2013-02-18 07:29:08 +00:00
|
|
|
return GDISP_RAM;
|
|
|
|
}
|
|
|
|
|
2013-03-04 22:50:21 +00:00
|
|
|
static inline void gdisp_lld_backlight(uint8_t percent) {
|
2013-02-18 07:29:08 +00:00
|
|
|
if(percent == 100)
|
|
|
|
palClearPad(GPIOD, GPIOD_TFT_LIGHT);
|
|
|
|
else
|
|
|
|
palSetPad(GPIOD, GPIOD_TFT_LIGHT);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* GDISP_LLD_BOARD_H */
|
|
|
|
/** @} */
|
|
|
|
|