summaryrefslogtreecommitdiff
path: root/drivers/ugfx
diff options
context:
space:
mode:
authorFred Sundvik <fsundvik@gmail.com>2017-07-09 13:50:18 +0300
committerJack Humbert <jack.humb@gmail.com>2017-07-10 09:01:59 -0400
commit011ee294414800eaa18ce7c3f9447054d9eae765 (patch)
treedf9378c71287fedd424b01ab51bd3f1358baea8a /drivers/ugfx
parent630f065376618d94f4616687629aadb3ee91e562 (diff)
Fixup mixed tabs/spaces
Diffstat (limited to 'drivers/ugfx')
-rw-r--r--drivers/ugfx/gdisp/is31fl3731c/gdisp_is31fl3731c.c246
-rw-r--r--drivers/ugfx/gdisp/is31fl3731c/gdisp_lld_config.h14
-rw-r--r--drivers/ugfx/gdisp/st7565/gdisp_lld_ST7565.c36
-rw-r--r--drivers/ugfx/gdisp/st7565/gdisp_lld_config.h6
4 files changed, 151 insertions, 151 deletions
diff --git a/drivers/ugfx/gdisp/is31fl3731c/gdisp_is31fl3731c.c b/drivers/ugfx/gdisp/is31fl3731c/gdisp_is31fl3731c.c
index c55dd0a0ea..0691dbfbf3 100644
--- a/drivers/ugfx/gdisp/is31fl3731c/gdisp_is31fl3731c.c
+++ b/drivers/ugfx/gdisp/is31fl3731c/gdisp_is31fl3731c.c
@@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#if GFX_USE_GDISP
-#define GDISP_DRIVER_VMT GDISPVMT_IS31FL3731C_QMK
+#define GDISP_DRIVER_VMT GDISPVMT_IS31FL3731C_QMK
#include "gdisp_lld_config.h"
#include "src/gdisp/gdisp_driver.h"
@@ -34,26 +34,26 @@ extern const uint8_t CIE1931_CURVE[];
/*===========================================================================*/
#ifndef GDISP_SCREEN_HEIGHT
- #define GDISP_SCREEN_HEIGHT 9
+ #define GDISP_SCREEN_HEIGHT 9
#endif
#ifndef GDISP_SCREEN_WIDTH
- #define GDISP_SCREEN_WIDTH 16
+ #define GDISP_SCREEN_WIDTH 16
#endif
#ifndef GDISP_INITIAL_CONTRAST
- #define GDISP_INITIAL_CONTRAST 0
+ #define GDISP_INITIAL_CONTRAST 0
#endif
#ifndef GDISP_INITIAL_BACKLIGHT
- #define GDISP_INITIAL_BACKLIGHT 0
+ #define GDISP_INITIAL_BACKLIGHT 0
#endif
-#define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER<<0)
+#define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER<<0)
#define IS31_ADDR_DEFAULT 0x74
-#define IS31_REG_CONFIG 0x00
+#define IS31_REG_CONFIG 0x00
// bits in reg
-#define IS31_REG_CONFIG_PICTUREMODE 0x00
-#define IS31_REG_CONFIG_AUTOPLAYMODE 0x08
+#define IS31_REG_CONFIG_PICTUREMODE 0x00
+#define IS31_REG_CONFIG_AUTOPLAYMODE 0x08
#define IS31_REG_CONFIG_AUDIOPLAYMODE 0x18
// D2:D0 bits are starting frame for autoplay mode
@@ -144,14 +144,14 @@ static GFXINLINE void write_ram(GDisplay *g, uint8_t page, uint16_t offset, uint
}
LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
- // The private area is the display surface.
- g->priv = gfxAlloc(sizeof(PrivData));
+ // The private area is the display surface.
+ g->priv = gfxAlloc(sizeof(PrivData));
__builtin_memset(PRIV(g), 0, sizeof(PrivData));
- PRIV(g)->page = 0;
+ PRIV(g)->page = 0;
- // Initialise the board interface
- init_board(g);
- gfxSleepMilliseconds(10);
+ // Initialise the board interface
+ init_board(g);
+ gfxSleepMilliseconds(10);
// zero function page, all registers (assuming full_page is all zeroes)
write_ram(g, IS31_FUNCTIONREG, 0, IS31_FUNCTIONREG_SIZE);
@@ -179,134 +179,134 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
// Finish Init
post_init_board(g);
- /* Initialise the GDISP structure */
- g->g.Width = GDISP_SCREEN_WIDTH;
- g->g.Height = GDISP_SCREEN_HEIGHT;
- g->g.Orientation = GDISP_ROTATE_0;
- g->g.Powermode = powerOff;
- g->g.Backlight = GDISP_INITIAL_BACKLIGHT;
- g->g.Contrast = GDISP_INITIAL_CONTRAST;
- return TRUE;
+ /* Initialise the GDISP structure */
+ g->g.Width = GDISP_SCREEN_WIDTH;
+ g->g.Height = GDISP_SCREEN_HEIGHT;
+ g->g.Orientation = GDISP_ROTATE_0;
+ g->g.Powermode = powerOff;
+ g->g.Backlight = GDISP_INITIAL_BACKLIGHT;
+ g->g.Contrast = GDISP_INITIAL_CONTRAST;
+ return TRUE;
}
#if GDISP_HARDWARE_FLUSH
- LLDSPEC void gdisp_lld_flush(GDisplay *g) {
- // Don't flush if we don't need it.
- if (!(g->flags & GDISP_FLG_NEEDFLUSH))
- return;
-
- PRIV(g)->page++;
- PRIV(g)->page %= 2;
- // TODO: some smarter algorithm for this
- // We should run only one physical page at a time
- // This way we don't need to send so much data, and
- // we could use slightly less memory
- uint8_t* src = PRIV(g)->frame_buffer;
- for (int y=0;y<GDISP_SCREEN_HEIGHT;y++) {
- for (int x=0;x<GDISP_SCREEN_WIDTH;x++) {
- uint8_t val = (uint16_t)*src * g->g.Backlight / 100;
- PRIV(g)->write_buffer[get_led_address(g, x, y)]=CIE1931_CURVE[val];
- ++src;
- }
- }
+ LLDSPEC void gdisp_lld_flush(GDisplay *g) {
+ // Don't flush if we don't need it.
+ if (!(g->flags & GDISP_FLG_NEEDFLUSH))
+ return;
+
+ PRIV(g)->page++;
+ PRIV(g)->page %= 2;
+ // TODO: some smarter algorithm for this
+ // We should run only one physical page at a time
+ // This way we don't need to send so much data, and
+ // we could use slightly less memory
+ uint8_t* src = PRIV(g)->frame_buffer;
+ for (int y=0;y<GDISP_SCREEN_HEIGHT;y++) {
+ for (int x=0;x<GDISP_SCREEN_WIDTH;x++) {
+ uint8_t val = (uint16_t)*src * g->g.Backlight / 100;
+ PRIV(g)->write_buffer[get_led_address(g, x, y)]=CIE1931_CURVE[val];
+ ++src;
+ }
+ }
write_ram(g, PRIV(g)->page, IS31_PWM_REG, IS31_PWM_SIZE);
gfxSleepMilliseconds(1);
write_register(g, IS31_FUNCTIONREG, IS31_REG_PICTDISP, PRIV(g)->page);
- g->flags &= ~GDISP_FLG_NEEDFLUSH;
- }
+ g->flags &= ~GDISP_FLG_NEEDFLUSH;
+ }
#endif
#if GDISP_HARDWARE_DRAWPIXEL
- LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) {
- coord_t x, y;
-
- switch(g->g.Orientation) {
- default:
- case GDISP_ROTATE_0:
- x = g->p.x;
- y = g->p.y;
- break;
- case GDISP_ROTATE_180:
- x = GDISP_SCREEN_WIDTH-1 - g->p.x;
- y = g->p.y;
- break;
- }
- PRIV(g)->frame_buffer[y * GDISP_SCREEN_WIDTH + x] = gdispColor2Native(g->p.color);
- g->flags |= GDISP_FLG_NEEDFLUSH;
- }
+ LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) {
+ coord_t x, y;
+
+ switch(g->g.Orientation) {
+ default:
+ case GDISP_ROTATE_0:
+ x = g->p.x;
+ y = g->p.y;
+ break;
+ case GDISP_ROTATE_180:
+ x = GDISP_SCREEN_WIDTH-1 - g->p.x;
+ y = g->p.y;
+ break;
+ }
+ PRIV(g)->frame_buffer[y * GDISP_SCREEN_WIDTH + x] = gdispColor2Native(g->p.color);
+ g->flags |= GDISP_FLG_NEEDFLUSH;
+ }
#endif
#if GDISP_HARDWARE_PIXELREAD
- LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) {
- coord_t x, y;
-
- switch(g->g.Orientation) {
- default:
- case GDISP_ROTATE_0:
- x = g->p.x;
- y = g->p.y;
- break;
- case GDISP_ROTATE_180:
- x = GDISP_SCREEN_WIDTH-1 - g->p.x;
- y = g->p.y;
- break;
- }
- return gdispNative2Color(PRIV(g)->frame_buffer[y * GDISP_SCREEN_WIDTH + x]);
- }
+ LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) {
+ coord_t x, y;
+
+ switch(g->g.Orientation) {
+ default:
+ case GDISP_ROTATE_0:
+ x = g->p.x;
+ y = g->p.y;
+ break;
+ case GDISP_ROTATE_180:
+ x = GDISP_SCREEN_WIDTH-1 - g->p.x;
+ y = g->p.y;
+ break;
+ }
+ return gdispNative2Color(PRIV(g)->frame_buffer[y * GDISP_SCREEN_WIDTH + x]);
+ }
#endif
#if GDISP_NEED_CONTROL && GDISP_HARDWARE_CONTROL
- 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:
- case powerSleep:
- case powerDeepSleep:
+ 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:
+ case powerSleep:
+ case powerDeepSleep:
write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_OFF);
- break;
- case powerOn:
+ break;
+ case powerOn:
write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_ON);
- break;
- default:
- return;
- }
- g->g.Powermode = (powermode_t)g->p.ptr;
- return;
-
- case GDISP_CONTROL_ORIENTATION:
- if (g->g.Orientation == (orientation_t)g->p.ptr)
- return;
- switch((orientation_t)g->p.ptr) {
- /* Rotation is handled by the drawing routines */
- case GDISP_ROTATE_0:
- case GDISP_ROTATE_180:
- g->g.Height = GDISP_SCREEN_HEIGHT;
- g->g.Width = GDISP_SCREEN_WIDTH;
- break;
- case GDISP_ROTATE_90:
- case GDISP_ROTATE_270:
- g->g.Height = GDISP_SCREEN_WIDTH;
- g->g.Width = GDISP_SCREEN_HEIGHT;
- break;
- default:
- return;
- }
- g->g.Orientation = (orientation_t)g->p.ptr;
- return;
-
- case GDISP_CONTROL_BACKLIGHT:
- if (g->g.Backlight == (unsigned)g->p.ptr)
+ break;
+ default:
return;
- unsigned val = (unsigned)g->p.ptr;
- g->g.Backlight = val > 100 ? 100 : val;
+ }
+ g->g.Powermode = (powermode_t)g->p.ptr;
+ return;
+
+ case GDISP_CONTROL_ORIENTATION:
+ if (g->g.Orientation == (orientation_t)g->p.ptr)
+ return;
+ switch((orientation_t)g->p.ptr) {
+ /* Rotation is handled by the drawing routines */
+ case GDISP_ROTATE_0:
+ case GDISP_ROTATE_180:
+ g->g.Height = GDISP_SCREEN_HEIGHT;
+ g->g.Width = GDISP_SCREEN_WIDTH;
+ break;
+ case GDISP_ROTATE_90:
+ case GDISP_ROTATE_270:
+ g->g.Height = GDISP_SCREEN_WIDTH;
+ g->g.Width = GDISP_SCREEN_HEIGHT;
+ break;
+ default:
+ return;
+ }
+ g->g.Orientation = (orientation_t)g->p.ptr;
+ return;
+
+ case GDISP_CONTROL_BACKLIGHT:
+ if (g->g.Backlight == (unsigned)g->p.ptr)
+ return;
+ unsigned val = (unsigned)g->p.ptr;
+ g->g.Backlight = val > 100 ? 100 : val;
g->flags |= GDISP_FLG_NEEDFLUSH;
- return;
- }
- }
+ return;
+ }
+ }
#endif // GDISP_NEED_CONTROL
#endif // GFX_USE_GDISP
diff --git a/drivers/ugfx/gdisp/is31fl3731c/gdisp_lld_config.h b/drivers/ugfx/gdisp/is31fl3731c/gdisp_lld_config.h
index bb28ad775e..588d688cf6 100644
--- a/drivers/ugfx/gdisp/is31fl3731c/gdisp_lld_config.h
+++ b/drivers/ugfx/gdisp/is31fl3731c/gdisp_lld_config.h
@@ -24,13 +24,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* Driver hardware support. */
/*===========================================================================*/
-#define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing
-#define GDISP_HARDWARE_DRAWPIXEL TRUE
-#define GDISP_HARDWARE_PIXELREAD TRUE
-#define GDISP_HARDWARE_CONTROL TRUE
+#define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing
+#define GDISP_HARDWARE_DRAWPIXEL TRUE
+#define GDISP_HARDWARE_PIXELREAD TRUE
+#define GDISP_HARDWARE_CONTROL TRUE
-#define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_GRAY256
+#define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_GRAY256
-#endif /* GFX_USE_GDISP */
+#endif /* GFX_USE_GDISP */
-#endif /* _GDISP_LLD_CONFIG_H */
+#endif /* _GDISP_LLD_CONFIG_H */
diff --git a/drivers/ugfx/gdisp/st7565/gdisp_lld_ST7565.c b/drivers/ugfx/gdisp/st7565/gdisp_lld_ST7565.c
index 69c5747728..55552cb795 100644
--- a/drivers/ugfx/gdisp/st7565/gdisp_lld_ST7565.c
+++ b/drivers/ugfx/gdisp/st7565/gdisp_lld_ST7565.c
@@ -9,7 +9,7 @@
#if GFX_USE_GDISP
-#define GDISP_DRIVER_VMT GDISPVMT_ST7565_QMK
+#define GDISP_DRIVER_VMT GDISPVMT_ST7565_QMK
#include "gdisp_lld_config.h"
#include "src/gdisp/gdisp_driver.h"
@@ -20,24 +20,24 @@
/*===========================================================================*/
#ifndef GDISP_SCREEN_HEIGHT
-#define GDISP_SCREEN_HEIGHT 32
+#define GDISP_SCREEN_HEIGHT 32
#endif
#ifndef GDISP_SCREEN_WIDTH
-#define GDISP_SCREEN_WIDTH 128
+#define GDISP_SCREEN_WIDTH 128
#endif
#ifndef GDISP_INITIAL_CONTRAST
-#define GDISP_INITIAL_CONTRAST 35
+#define GDISP_INITIAL_CONTRAST 35
#endif
#ifndef GDISP_INITIAL_BACKLIGHT
-#define GDISP_INITIAL_BACKLIGHT 100
+#define GDISP_INITIAL_BACKLIGHT 100
#endif
-#define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER<<0)
+#define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER<<0)
#include "st7565.h"
/*===========================================================================*/
-/* Driver config defaults for backward compatibility. */
+/* Driver config defaults for backward compatibility. */
/*===========================================================================*/
#ifndef ST7565_LCD_BIAS
#define ST7565_LCD_BIAS ST7565_LCD_BIAS_7
@@ -65,7 +65,7 @@ typedef struct{
// Some common routines and macros
#define PRIV(g) ((PrivData*)g->priv)
-#define RAM(g) (PRIV(g)->ram)
+#define RAM(g) (PRIV(g)->ram)
static GFXINLINE void write_cmd(GDisplay* g, uint8_t cmd) {
PRIV(g)->data[PRIV(g)->data_pos++] = cmd;
@@ -76,15 +76,15 @@ static GFXINLINE void flush_cmd(GDisplay* g) {
PRIV(g)->data_pos = 0;
}
-#define write_cmd2(g, cmd1, cmd2) { write_cmd(g, cmd1); write_cmd(g, cmd2); }
-#define write_cmd3(g, cmd1, cmd2, cmd3) { write_cmd(g, cmd1); write_cmd(g, cmd2); write_cmd(g, cmd3); }
+#define write_cmd2(g, cmd1, cmd2) { write_cmd(g, cmd1); write_cmd(g, cmd2); }
+#define write_cmd3(g, cmd1, cmd2, cmd3) { write_cmd(g, cmd1); write_cmd(g, cmd2); write_cmd(g, cmd3); }
// Some common routines and macros
-#define delay(us) gfxSleepMicroseconds(us)
-#define delay_ms(ms) gfxSleepMilliseconds(ms)
+#define delay(us) gfxSleepMicroseconds(us)
+#define delay_ms(ms) gfxSleepMilliseconds(ms)
-#define xyaddr(x, y) ((x) + ((y)>>3)*GDISP_SCREEN_WIDTH)
-#define xybit(y) (1<<((y)&7))
+#define xyaddr(x, y) ((x) + ((y)>>3)*GDISP_SCREEN_WIDTH)
+#define xybit(y) (1<<((y)&7))
/*===========================================================================*/
/* Driver exported functions. */
@@ -150,7 +150,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
#if GDISP_HARDWARE_FLUSH
LLDSPEC void gdisp_lld_flush(GDisplay *g) {
- unsigned p;
+ unsigned p;
// Don't flush if we don't need it.
if (!(g->flags & GDISP_FLG_NEEDFLUSH))
@@ -181,7 +181,7 @@ LLDSPEC void gdisp_lld_flush(GDisplay *g) {
#if GDISP_HARDWARE_DRAWPIXEL
LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) {
- coord_t x, y;
+ coord_t x, y;
switch(g->g.Orientation) {
default:
@@ -212,7 +212,7 @@ LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) {
#if GDISP_HARDWARE_PIXELREAD
LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) {
- coord_t x, y;
+ coord_t x, y;
switch(g->g.Orientation) {
default:
@@ -257,7 +257,7 @@ LLDSPEC void gdisp_lld_blit_area(GDisplay *g) {
else {
*dst &= ~xybit(dsty);
}
- dstx++;
+ dstx++;
srcbit++;
}
}
diff --git a/drivers/ugfx/gdisp/st7565/gdisp_lld_config.h b/drivers/ugfx/gdisp/st7565/gdisp_lld_config.h
index 2b66a877c8..4446bd38bc 100644
--- a/drivers/ugfx/gdisp/st7565/gdisp_lld_config.h
+++ b/drivers/ugfx/gdisp/st7565/gdisp_lld_config.h
@@ -14,7 +14,7 @@
/* Driver hardware support. */
/*===========================================================================*/
-#define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing
+#define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing
#define GDISP_HARDWARE_DRAWPIXEL TRUE
#define GDISP_HARDWARE_PIXELREAD TRUE
#define GDISP_HARDWARE_CONTROL TRUE
@@ -22,6 +22,6 @@
#define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_MONO
-#endif /* GFX_USE_GDISP */
+#endif /* GFX_USE_GDISP */
-#endif /* _GDISP_LLD_CONFIG_H */
+#endif /* _GDISP_LLD_CONFIG_H */