revert local changes to u8glib

This commit is contained in:
devsaurus 2015-07-16 21:31:00 +02:00
parent 7886222ee8
commit 02d473dab0
5 changed files with 56 additions and 63 deletions

View File

@ -13,7 +13,7 @@
// Enable display drivers
#define U8G_SSD1306_128x64_I2C
#define U8G_SSD1306_128x64_SPI
//#define U8G_SSD1306_128x64_SPI
// untested
#undef U8G_PCD8544_84x48

View File

@ -999,7 +999,7 @@ static int lu8g_ssd1306_128x64_i2c( lua_State *L )
// Reason: linking the pre-defined structures allocates RAM for the device/comm structure
// *before* the display is constructed (especially the page buffers)
// this consumes heap even when the device is not used at all
#if 1
#if 0
// build device entry
lud->dev = (u8g_dev_t){ u8g_dev_ssd1306_128x64_fn, &(lud->pb), U8G_COM_SSD_I2C };
@ -1045,7 +1045,7 @@ static int lu8g_ssd1306_128x64_spi( lua_State *L )
// Reason: linking the pre-defined structures allocates RAM for the device/comm structure
// *before* the display is constructed (especially the page buffers)
// this consumes heap even when the device is not used at all
#if 1
#if 0
// build device entry
lud->dev = (u8g_dev_t){ u8g_dev_ssd1306_128x64_fn, &(lud->pb), U8G_COM_HW_SPI };
@ -1063,7 +1063,7 @@ static int lu8g_ssd1306_128x64_spi( lua_State *L )
// and finally init device using specific interface init function
u8g_InitHWSPI( LU8G, &(lud->dev), cs, dc, res );
#else
u8g_InitHWSPI( LU8G, &u8g_dev_ssd1306_128x64_spi, cs, dc, res );
u8g_InitHWSPI( LU8G, &u8g_dev_ssd1306_128x64_hw_spi, cs, dc, res );
#endif
@ -1094,7 +1094,7 @@ static int lu8g_pcd8544_84x48( lua_State *L )
// Reason: linking the pre-defined structures allocates RAM for the device/comm structure
// *before* the display is constructed (especially the page buffers)
// this consumes heap even when the device is not used at all
#if 1
#if 0
// build device entry
lud->dev = (u8g_dev_t){ u8g_dev_pcd8544_fn, &(lud->pb), U8G_COM_HW_SPI };

View File

@ -1073,6 +1073,49 @@ typedef void (*u8g_state_cb)(uint8_t msg);
#define U8G_FONT_HEIGHT_MODE_XTEXT 1
#define U8G_FONT_HEIGHT_MODE_ALL 2
struct _u8g_t
{
u8g_uint_t width;
u8g_uint_t height;
u8g_dev_t *dev; /* first device in the device chain */
const u8g_pgm_uint8_t *font; /* regular font for all text procedures */
const u8g_pgm_uint8_t *cursor_font; /* special font for cursor procedures */
uint8_t cursor_fg_color, cursor_bg_color;
uint8_t cursor_encoding;
uint8_t mode; /* display mode, one of U8G_MODE_xxx */
u8g_uint_t cursor_x;
u8g_uint_t cursor_y;
u8g_draw_cursor_fn cursor_fn;
int8_t glyph_dx;
int8_t glyph_x;
int8_t glyph_y;
uint8_t glyph_width;
uint8_t glyph_height;
u8g_font_calc_vref_fnptr font_calc_vref;
uint8_t font_height_mode;
int8_t font_ref_ascent;
int8_t font_ref_descent;
uint8_t font_line_spacing_factor; /* line_spacing = factor * (ascent - descent) / 64 */
uint8_t line_spacing;
u8g_dev_arg_pixel_t arg_pixel;
/* uint8_t color_index; */
#ifdef U8G_WITH_PINLIST
uint8_t pin_list[U8G_PIN_LIST_LEN];
#endif
u8g_state_cb state_cb;
u8g_box_t current_page; /* current box of the visible page */
uint8_t i2c_addr;
};
#define u8g_GetFontAscent(u8g) ((u8g)->font_ref_ascent)
#define u8g_GetFontDescent(u8g) ((u8g)->font_ref_descent)
#define u8g_GetFontLineSpacing(u8g) ((u8g)->line_spacing)
@ -1371,7 +1414,7 @@ struct _pg_struct
void pg_ClearPolygonXY(pg_struct *pg);
void pg_AddPolygonXY(pg_struct *pg, u8g_t *u8g, int16_t x, int16_t y);
void pg_DrawPolygon(pg_struct *pg, u8g_t *u8g);
void u8g_ClearPolygonXY(u8g_t *u8g);
void u8g_ClearPolygonXY(void);
void u8g_AddPolygonXY(u8g_t *u8g, int16_t x, int16_t y);
void u8g_DrawPolygon(u8g_t *u8g);
void u8g_DrawTriangle(u8g_t *u8g, int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2);
@ -1446,57 +1489,6 @@ void chess_Init(u8g_t *u8g, uint8_t empty_body_color);
void chess_Draw(void);
void chess_Step(uint8_t keycode);
struct _u8g_t
{
u8g_uint_t width;
u8g_uint_t height;
u8g_dev_t *dev; /* first device in the device chain */
const u8g_pgm_uint8_t *font; /* regular font for all text procedures */
const u8g_pgm_uint8_t *cursor_font; /* special font for cursor procedures */
uint8_t cursor_fg_color, cursor_bg_color;
uint8_t cursor_encoding;
uint8_t mode; /* display mode, one of U8G_MODE_xxx */
u8g_uint_t cursor_x;
u8g_uint_t cursor_y;
u8g_draw_cursor_fn cursor_fn;
int8_t glyph_dx;
int8_t glyph_x;
int8_t glyph_y;
uint8_t glyph_width;
uint8_t glyph_height;
u8g_font_calc_vref_fnptr font_calc_vref;
uint8_t font_height_mode;
int8_t font_ref_ascent;
int8_t font_ref_descent;
uint8_t font_line_spacing_factor; /* line_spacing = factor * (ascent - descent) / 64 */
uint8_t line_spacing;
u8g_dev_arg_pixel_t arg_pixel;
/* uint8_t color_index; */
#ifdef U8G_WITH_PINLIST
uint8_t pin_list[U8G_PIN_LIST_LEN];
#endif
u8g_state_cb state_cb;
u8g_box_t current_page; /* current box of the visible page */
uint8_t i2c_addr;
/* global variables from u8g_polygon.c */
pg_struct pg;
};
/*===============================================================*/
/* font definitions */
extern const u8g_fntpgm_uint8_t u8g_font_m2icon_5[] U8G_FONT_SECTION("u8g_font_m2icon_5");

View File

@ -409,3 +409,4 @@ u8g_pb_t u8g_dev_sh1106_128x64_2x_pb = { {16, HEIGHT, 0, 0, 0}, WIDTH, u8g_dev_
u8g_dev_t u8g_dev_sh1106_128x64_2x_sw_spi = { u8g_dev_sh1106_128x64_2x_fn, &u8g_dev_sh1106_128x64_2x_pb, U8G_COM_SW_SPI };
u8g_dev_t u8g_dev_sh1106_128x64_2x_hw_spi = { u8g_dev_sh1106_128x64_2x_fn, &u8g_dev_sh1106_128x64_2x_pb, U8G_COM_HW_SPI };
u8g_dev_t u8g_dev_sh1106_128x64_2x_i2c = { u8g_dev_sh1106_128x64_2x_fn, &u8g_dev_sh1106_128x64_2x_pb, U8G_COM_SSD_I2C };

View File

@ -306,26 +306,26 @@ void pg_DrawPolygon(pg_struct *pg, u8g_t *u8g)
pg_exec(pg, u8g);
}
//pg_struct u8g_pg;
pg_struct u8g_pg;
void u8g_ClearPolygonXY(u8g_t *u8g)
void u8g_ClearPolygonXY(void)
{
pg_ClearPolygonXY(&(u8g->pg));
pg_ClearPolygonXY(&u8g_pg);
}
void u8g_AddPolygonXY(u8g_t *u8g, int16_t x, int16_t y)
{
pg_AddPolygonXY(&(u8g->pg), u8g, x, y);
pg_AddPolygonXY(&u8g_pg, u8g, x, y);
}
void u8g_DrawPolygon(u8g_t *u8g)
{
pg_DrawPolygon(&(u8g->pg), u8g);
pg_DrawPolygon(&u8g_pg, u8g);
}
void u8g_DrawTriangle(u8g_t *u8g, int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2)
{
u8g_ClearPolygonXY(u8g);
u8g_ClearPolygonXY();
u8g_AddPolygonXY(u8g, x0, y0);
u8g_AddPolygonXY(u8g, x1, y1);
u8g_AddPolygonXY(u8g, x2, y2);