SSD2119: code & comments cleanup
This commit is contained in:
parent
2de39e3302
commit
c42602375b
5 changed files with 28 additions and 22 deletions
|
@ -58,10 +58,10 @@
|
||||||
#if defined(GDISP_USE_CUSTOM_BOARD) && GDISP_USE_CUSTOM_BOARD
|
#if defined(GDISP_USE_CUSTOM_BOARD) && GDISP_USE_CUSTOM_BOARD
|
||||||
/* Include the user supplied board definitions */
|
/* Include the user supplied board definitions */
|
||||||
#include "gdisp_lld_board.h"
|
#include "gdisp_lld_board.h"
|
||||||
#elif defined(BOARD_EMBEST_DMSTF4BB_FSMC)
|
|
||||||
#include "gdisp_lld_board_embest_dmstf4bb_fsmc.h"
|
|
||||||
#elif defined(BOARD_EMBEST_DMSTF4BB)
|
#elif defined(BOARD_EMBEST_DMSTF4BB)
|
||||||
#include "gdisp_lld_board_embest_dmstf4bb.h"
|
#include "gdisp_lld_board_embest_dmstf4bb.h"
|
||||||
|
#elif defined(BOARD_EMBEST_DMSTF4BB_FSMC)
|
||||||
|
#include "gdisp_lld_board_embest_dmstf4bb_fsmc.h"
|
||||||
#else
|
#else
|
||||||
/* Include the user supplied board definitions */
|
/* Include the user supplied board definitions */
|
||||||
#include "gdisp_lld_board.h"
|
#include "gdisp_lld_board.h"
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
|
|
||||||
// Some common routines and macros
|
// Some common routines and macros
|
||||||
#define write_reg(reg, data) { write_index(reg); write_data(data); }
|
#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 stream_stop()
|
||||||
#define delay(us) chThdSleepMicroseconds(us)
|
#define delay(us) chThdSleepMicroseconds(us)
|
||||||
#define delayms(ms) chThdSleepMilliseconds(ms)
|
#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
|
* Lower 9 bits gives 0-511 range in each value, HSA and HEA respectively
|
||||||
* 0 <= HSA <= HEA <= 0x13F
|
* 0 <= HSA <= HEA <= 0x13F
|
||||||
*/
|
*/
|
||||||
|
|
||||||
switch(GDISP.Orientation) {
|
switch(GDISP.Orientation) {
|
||||||
case GDISP_ROTATE_0:
|
case GDISP_ROTATE_0:
|
||||||
write_reg(SSD2119_REG_V_RAM_POS, (((y + cy - 1) << 8) & 0xFF00 ) | (y & 0x00FF));
|
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();
|
acquire_bus();
|
||||||
set_cursor(x, y);
|
set_cursor(x, y);
|
||||||
write_reg(0x0022, color);
|
write_reg(SSD2119_REG_RAM_DATA, color);
|
||||||
release_bus();
|
release_bus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file drivers/gdisp/SSD2119/gdisp_lld_board_embest_dmstf4bb.h
|
* @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
|
* @addtogroup GDISP
|
||||||
* @{
|
* @{
|
||||||
|
@ -47,7 +47,6 @@
|
||||||
* @notapi
|
* @notapi
|
||||||
*/
|
*/
|
||||||
static __inline void init_board(void) {
|
static __inline void init_board(void) {
|
||||||
|
|
||||||
// D0 - D15
|
// D0 - D15
|
||||||
palSetPadMode(GPIOD, 14, PAL_MODE_OUTPUT_PUSHPULL);
|
palSetPadMode(GPIOD, 14, PAL_MODE_OUTPUT_PUSHPULL);
|
||||||
palSetPadMode(GPIOD, 15, PAL_MODE_OUTPUT_PUSHPULL);
|
palSetPadMode(GPIOD, 15, PAL_MODE_OUTPUT_PUSHPULL);
|
||||||
|
@ -143,7 +142,6 @@ static __inline void release_bus(void) {
|
||||||
* @notapi
|
* @notapi
|
||||||
*/
|
*/
|
||||||
static __inline void write_index(uint16_t index) {
|
static __inline void write_index(uint16_t index) {
|
||||||
|
|
||||||
// D0 - D15
|
// D0 - D15
|
||||||
palWritePad(GPIOD, 14, index & 1);
|
palWritePad(GPIOD, 14, index & 1);
|
||||||
palWritePad(GPIOD, 15, (index >> 1) & 1);
|
palWritePad(GPIOD, 15, (index >> 1) & 1);
|
||||||
|
@ -174,7 +172,6 @@ static __inline void write_index(uint16_t index) {
|
||||||
* @notapi
|
* @notapi
|
||||||
*/
|
*/
|
||||||
static __inline void write_data(uint16_t data) {
|
static __inline void write_data(uint16_t data) {
|
||||||
|
|
||||||
// D0 - D15
|
// D0 - D15
|
||||||
palWritePad(GPIOD, 14, data & 1);
|
palWritePad(GPIOD, 14, data & 1);
|
||||||
palWritePad(GPIOD, 15, (data >> 1) & 1);
|
palWritePad(GPIOD, 15, (data >> 1) & 1);
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file drivers/gdisp/SSD2119/gdisp_lld_board_embest_dmstf4bb.h
|
* @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
|
* @addtogroup GDISP
|
||||||
* @{
|
* @{
|
||||||
|
|
|
@ -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
|
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.
|
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:
|
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:
|
d) The following are optional - define them if you are not using the defaults below:
|
||||||
#define GDISP_SCREEN_WIDTH 320
|
#define GDISP_SCREEN_WIDTH 320
|
||||||
|
|
|
@ -18,6 +18,14 @@
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file drivers/gdisp/SSD2119/ssd2119.h
|
||||||
|
* @brief GDISP Graphic Driver support header for the SSD2119 display.
|
||||||
|
*
|
||||||
|
* @addtogroup GDISP
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef _SSD2119_H
|
#ifndef _SSD2119_H
|
||||||
#define _SSD2119_H
|
#define _SSD2119_H
|
||||||
|
|
||||||
|
@ -69,6 +77,7 @@
|
||||||
#define SSD2119_REG_X_RAM_ADDR 0x4E
|
#define SSD2119_REG_X_RAM_ADDR 0x4E
|
||||||
#define SSD2119_REG_Y_RAM_ADDR 0x4F
|
#define SSD2119_REG_Y_RAM_ADDR 0x4F
|
||||||
|
|
||||||
/* SSD2119 commands */
|
/* TODO: SSD2119 commands */
|
||||||
|
|
||||||
#endif // _SSD2119_H
|
#endif /* _SSD2119_H */
|
||||||
|
/** @} */
|
||||||
|
|
Loading…
Add table
Reference in a new issue