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:
|
|
|
|
*
|
|
|
|
* http://chibios-gfx.com/license.html
|
|
|
|
*/
|
2013-02-18 07:29:08 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
driver quickly hacked together from a chinese sourcecode that came
|
|
|
|
with the board and existing ili9320 code by Chris van Dongen (sjaak)
|
|
|
|
(sjaak2002 at msn.com)
|
|
|
|
|
|
|
|
Also added rotation for 180 and 270 degrees and minor tweaks to
|
|
|
|
setcursor
|
|
|
|
|
|
|
|
Added code comes without warranty and free bugs. Feel free to use
|
|
|
|
or misuse the added code :D
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file drivers/gdisp/ILI9325/gdisp_lld_board_hy_stm32_100p.h
|
|
|
|
* @brief GDISP Graphic Driver subsystem board interface for the ILI9325 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 *) 0x60020000)) /* 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-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
|
|
|
percent=percent; // avoid a warning
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* GDISP_LLD_BOARD_H */
|
|
|
|
/** @} */
|
|
|
|
|