1
0
Fork 0

Fixup mixed tabs/spaces

This commit is contained in:
Fred Sundvik 2017-07-09 13:50:18 +03:00 committed by Jack Humbert
parent 630f065376
commit 011ee29441
5 changed files with 153 additions and 153 deletions

View File

@ -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;
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;
}
}
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;
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;
}
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;
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]);
}
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:
write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_OFF);
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)
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;
unsigned val = (unsigned)g->p.ptr;
g->g.Backlight = val > 100 ? 100 : val;
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:
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)
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

View File

@ -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 */

View File

@ -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++;
}
}

View File

@ -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 */

View File

@ -83,7 +83,7 @@ static GFXINLINE void init_board(GDisplay *g) {
}
static GFXINLINE void post_init_board(GDisplay *g) {
(void) g;
(void) g;
}
static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) {
@ -106,8 +106,8 @@ static GFXINLINE void enter_cmd_mode(GDisplay *g) {
static GFXINLINE void write_data(GDisplay *g, uint8_t* data, uint16_t length) {
(void) g;
spiSend(&SPID1, length, data);
(void) g;
spiSend(&SPID1, length, data);
}
#endif /* _GDISP_LLD_BOARD_H */