From c42602375b652d5673861fc5b7a66c0ac1ce6508 Mon Sep 17 00:00:00 2001 From: Mateusz Tomaszkiewicz Date: Thu, 7 Feb 2013 16:01:07 +0100 Subject: SSD2119: code & comments cleanup --- drivers/gdisp/SSD2119/gdisp_lld.c | 9 ++++----- drivers/gdisp/SSD2119/gdisp_lld_board_embest_dmstf4bb.h | 9 +++------ .../gdisp/SSD2119/gdisp_lld_board_embest_dmstf4bb_fsmc.h | 12 ++++++------ drivers/gdisp/SSD2119/readme.txt | 5 +++-- drivers/gdisp/SSD2119/ssd2119.h | 15 ++++++++++++--- 5 files changed, 28 insertions(+), 22 deletions(-) diff --git a/drivers/gdisp/SSD2119/gdisp_lld.c b/drivers/gdisp/SSD2119/gdisp_lld.c index 3b726d4f..0f0fd0fc 100644 --- a/drivers/gdisp/SSD2119/gdisp_lld.c +++ b/drivers/gdisp/SSD2119/gdisp_lld.c @@ -58,10 +58,10 @@ #if defined(GDISP_USE_CUSTOM_BOARD) && GDISP_USE_CUSTOM_BOARD /* Include the user supplied board definitions */ #include "gdisp_lld_board.h" -#elif defined(BOARD_EMBEST_DMSTF4BB_FSMC) - #include "gdisp_lld_board_embest_dmstf4bb_fsmc.h" #elif defined(BOARD_EMBEST_DMSTF4BB) #include "gdisp_lld_board_embest_dmstf4bb.h" +#elif defined(BOARD_EMBEST_DMSTF4BB_FSMC) + #include "gdisp_lld_board_embest_dmstf4bb_fsmc.h" #else /* Include the user supplied board definitions */ #include "gdisp_lld_board.h" @@ -69,7 +69,7 @@ // Some common routines and macros #define write_reg(reg, data) { write_index(reg); write_data(data); } -#define stream_start() write_index(0x0022); +#define stream_start() write_index(SSD2119_REG_RAM_DATA); #define stream_stop() #define delay(us) chThdSleepMicroseconds(us) #define delayms(ms) chThdSleepMilliseconds(ms) @@ -111,7 +111,6 @@ static void set_viewport(coord_t x, coord_t y, coord_t cx, coord_t cy) { * Lower 9 bits gives 0-511 range in each value, HSA and HEA respectively * 0 <= HSA <= HEA <= 0x13F */ - switch(GDISP.Orientation) { case GDISP_ROTATE_0: write_reg(SSD2119_REG_V_RAM_POS, (((y + cy - 1) << 8) & 0xFF00 ) | (y & 0x00FF)); @@ -295,7 +294,7 @@ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) { acquire_bus(); set_cursor(x, y); - write_reg(0x0022, color); + write_reg(SSD2119_REG_RAM_DATA, color); release_bus(); } diff --git a/drivers/gdisp/SSD2119/gdisp_lld_board_embest_dmstf4bb.h b/drivers/gdisp/SSD2119/gdisp_lld_board_embest_dmstf4bb.h index 6be134b4..85727600 100644 --- a/drivers/gdisp/SSD2119/gdisp_lld_board_embest_dmstf4bb.h +++ b/drivers/gdisp/SSD2119/gdisp_lld_board_embest_dmstf4bb.h @@ -20,7 +20,7 @@ /** * @file drivers/gdisp/SSD2119/gdisp_lld_board_embest_dmstf4bb.h - * @brief GDISP Graphic Driver subsystem board interface for the SSD2119 display. + * @brief GDISP Graphic Driver subsystem board GPIO interface for the SSD2119 display. * * @addtogroup GDISP * @{ @@ -37,8 +37,8 @@ #define CLR_WR palClearPad(GPIOD, 5); #define SET_RD palSetPad(GPIOD, 4); #define CLR_RD palClearPad(GPIOD, 4); -#define SET_RST palSetPad(GPIOD, 3); -#define CLR_RST palClearPad(GPIOD, 3); +#define SET_RST palSetPad(GPIOD, 3); +#define CLR_RST palClearPad(GPIOD, 3); /** * @brief Initialise the board for the display. @@ -47,7 +47,6 @@ * @notapi */ static __inline void init_board(void) { - // D0 - D15 palSetPadMode(GPIOD, 14, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(GPIOD, 15, PAL_MODE_OUTPUT_PUSHPULL); @@ -143,7 +142,6 @@ static __inline void release_bus(void) { * @notapi */ static __inline void write_index(uint16_t index) { - // D0 - D15 palWritePad(GPIOD, 14, index & 1); palWritePad(GPIOD, 15, (index >> 1) & 1); @@ -174,7 +172,6 @@ static __inline void write_index(uint16_t index) { * @notapi */ static __inline void write_data(uint16_t data) { - // D0 - D15 palWritePad(GPIOD, 14, data & 1); palWritePad(GPIOD, 15, (data >> 1) & 1); diff --git a/drivers/gdisp/SSD2119/gdisp_lld_board_embest_dmstf4bb_fsmc.h b/drivers/gdisp/SSD2119/gdisp_lld_board_embest_dmstf4bb_fsmc.h index 90a8ec8a..529a10a6 100644 --- a/drivers/gdisp/SSD2119/gdisp_lld_board_embest_dmstf4bb_fsmc.h +++ b/drivers/gdisp/SSD2119/gdisp_lld_board_embest_dmstf4bb_fsmc.h @@ -20,7 +20,7 @@ /** * @file drivers/gdisp/SSD2119/gdisp_lld_board_embest_dmstf4bb.h - * @brief GDISP Graphic Driver subsystem board interface for the SSD2119 display. + * @brief GDISP Graphic Driver subsystem board FSMC interface for the SSD2119 display. * * @addtogroup GDISP * @{ @@ -30,11 +30,11 @@ #define _GDISP_LLD_BOARD_H /* Using FSMC A19 (PE3) as DC */ -#define GDISP_REG (*((volatile uint16_t *) 0x60000000)) /* DC = 0 */ -#define GDISP_RAM (*((volatile uint16_t *) 0x60100000)) /* DC = 1 */ +#define GDISP_REG (*((volatile uint16_t *) 0x60000000)) /* DC = 0 */ +#define GDISP_RAM (*((volatile uint16_t *) 0x60100000)) /* DC = 1 */ -#define SET_RST palSetPad(GPIOD, 3); -#define CLR_RST palClearPad(GPIOD, 3); +#define SET_RST palSetPad(GPIOD, 3); +#define CLR_RST palClearPad(GPIOD, 3); /** * @brief Initialise the board for the display. @@ -53,7 +53,7 @@ static __inline void init_board(void) { (1 << 9) | (1 << 10) | (1 << 14) | (1 << 15), 0}; IOBus busE = {GPIOE, (1 << 3) | (1 << 7) | (1 << 8) | (1 << 9) | (1 << 10) | (1 << 11) | (1 << 12) | - (1 << 13) | (1 << 14) | (1 << 15), 0}; + (1 << 13) | (1 << 14) | (1 << 15), 0}; /* FSMC is an alternate function 12 (AF12) */ palSetBusMode(&busD, PAL_MODE_ALTERNATE(12)); diff --git a/drivers/gdisp/SSD2119/readme.txt b/drivers/gdisp/SSD2119/readme.txt index 116b251e..e9f6558a 100644 --- a/drivers/gdisp/SSD2119/readme.txt +++ b/drivers/gdisp/SSD2119/readme.txt @@ -7,9 +7,10 @@ To use this driver: c) If you are not using a known board then create a gdisp_lld_board.h file and ensure it is on your include path. - Use the gdisp_lld_board_example.h or gdisp_lld_board_fsmc.h file as a basis. + Use the gdisp_lld_board_embest_dmstf4bb_fsmc.h or gdisp_lld_board_embest_dmstf4bb_fsmc.h file as a basis. Currently known boards are: - BOARD_FIREBULL_STM32_F103 - GPIO interface: requires GDISP_CMD_PORT and GDISP_DATA_PORT to be defined + BOARD_EMBEST_DMSTF4BB - GPIO interface + BOARD_EMBEST_DMSTF4BB_FSMC - FSMC interface d) The following are optional - define them if you are not using the defaults below: #define GDISP_SCREEN_WIDTH 320 diff --git a/drivers/gdisp/SSD2119/ssd2119.h b/drivers/gdisp/SSD2119/ssd2119.h index d3eb484e..789958ba 100644 --- a/drivers/gdisp/SSD2119/ssd2119.h +++ b/drivers/gdisp/SSD2119/ssd2119.h @@ -1,6 +1,6 @@ /* ChibiOS/GFX - Copyright (C) 2012 - Joel Bodenmann aka Tectu + Joel Bodenmann aka Tectu This file is part of ChibiOS/GFX. @@ -18,6 +18,14 @@ along with this program. If not, see . */ +/** + * @file drivers/gdisp/SSD2119/ssd2119.h + * @brief GDISP Graphic Driver support header for the SSD2119 display. + * + * @addtogroup GDISP + * @{ + */ + #ifndef _SSD2119_H #define _SSD2119_H @@ -69,6 +77,7 @@ #define SSD2119_REG_X_RAM_ADDR 0x4E #define SSD2119_REG_Y_RAM_ADDR 0x4F -/* SSD2119 commands */ +/* TODO: SSD2119 commands */ -#endif // _SSD2119_H +#endif /* _SSD2119_H */ +/** @} */ -- cgit v1.2.3