From 443d14c21f10fea9b0c6fc5559ec4c6b31f99546 Mon Sep 17 00:00:00 2001 From: inmarket Date: Fri, 18 Oct 2013 17:29:27 +1000 Subject: [PATCH] Convert driver ILI9481 to new format --- .../ILI9481/board_ILI9481_firebullstm32f103.h | 109 ++++++++ .../gdisp/ILI9481/board_ILI9481_template.h | 157 +++++++++++ drivers/gdisp/ILI9481/gdisp_lld.c | 243 +++++++++--------- drivers/gdisp/ILI9481/gdisp_lld.mk | 5 +- .../gdisp_lld_board_firebullstm32f103.h | 156 ----------- .../gdisp/ILI9481/gdisp_lld_board_template.h | 123 --------- drivers/gdisp/ILI9481/gdisp_lld_config.h | 3 - 7 files changed, 391 insertions(+), 405 deletions(-) create mode 100644 drivers/gdisp/ILI9481/board_ILI9481_firebullstm32f103.h create mode 100644 drivers/gdisp/ILI9481/board_ILI9481_template.h delete mode 100644 drivers/gdisp/ILI9481/gdisp_lld_board_firebullstm32f103.h delete mode 100644 drivers/gdisp/ILI9481/gdisp_lld_board_template.h diff --git a/drivers/gdisp/ILI9481/board_ILI9481_firebullstm32f103.h b/drivers/gdisp/ILI9481/board_ILI9481_firebullstm32f103.h new file mode 100644 index 00000000..6614d578 --- /dev/null +++ b/drivers/gdisp/ILI9481/board_ILI9481_firebullstm32f103.h @@ -0,0 +1,109 @@ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://ugfx.org/license.html + */ + +/** + * @file drivers/gdisp/ILI9481/board_ILI9481_firebullstm32f103.h + * @brief GDISP Graphics Driver subsystem low level driver source for + * the ILI9481 and compatible HVGA display + */ + +#ifndef _GDISP_LLD_BOARD_H +#define _GDISP_LLD_BOARD_H + +// For a multiple display configuration we would put all this in a structure and then +// set g->priv to that structure. +#define SET_CS palSetPad(GPIOD, 12); +#define CLR_CS palClearPad(GPIOD, 12); +#define SET_RS palSetPad(GPIOD, 13); +#define CLR_RS palClearPad(GPIOD, 13); +#define SET_WR palSetPad(GPIOD, 14); +#define CLR_WR palClearPad(GPIOD, 14); +#define SET_RD palSetPad(GPIOD, 15); +#define CLR_RD palClearPad(GPIOD, 15); + +static inline void init_board(GDisplay *g, unsigned display) { + + // As we are not using multiple displays we set g->priv to NULL as we don't use it. + g->priv = 0; + + if (display == 0) { + + /** + * Set up for Display 0 + */ + palSetGroupMode(GPIOE, PAL_WHOLE_PORT, 0, PAL_MODE_OUTPUT_PUSHPULL); + palSetPadMode(GPIOD, 12, PAL_MODE_OUTPUT_PUSHPULL); + palSetPadMode(GPIOD, 13, PAL_MODE_OUTPUT_PUSHPULL); + palSetPadMode(GPIOD, 14, PAL_MODE_OUTPUT_PUSHPULL); + palSetPadMode(GPIOD, 15, PAL_MODE_OUTPUT_PUSHPULL); + + // Configure the pins to a well know state + SET_RS; + SET_RD; + SET_WR; + CLR_CS; + } +} + +static inline void post_init_board(GDisplay *g) { + (void) g; +} + +static inline void setpin_reset(GDisplay *g, bool_t state) { + (void) g; + (void) state; +} + +static inline void set_backlight(GDisplay *g, uint8_t percent) { + (void) g; + (void) percent; +} + +static inline void acquire_bus(GDisplay *g) { + (void) g; +} + +static inline void release_bus(GDisplay *g) { + (void) g; +} + +static inline void write_index(GDisplay *g, uint16_t index) { + (void) g; + palWritePort(GPIOE, index); + CLR_RS; CLR_WR; SET_WR; SET_RS; +} + +static inline void write_data(GDisplay *g, uint16_t data) { + (void) g; + palWritePort(GPIOE, data); + CLR_WR; SET_WR; +} + +static inline void setreadmode(GDisplay *g) { + (void) g; + // change pin mode to digital input + palSetGroupMode(GPIOE, PAL_WHOLE_PORT, 0, PAL_MODE_INPUT); +} + +static inline void setwritemode(GDisplay *g) { + (void) g; + // change pin mode back to digital output + palSetGroupMode(GPIOE, PAL_WHOLE_PORT, 0, PAL_MODE_OUTPUT_PUSHPULL); +} + +static inline uint16_t read_data(GDisplay *g) { + uint16_t value; + (void) g; + + CLR_RD; + value = palReadPort(GPIOE); + SET_RD; + + return value; +} + +#endif /* _GDISP_LLD_BOARD_H */ diff --git a/drivers/gdisp/ILI9481/board_ILI9481_template.h b/drivers/gdisp/ILI9481/board_ILI9481_template.h new file mode 100644 index 00000000..f3f8bbb7 --- /dev/null +++ b/drivers/gdisp/ILI9481/board_ILI9481_template.h @@ -0,0 +1,157 @@ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://ugfx.org/license.html + */ + +/** + * @file drivers/gdisp/ILI9481/board_ILI9481_template.h + * @brief GDISP Graphics Driver subsystem low level driver source for + * the ILI9481 and compatible HVGA display + * + * @addtogroup GDISP + * @{ + */ + +#ifndef _GDISP_LLD_BOARD_H +#define _GDISP_LLD_BOARD_H + +/** + * @brief Initialise the board for the display. + * + * @param[in] g The GDisplay structure + * @param[in] display The display number on this controller (0..n) + * + * @note Set the g->priv member to whatever is appropriate. For multiple + * displays this might be a pointer to the appropriate register set. + * + * @notapi + */ +static inline void init_board(GDisplay *g, unsigned display) { + (void) g; + (void) display; +} + +/** + * @brief After the initialisation. + * + * @param[in] g The GDisplay structure + * + * @notapi + */ +static inline void post_init_board(GDisplay *g) { + (void) g; +} + +/** + * @brief Set or clear the lcd reset pin. + * + * @param[in] g The GDisplay structure + * @param[in] state TRUE = lcd in reset, FALSE = normal operation + * + * @notapi + */ +static inline void setpin_reset(GDisplay *g, bool_t state) { + (void) g; + (void) state; +} + +/** + * @brief Set the lcd back-light level. + * + * @param[in] g The GDisplay structure + * @param[in] percent 0 to 100% + * + * @notapi + */ +static inline void set_backlight(GDisplay *g, uint8_t percent) { + (void) g; + (void) percent; +} + +/** + * @brief Take exclusive control of the bus + * + * @param[in] g The GDisplay structure + * + * @notapi + */ +static inline void acquire_bus(GDisplay *g) { + (void) g; +} + +/** + * @brief Release exclusive control of the bus + * + * @param[in] g The GDisplay structure + * + * @notapi + */ +static inline void release_bus(GDisplay *g) { + (void) g; +} + +/** + * @brief Send data to the index register. + * + * @param[in] g The GDisplay structure + * @param[in] index The index register to set + * + * @notapi + */ +static inline void write_index(GDisplay *g, uint16_t index) { + (void) g; + (void) index; +} + +/** + * @brief Send data to the lcd. + * + * @param[in] g The GDisplay structure + * @param[in] data The data to send + * + * @notapi + */ +static inline void write_data(GDisplay *g, uint16_t data) { + (void) g; + (void) data; +} + +/** + * @brief Set the bus in read mode + * + * @param[in] g The GDisplay structure + * + * @notapi + */ +static inline void setreadmode(GDisplay *g) { + (void) g; +} + +/** + * @brief Set the bus back into write mode + * + * @param[in] g The GDisplay structure + * + * @notapi + */ +static inline void setwritemode(GDisplay *g) { + (void) g; +} + +/** + * @brief Read data from the lcd. + * @return The data from the lcd + * + * @param[in] g The GDisplay structure + * + * @notapi + */ +static inline uint16_t read_data(GDisplay *g) { + (void) g; + return 0; +} + +#endif /* _GDISP_LLD_BOARD_H */ +/** @} */ diff --git a/drivers/gdisp/ILI9481/gdisp_lld.c b/drivers/gdisp/ILI9481/gdisp_lld.c index a70b7c03..06a9e681 100644 --- a/drivers/gdisp/ILI9481/gdisp_lld.c +++ b/drivers/gdisp/ILI9481/gdisp_lld.c @@ -24,9 +24,11 @@ #undef GDISP_SCREEN_WIDTH #endif -#define GDISP_LLD_DECLARATIONS +#define GDISP_DRIVER_VMT GDISPVMT_ILI9481 +#include "../drivers/gdisp/ILI9481/gdisp_lld_config.h" #include "gdisp/lld/gdisp_lld.h" -#include "gdisp_lld_board.h" + +#include "board_ILI9481.h" /*===========================================================================*/ /* Driver local definitions. */ @@ -50,14 +52,14 @@ /*===========================================================================*/ // Some common routines and macros -#define dummy_read() { volatile uint16_t dummy; dummy = read_data(); (void) dummy; } -#define write_reg(reg, data) { write_index(reg); write_data(data); } -#define write_reg2x16(reg, data1, data2) { write_index(reg); write_data((data1)>>8); write_data((uint8_t)(data1)); write_data((data2)>>8); write_data((uint8_t)(data2));} +#define dummy_read(g) { volatile uint16_t dummy; dummy = read_data(g); (void) dummy; } +#define write_reg(g, reg, data) { write_index(g, reg); write_data(g, data); } +#define write_reg2x16(g, reg, data1, data2) { write_index(g, reg); write_data(g, (data1)>>8); write_data(g, (uint8_t)(data1)); write_data(g, (data2)>>8); write_data(g, (uint8_t)(data2));} -static void set_viewport(GDISPDriver* g) { - write_reg2x16(0x2A, g->p.x, g->p.x + g->p.cx - 1); - write_reg2x16(0x2B, g->p.y, g->p.y + g->p.cy - 1); - write_index(0x2C); +static void set_viewport(GDisplay* g) { + write_reg2x16(g, 0x2A, g->p.x, g->p.x + g->p.cx - 1); + write_reg2x16(g, 0x2B, g->p.y, g->p.y + g->p.cy - 1); + write_index(g, 0x2C); } /*===========================================================================*/ @@ -68,124 +70,127 @@ static void set_viewport(GDISPDriver* g) { /* Driver exported functions. */ /*===========================================================================*/ -LLDSPEC bool_t gdisp_lld_init(GDISPDriver *g) { +LLDSPEC bool_t gdisp_lld_init(GDisplay *g, unsigned display) { /* Initialise your display */ - init_board(); + init_board(g, display); /* Hardware reset */ - setpin_reset(TRUE); + setpin_reset(g, TRUE); gfxSleepMilliseconds(20); - setpin_reset(FALSE); + setpin_reset(g, FALSE); gfxSleepMilliseconds(20); /* Get the bus for the following initialisation commands */ - acquire_bus(); + acquire_bus(g); /* Enable Access to all Manufacturer commands (0xB0 and higher opcodes) */ - write_reg(0xB0, 0x00); + write_reg(g, 0xB0, 0x00); /* Frame Memory Access and Interface Setting */ - write_index(0xB3); - write_data(0x02); - write_data(0x00); - write_data(0x00); - write_data(0x10); + write_index(g, 0xB3); + write_data(g, 0x02); + write_data(g, 0x00); + write_data(g, 0x00); + write_data(g, 0x10); /* Display Mode and Frame Memory Write Mode Setting (B4h) */ /* Use internal clock for synchronization */ /* Use DBI interface (only DB0-17, no HSYNC, VSYNC or CLK) */ - write_reg(0xB4, 0x00); + write_reg(g, 0xB4, 0x00); /* Internal Backlight Control */ -/* write_index(0xB9); /*PWM Settings for Brightness Control */ -/* write_data(0x01); /* Disabled by default. */ -/* write_data(0xFF); /*0xFF = Max brightness */ -/* write_data(0xFF); -/* write_data(0x18); +/* write_index(g, 0xB9); // PWM Settings for Brightness Control + write_data(g, 0x01); // Disabled by default. + write_data(g, 0xFF); // 0xFF = Max brightness + write_data(g, 0xFF); + write_data(g, 0x18); */ /* Panel Driving settings */ - write_index(0xC0); - write_data(0x03); - write_data(0x3B); - write_data(0x00); - write_data(0x00); - write_data(0x00); - write_data(0x01); - write_data(0x00); /* NW */ - write_data(0x43); + write_index(g, 0xC0); + write_data(g, 0x03); + write_data(g, 0x3B); + write_data(g, 0x00); + write_data(g, 0x00); + write_data(g, 0x00); + write_data(g, 0x01); + write_data(g, 0x00); /* NW */ + write_data(g, 0x43); /* Display timings in Operating Mode */ - write_index(0xC1); - write_data(0x08); - write_data(0x15); /* CLOCK */ - write_data(0x08); - write_data(0x08); + write_index(g, 0xC1); + write_data(g, 0x08); + write_data(g, 0x15); /* CLOCK */ + write_data(g, 0x08); + write_data(g, 0x08); /* S/VCOM/Gate Driving timing setting */ - write_index(0xC4); - write_data(0x15); - write_data(0x03); - write_data(0x03); - write_data(0x01); + write_index(g, 0xC4); + write_data(g, 0x15); + write_data(g, 0x03); + write_data(g, 0x03); + write_data(g, 0x01); /* Interface Setting */ - write_reg(0xC6, 0x02); + write_reg(g, 0xC6, 0x02); /* Gamma Setting - should be changed if using a different panel */ - write_index(0xC8); - write_data(0x0C); - write_data(0x05); - write_data(0x0A); /*0X12 */ - write_data(0x6B); /*0x7D */ - write_data(0x04); - write_data(0x06); /*0x08 */ - write_data(0x15); /*0x0A */ - write_data(0x10); - write_data(0x00); - write_data(0x60); /*0x23 */ + write_index(g, 0xC8); + write_data(g, 0x0C); + write_data(g, 0x05); + write_data(g, 0x0A); /*0X12 */ + write_data(g, 0x6B); /*0x7D */ + write_data(g, 0x04); + write_data(g, 0x06); /*0x08 */ + write_data(g, 0x15); /*0x0A */ + write_data(g, 0x10); + write_data(g, 0x00); + write_data(g, 0x60); /*0x23 */ /* Address Mode setting */ - write_reg(0x36, 0x00); + write_reg(g, 0x36, 0x00); /* Set Pixel Format = 16 bits per pixel */ /* The driver supports upto 24 bits per pixel, with dither */ - write_reg(0x3A, 0x55); + write_reg(g, 0x3A, 0x55); /* Exit Idle Mode */ - write_index(0x38); + write_index(g, 0x38); /* Power Setting */ - write_index(0xD0); - write_data(0x07); - write_data(0x07); /* VCI = VCI1 */ - write_data(0x14); /* VRH 0x1D */ - write_data(0xA2); /* BT 0x06 */ + write_index(g, 0xD0); + write_data(g, 0x07); + write_data(g, 0x07); /* VCI = VCI1 */ + write_data(g, 0x14); /* VRH 0x1D */ + write_data(g, 0xA2); /* BT 0x06 */ /* VCOM Setting */ - write_index(0xD1); - write_data(0x03); - write_data(0x5A); /* VCM 0x5A */ - write_data(0x10); /* VDV */ + write_index(g, 0xD1); + write_data(g, 0x03); + write_data(g, 0x5A); /* VCM 0x5A */ + write_data(g, 0x10); /* VDV */ /* Power Setting for Normal Mode */ - write_index(0xD2); - write_data(0x03); - write_data(0x04); /* 0x24 */ - write_data(0x04); + write_index(g, 0xD2); + write_data(g, 0x03); + write_data(g, 0x04); /* 0x24 */ + write_data(g, 0x04); /* Exit Sleep Mode */ - write_index(0x11); + write_index(g, 0x11); gfxSleepMilliseconds(150); /* Display ON */ - write_index(0x29); + write_index(g, 0x29); gfxSleepMilliseconds(30); - /* Release the bus */ - release_bus(); + // Finish Init + post_init_board(g); + + // Release the bus + release_bus(g); /* Turn on the back-light */ - set_backlight(GDISP_INITIAL_BACKLIGHT); + set_backlight(g, GDISP_INITIAL_BACKLIGHT); /* Initialise the GDISP structure */ g->g.Width = GDISP_SCREEN_WIDTH; @@ -198,57 +203,57 @@ LLDSPEC bool_t gdisp_lld_init(GDISPDriver *g) { } #if GDISP_HARDWARE_STREAM_WRITE - LLDSPEC void gdisp_lld_write_start(GDISPDriver *g) { - acquire_bus(); + LLDSPEC void gdisp_lld_write_start(GDisplay *g) { + acquire_bus(g); set_viewport(g); } - LLDSPEC void gdisp_lld_write_color(GDISPDriver *g) { - write_data(g->p.color); + LLDSPEC void gdisp_lld_write_color(GDisplay *g) { + write_data(g, g->p.color); } - LLDSPEC void gdisp_lld_write_stop(GDISPDriver *g) { - release_bus(); + LLDSPEC void gdisp_lld_write_stop(GDisplay *g) { + release_bus(g); } #endif #if GDISP_HARDWARE_STREAM_READ - LLDSPEC void gdisp_lld_read_start(GDISPDriver *g) { - acquire_bus(); + LLDSPEC void gdisp_lld_read_start(GDisplay *g) { + acquire_bus(g); set_viewport(g); - setreadmode(); - dummy_read(); + setreadmode(g); + dummy_read(g); } - LLDSPEC color_t gdisp_lld_read_color(GDISPDriver *g) { - return read_data(); + LLDSPEC color_t gdisp_lld_read_color(GDisplay *g) { + return read_data(g); } - LLDSPEC void gdisp_lld_read_stop(GDISPDriver *g) { - setwritemode(); - release_bus(); + LLDSPEC void gdisp_lld_read_stop(GDisplay *g) { + setwritemode(g); + release_bus(g); } #endif #if GDISP_NEED_CONTROL && GDISP_HARDWARE_CONTROL - LLDSPEC void gdisp_lld_control(GDISPDriver *g) { + LLDSPEC void gdisp_lld_control(GDisplay *g) { switch(g->p.x) { case GDISP_CONTROL_POWER: if (g->g.Powermode == (powermode_t)g->p.ptr) return; switch((powermode_t)g->p.ptr) { case powerOff: - acquire_bus(); - write_reg(0x0010, 0x0001); /* enter sleep mode */ - release_bus(); + acquire_bus(g); + write_reg(g, 0x0010, 0x0001); /* enter sleep mode */ + release_bus(g); break; case powerOn: - acquire_bus(); - write_reg(0x0010, 0x0000); /* leave sleep mode */ - release_bus(); + acquire_bus(g); + write_reg(g, 0x0010, 0x0000); /* leave sleep mode */ + release_bus(g); if (g->g.Powermode != powerSleep) gdisp_lld_init(); break; case powerSleep: - acquire_bus(); - write_reg(0x0010, 0x0001); /* enter sleep mode */ - release_bus(); + acquire_bus(g); + write_reg(g, 0x0010, 0x0001); /* enter sleep mode */ + release_bus(g); break; default: return; @@ -261,42 +266,42 @@ LLDSPEC bool_t gdisp_lld_init(GDISPDriver *g) { return; switch((orientation_t)g->p.ptr) { case GDISP_ROTATE_0: - acquire_bus(); + acquire_bus(g); - write_reg(0xC0, 0x03); - write_reg(0x36, 0x00); /* X and Y axes non-inverted */ + write_reg(g, 0xC0, 0x03); + write_reg(g, 0x36, 0x00); /* X and Y axes non-inverted */ - release_bus(); + release_bus(g); g->g.Height = GDISP_SCREEN_HEIGHT; g->g.Width = GDISP_SCREEN_WIDTH; break; case GDISP_ROTATE_90: - acquire_bus(); + acquire_bus(g); - write_reg(0xC0, 0x02); - write_reg(0x36, 0x20); /* Invert X and Y axes */ + write_reg(g, 0xC0, 0x02); + write_reg(g, 0x36, 0x20); /* Invert X and Y axes */ - release_bus(); + release_bus(g); g->g.Height = GDISP_SCREEN_WIDTH; g->g.Width = GDISP_SCREEN_HEIGHT; break; case GDISP_ROTATE_180: - acquire_bus(); + acquire_bus(g); - write_reg(0xC0, 0x06); - write_reg(0x36, 0x00); /* X and Y axes non-inverted */ + write_reg(g, 0xC0, 0x06); + write_reg(g, 0x36, 0x00); /* X and Y axes non-inverted */ - release_bus(); + release_bus(g); g->g.Height = GDISP_SCREEN_HEIGHT; g->g.Width = GDISP_SCREEN_WIDTH; break; case GDISP_ROTATE_270: - acquire_bus(); + acquire_bus(g); - write_reg(0xC0, 0x07); - write_reg(0x36, 0x20); /* Invert X and Y axes */ + write_reg(g, 0xC0, 0x07); + write_reg(g, 0x36, 0x20); /* Invert X and Y axes */ - release_bus(); + release_bus(g); g->g.Height = GDISP_SCREEN_WIDTH; g->g.Width = GDISP_SCREEN_HEIGHT; break; diff --git a/drivers/gdisp/ILI9481/gdisp_lld.mk b/drivers/gdisp/ILI9481/gdisp_lld.mk index b0b3f533..6af4d1f8 100644 --- a/drivers/gdisp/ILI9481/gdisp_lld.mk +++ b/drivers/gdisp/ILI9481/gdisp_lld.mk @@ -1,5 +1,2 @@ -# List the required driver. -GFXSRC += $(GFXLIB)/drivers/gdisp/ILI9481/gdisp_lld.c - -# Required include directories GFXINC += $(GFXLIB)/drivers/gdisp/ILI9481 +GFXSRC += $(GFXLIB)/drivers/gdisp/ILI9481/gdisp_lld.c diff --git a/drivers/gdisp/ILI9481/gdisp_lld_board_firebullstm32f103.h b/drivers/gdisp/ILI9481/gdisp_lld_board_firebullstm32f103.h deleted file mode 100644 index 7270cdaf..00000000 --- a/drivers/gdisp/ILI9481/gdisp_lld_board_firebullstm32f103.h +++ /dev/null @@ -1,156 +0,0 @@ -/* - * This file is subject to the terms of the GFX License. If a copy of - * the license was not distributed with this file, you can obtain one at: - * - * http://ugfx.org/license.html - */ - -/** - * @file drivers/gdisp/ILI9481/gdisp_lld_board_firebullstm32f103.h - * @brief GDISP Graphics Driver subsystem low level driver source for - * the ILI9481 and compatible HVGA display - * - * @addtogroup GDISP - * @{ - */ - -#ifndef _GDISP_LLD_BOARD_H -#define _GDISP_LLD_BOARD_H - -#define SET_CS palSetPad(GPIOD, 12); -#define CLR_CS palClearPad(GPIOD, 12); -#define SET_RS palSetPad(GPIOD, 13); -#define CLR_RS palClearPad(GPIOD, 13); -#define SET_WR palSetPad(GPIOD, 14); -#define CLR_WR palClearPad(GPIOD, 14); -#define SET_RD palSetPad(GPIOD, 15); -#define CLR_RD palClearPad(GPIOD, 15); - -/** - * @brief Initialise the board for the display. - * @notes This board definition uses GPIO and assumes exclusive access to these GPIO pins - * - * @notapi - */ -static inline void init_board(void) { - palSetGroupMode(GPIOE, PAL_WHOLE_PORT, 0, PAL_MODE_OUTPUT_PUSHPULL); - palSetPadMode(GPIOD, 12, PAL_MODE_OUTPUT_PUSHPULL); - palSetPadMode(GPIOD, 13, PAL_MODE_OUTPUT_PUSHPULL); - palSetPadMode(GPIOD, 14, PAL_MODE_OUTPUT_PUSHPULL); - palSetPadMode(GPIOD, 15, PAL_MODE_OUTPUT_PUSHPULL); - - // Configure the pins to a well know state - SET_RS; - SET_RD; - SET_WR; - CLR_CS; -} - - -/** - * @brief Set or clear the lcd reset pin. - * - * @param[in] state TRUE = lcd in reset, FALSE = normal operation - * - * @notapi - */ -static inline void setpin_reset(bool_t state) { - (void) state; - /* Nothing to do here - reset pin tied to Vcc */ -} - -/** - * @brief Set the lcd back-light level. - * - * @param[in] percent 0 to 100% - * - * @notapi - */ -static inline void set_backlight(uint8_t percent) { - (void) percent; - /* Nothing to do here - Backlight always on */ -} - -/** - * @brief Take exclusive control of the bus - * - * @notapi - */ -static inline void acquire_bus(void) { - /* Nothing to do here since LCD is the only device on that bus */ -} - -/** - * @brief Release exclusive control of the bus - * - * @notapi - */ -static inline void release_bus(void) { - /* Nothing to do here since LCD is the only device on that bus */ -} - -/** - * @brief Send data to the index register. - * - * @param[in] index The index register to set - * - * @notapi - */ -static inline void write_index(uint16_t index) { - palWritePort(GPIOE, index); - CLR_RS; CLR_WR; SET_WR; SET_RS; -} - -/** - * @brief Send data to the lcd. - * - * @param[in] data The data to send - * - * @notapi - */ -static inline void write_data(uint16_t data) { - palWritePort(GPIOE, data); - CLR_WR; SET_WR; -} - -/** - * @brief Set the bus in read mode - * - * @notapi - */ -static inline void setreadmode(void) { - // change pin mode to digital input - palSetGroupMode(GPIOE, PAL_WHOLE_PORT, 0, PAL_MODE_INPUT); -} - -/** - * @brief Set the bus back into write mode - * - * @notapi - */ -static inline void setwritemode(void) { - // change pin mode back to digital output - palSetGroupMode(GPIOE, PAL_WHOLE_PORT, 0, PAL_MODE_OUTPUT_PUSHPULL); -} - -/** - * @brief Read data from the lcd. - * - * @return The data from the lcd - * @note The chip select may need to be asserted/de-asserted - * around the actual spi read - * - * @notapi - */ -static inline uint16_t read_data(void) { - uint16_t value; - - CLR_RD; - value = palReadPort(GPIOE); - SET_RD; - - return value; -} - -#endif /* _GDISP_LLD_BOARD_H */ -/** @} */ diff --git a/drivers/gdisp/ILI9481/gdisp_lld_board_template.h b/drivers/gdisp/ILI9481/gdisp_lld_board_template.h deleted file mode 100644 index e35f0c27..00000000 --- a/drivers/gdisp/ILI9481/gdisp_lld_board_template.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * This file is subject to the terms of the GFX License. If a copy of - * the license was not distributed with this file, you can obtain one at: - * - * http://ugfx.org/license.html - */ - -/** - * @file drivers/gdisp/ILI9481/gdisp_lld_board_template.h - * @brief GDISP Graphics Driver subsystem low level driver source for - * the ILI9481 and compatible HVGA display - * - * @addtogroup GDISP - * @{ - */ - -#ifndef _GDISP_LLD_BOARD_H -#define _GDISP_LLD_BOARD_H - -/** - * @brief Initialise the board for the display. - * - * @notapi - */ -static inline void init_board(void) { - -} - -/** - * @brief Set or clear the lcd reset pin. - * - * @param[in] state TRUE = lcd in reset, FALSE = normal operation - * - * @notapi - */ -static inline void setpin_reset(bool_t state) { - -} - -/** - * @brief Set the lcd back-light level. - * - * @param[in] percent 0 to 100% - * - * @notapi - */ -static inline void set_backlight(uint8_t percent) { - -} - -/** - * @brief Take exclusive control of the bus - * - * @notapi - */ -static inline void acquire_bus(void) { - -} - -/** - * @brief Release exclusive control of the bus - * - * @notapi - */ -static inline void release_bus(void) { - -} - -/** - * @brief Send data to the index register. - * - * @param[in] index The index register to set - * - * @notapi - */ -static inline void write_index(uint16_t index) { - -} - -/** - * @brief Send data to the lcd. - * - * @param[in] data The data to send - * - * @notapi - */ -static inline void write_data(uint16_t data) { - -} - -/** - * @brief Set the bus in read mode - * - * @notapi - */ -static inline void setreadmode(void) { - -} - -/** - * @brief Set the bus back into write mode - * - * @notapi - */ -static inline void setwritemode(void) { - -} - -/** - * @brief Read data from the lcd. - * - * @return The data from the lcd - * @note The chip select may need to be asserted/de-asserted - * around the actual spi read - * - * @notapi - */ -static inline uint16_t read_data(void) { - -} - -#endif /* _GDISP_LLD_BOARD_H */ -/** @} */ diff --git a/drivers/gdisp/ILI9481/gdisp_lld_config.h b/drivers/gdisp/ILI9481/gdisp_lld_config.h index c41edd6b..4a33d110 100644 --- a/drivers/gdisp/ILI9481/gdisp_lld_config.h +++ b/drivers/gdisp/ILI9481/gdisp_lld_config.h @@ -23,9 +23,6 @@ /* Driver hardware support. */ /*===========================================================================*/ -#define GDISP_DRIVER_NAME "ILI9481" -#define GDISP_DRIVER_STRUCT GDISP_ILI9481 - #define GDISP_HARDWARE_STREAM_WRITE TRUE #define GDISP_HARDWARE_STREAM_READ TRUE #define GDISP_HARDWARE_CONTROL TRUE