aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gdisp/SSD1289
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gdisp/SSD1289')
-rw-r--r--drivers/gdisp/SSD1289/gdisp_lld.c23
-rw-r--r--drivers/gdisp/SSD1289/gdisp_lld_board_example.h4
-rw-r--r--drivers/gdisp/SSD1289/gdisp_lld_board_example_fsmc.h2
-rw-r--r--drivers/gdisp/SSD1289/gdisp_lld_board_firebullstm32f103.h51
4 files changed, 44 insertions, 36 deletions
diff --git a/drivers/gdisp/SSD1289/gdisp_lld.c b/drivers/gdisp/SSD1289/gdisp_lld.c
index ff1abc19..0d05ede8 100644
--- a/drivers/gdisp/SSD1289/gdisp_lld.c
+++ b/drivers/gdisp/SSD1289/gdisp_lld.c
@@ -40,10 +40,10 @@
/*===========================================================================*/
#ifndef GDISP_SCREEN_HEIGHT
- #define GDISP_SCREEN_HEIGHT 240
+ #define GDISP_SCREEN_HEIGHT 320
#endif
#ifndef GDISP_SCREEN_WIDTH
- #define GDISP_SCREEN_WIDTH 320
+ #define GDISP_SCREEN_WIDTH 240
#endif
#define GDISP_INITIAL_CONTRAST 50
@@ -62,7 +62,7 @@
// Some common routines and macros
#define write_reg(reg, data) { write_index(reg); write_data(data); }
-#define stream_start() write_reg(0x0022);
+#define stream_start() write_index(0x0022);
#define stream_stop()
#define delay(us) chThdSleepMicroseconds(us)
#define delayms(ms) chThdSleepMilliseconds(ms)
@@ -161,7 +161,7 @@ bool_t GDISP_LLD(init)(void) {
delayms(20);
// Get the bus for the following initialisation commands
- get_bus();
+ acquire_bus();
write_reg(0x0000,0x0001); delay(5);
write_reg(0x0003,0xA8A4); delay(5);
@@ -241,7 +241,7 @@ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) {
if (x < GDISP.clipx0 || y < GDISP.clipy0 || x >= GDISP.clipx1 || y >= GDISP.clipy1) return;
#endif
- get_bus();
+ acquire_bus();
set_cursor(x, y);
write_reg(0x0022, color);
release_bus();
@@ -276,7 +276,7 @@ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) {
void GDISP_LLD(clear)(color_t color) {
unsigned i;
- get_bus();
+ acquire_bus();
set_cursor(0, 0);
stream_start();
for(i = 0; i < GDISP_SCREEN_WIDTH * GDISP_SCREEN_HEIGHT; i++)
@@ -310,7 +310,7 @@ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) {
area = cx*cy;
- get_bus();
+ acquire_bus();
set_viewport(x, y, cx, cy);
stream_start();
for(i = 0; i < area; i++)
@@ -346,7 +346,7 @@ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) {
if (y+cy > GDISP.clipy1) cy = GDISP.clipy1 - y;
#endif
- get_bus();
+ acquire_bus();
set_viewport(x, y, cx, cy);
stream_start();
@@ -368,7 +368,7 @@ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) {
* @note Optional.
* @note If x,y is off the screen, the result is undefined.
*
- * @param[in] x, y The start of the text
+ * @param[in] x, y The pixel to be read
*
* @notapi
*/
@@ -379,13 +379,14 @@ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) {
if (x < 0 || x >= GDISP.Width || y < 0 || y >= GDISP.Height) return 0;
#endif
- get_bus();
+ acquire_bus();
set_cursor(x, y);
stream_start();
color = read_data(); // dummy read
color = read_data();
stream_stop();
release_bus();
+
return color;
}
#endif
@@ -419,7 +420,7 @@ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) {
abslines = lines < 0 ? -lines : lines;
- get_bus();
+ acquire_bus();
if (abslines >= cy) {
abslines = cy;
gap = 0;
diff --git a/drivers/gdisp/SSD1289/gdisp_lld_board_example.h b/drivers/gdisp/SSD1289/gdisp_lld_board_example.h
index 6dcad1b5..c47a6ed6 100644
--- a/drivers/gdisp/SSD1289/gdisp_lld_board_example.h
+++ b/drivers/gdisp/SSD1289/gdisp_lld_board_example.h
@@ -68,8 +68,8 @@ static __inline void set_backlight(uint8_t percent) {
*
* @notapi
*/
-static __inline void get_bus(void) {
-#error "SSD1289: You must supply a definition for get_bus for your board"
+static __inline void acquire_bus(void) {
+#error "SSD1289: You must supply a definition for acquire_bus for your board"
}
/**
diff --git a/drivers/gdisp/SSD1289/gdisp_lld_board_example_fsmc.h b/drivers/gdisp/SSD1289/gdisp_lld_board_example_fsmc.h
index d3532b76..dd492f9d 100644
--- a/drivers/gdisp/SSD1289/gdisp_lld_board_example_fsmc.h
+++ b/drivers/gdisp/SSD1289/gdisp_lld_board_example_fsmc.h
@@ -116,7 +116,7 @@ static __inline void set_backlight(uint8_t percent) {
*
* @notapi
*/
-static __inline void get_bus(void) {
+static __inline void acquire_bus(void) {
/* Nothing to do here */
}
diff --git a/drivers/gdisp/SSD1289/gdisp_lld_board_firebullstm32f103.h b/drivers/gdisp/SSD1289/gdisp_lld_board_firebullstm32f103.h
index bab13dda..07cdfa12 100644
--- a/drivers/gdisp/SSD1289/gdisp_lld_board_firebullstm32f103.h
+++ b/drivers/gdisp/SSD1289/gdisp_lld_board_firebullstm32f103.h
@@ -29,14 +29,14 @@
#ifndef _GDISP_LLD_BOARD_H
#define _GDISP_LLD_BOARD_H
-#define SET_CS palSetPad(GDISP_CMD_PORT, GDISP_CS);
-#define CLR_CS palClearPad(GDISP_CMD_PORT, GDISP_CS);
-#define SET_RS palSetPad(GDISP_CMD_PORT, GDISP_RS);
-#define CLR_RS palClearPad(GDISP_CMD_PORT, GDISP_RS);
-#define SET_WR palSetPad(GDISP_CMD_PORT, GDISP_WR);
-#define CLR_WR palClearPad(GDISP_CMD_PORT, GDISP_WR);
-#define SET_RD palSetPad(GDISP_CMD_PORT, GDISP_RD);
-#define CLR_RD palClearPad(GDISP_CMD_PORT, GDISP_RD);
+#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.
@@ -45,10 +45,17 @@
* @notapi
*/
static __inline void init_board(void) {
- // This should set the GPIO port up for the correct hardware config here
+ 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_RW; CLR_CS;
+ SET_RS;
+ SET_RD;
+ SET_WR;
+ CLR_CS;
}
@@ -61,7 +68,7 @@ static __inline void init_board(void) {
*/
static __inline void setpin_reset(bool_t state) {
(void) state;
- /* Nothing to do here */
+ /* Nothing to do here - reset pin tied to Vcc */
}
/**
@@ -73,7 +80,7 @@ static __inline void setpin_reset(bool_t state) {
*/
static __inline void set_backlight(uint8_t percent) {
(void) percent;
- /* Nothing to do here */
+ /* Nothing to do here - Backlight always on */
}
/**
@@ -81,8 +88,8 @@ static __inline void set_backlight(uint8_t percent) {
*
* @notapi
*/
-static __inline void get_bus(void) {
- /* Nothing to do here */
+static __inline void acquire_bus(void) {
+ /* Nothing to do here since LCD is the only device on that bus */
}
/**
@@ -91,7 +98,7 @@ static __inline void get_bus(void) {
* @notapi
*/
static __inline void release_bus(void) {
- /* Nothing to do here */
+ /* Nothing to do here since LCD is the only device on that bus */
}
/**
@@ -102,7 +109,7 @@ static __inline void release_bus(void) {
* @notapi
*/
static __inline void write_index(uint16_t index) {
- palWritePort(GDISP_DATA_PORT, index);
+ palWritePort(GPIOE, index);
CLR_RS; CLR_WR; SET_WR; SET_RS;
}
@@ -114,7 +121,7 @@ static __inline void write_index(uint16_t index) {
* @notapi
*/
static __inline void write_data(uint16_t data) {
- palWritePort(GDISP_DATA_PORT, data);
+ palWritePort(GPIOE, data);
CLR_WR; SET_WR;
}
@@ -132,16 +139,16 @@ static __inline uint16_t read_data(void) {
uint16_t value;
// change pin mode to digital input
- GDISP_DATA_PORT->CRH = 0x44444444;
- GDISP_DATA_PORT->CRL = 0x44444444;
+ palSetGroupMode(GPIOE, PAL_WHOLE_PORT, 0, PAL_MODE_INPUT);
CLR_RD;
- value = palReadPort(GDISP_DATA_PORT);
+ value = palReadPort(GPIOE);
+ value = palReadPort(GPIOE);
SET_RD;
// change pin mode back to digital output
- GDISP_DATA_PORT->CRH = 0x33333333;
- GDISP_DATA_PORT->CRL = 0x33333333;
+ palSetGroupMode(GPIOE, PAL_WHOLE_PORT, 0, PAL_MODE_OUTPUT_PUSHPULL);
+
return value;
}
#endif