ClearScreen --> ClearDisplay

This commit is contained in:
olikraus 2015-12-20 10:10:49 +01:00
parent d78ada011d
commit 7d89e56d11
10 changed files with 76 additions and 22 deletions

44
cppsrc/U8g2lib.h Normal file
View File

@ -0,0 +1,44 @@
/*
U8g2lib.h
C++ Arduino wrapper for the u8g2 struct and c functions for the u8g2 library
U8x8lib.h is included for the declaration of the helper functions in U8x8lib.cpp.
U8g2 class is based on the u8g2 struct from u8g2.h, the U8x8 class from U8x8lib.h is not used.
*/
#ifndef _U8G2LIB_HH
#define _U8G2LIB_HH
#include <Arduino.h>
#include <Print.h>
#include <U8x8lib.h>
#include "u8g2.h"
class U8G2 : public Print
{
protected:
u8g2_t u8g2;
public:
uint8_t tx, ty;
U8G2(void) { home(); }
u8x8_t *getU8x8(void) { return u8g2_GetU8x8(&u8g2); }
u8g2_t *getU8g2(void) { return &u8g2; }
/* u8x8 interface */
uint8_t getCols(void) { return u8x8_GetCols(u8g2_GetU8x8(&u8g2)); }
uint8_t getRows(void) { return u8x8_GetRows(u8g2_GetU8x8(&u8g2)); }
};
#endif /* _U8G2LIB_HH */

View File

@ -1,3 +1,10 @@
/*
U8x8lib.h
C++ Arduino wrapper for the u8x8 struct and c functions.
*/
#ifndef _U8X8LIB_HH
#define _U8X8LIB_HH
@ -37,7 +44,7 @@ class U8X8 : public Print
u8x8_InitDisplay(&u8x8); }
void clearScreen(void) {
u8x8_ClearScreen(&u8x8); }
u8x8_ClearDisplay(&u8x8); }
void setPowerSave(uint8_t is_enable) {
u8x8_SetPowerSave(&u8x8, is_enable); }

View File

@ -366,7 +366,7 @@ void u8x8_InitDisplay(u8x8_t *u8x8);
void u8x8_SetPowerSave(u8x8_t *u8x8, uint8_t is_enable);
void u8x8_SetFlipMode(u8x8_t *u8x8, uint8_t mode);
void u8x8_SetContrast(u8x8_t *u8x8, uint8_t value);
void u8x8_ClearScreen(u8x8_t *u8x8);
void u8x8_ClearDisplay(u8x8_t *u8x8);

View File

@ -86,7 +86,7 @@ void u8x8_SetContrast(u8x8_t *u8x8, uint8_t value)
}
void u8x8_ClearScreen(u8x8_t *u8x8)
void u8x8_ClearDisplay(u8x8_t *u8x8)
{
uint8_t buf[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
u8x8_tile_t tile;

View File

@ -44,7 +44,7 @@ void loop(void)
for(;;)
{
u8x8_ClearScreen(&u8x8);
u8x8_ClearDisplay(&u8x8);
u8x8_SetPowerSave(&u8x8, 0);
//u8x8_SetContrast(&u8x8, 10);

View File

@ -152,7 +152,7 @@ void loop(void)
for(;;)
{
u8x8_ClearScreen(&u8g2);
u8x8_ClearDisplay(&u8g2);
u8x8_SetPowerSave(&u8g2, 0);
//u8x8_SetContrast(&u8g2, 10);

View File

@ -368,7 +368,7 @@ void loop(void)
for(;;)
{
//u8x8_ClearScreen(&u8g2);
//u8x8_ClearDisplay(&u8g2);
//u8x8_SetPowerSave(&u8g2, 0);
//u8x8_SetContrast(&u8g2, 10);

View File

@ -76,7 +76,7 @@ int main(void)
u8x8_Setup_TGA_DESC(&desc);
u8x8_InitDisplay(&desc);
u8x8_SetPowerSave(&desc, 0);
u8x8_ClearScreen(&desc);
u8x8_ClearDisplay(&desc);
u8x8_SetFont(&desc, u8x8_font_amstrad_cpc_r);
u8x8_DrawString(&desc, 0, 0, "Description");
*/
@ -84,13 +84,13 @@ int main(void)
u8g2_Setup_TGA_DESC(&desc, &u8g2_cb_r0);
u8x8_InitDisplay(u8g2_GetU8x8(&desc));
u8x8_SetPowerSave(u8g2_GetU8x8(&desc), 0);
u8x8_ClearScreen(u8g2_GetU8x8(&desc));
u8x8_ClearDisplay(u8g2_GetU8x8(&desc));
u8x8_Setup_TGA_LCD(&u8x8);
u8x8_InitDisplay(&u8x8);
u8x8_ClearScreen(&u8x8);
u8x8_ClearDisplay(&u8x8);
u8x8_SetPowerSave(&u8x8, 0);
u8x8_SetFont(&u8x8, u8x8_font_amstrad_cpc_r);
u8x8_DrawString(&u8x8, 0, 0, "Hello World!");
@ -109,8 +109,8 @@ int main(void)
tga_save_png("u8x8_hello_world.png");
u8x8_ClearScreen(u8g2_GetU8x8(&desc));
u8x8_ClearScreen(&u8x8);
u8x8_ClearDisplay(u8g2_GetU8x8(&desc));
u8x8_ClearDisplay(&u8x8);
u8x8_SetPowerSave(&u8x8, 0);
u8x8_SetFont(&u8x8, u8x8_font_amstrad_cpc_r);
u8x8_DrawString(&u8x8, 0, 0, "A");
@ -128,8 +128,8 @@ int main(void)
tga_save_png("u8x8_tile_size.png");
u8x8_ClearScreen(u8g2_GetU8x8(&desc));
u8x8_ClearScreen(&u8x8);
u8x8_ClearDisplay(u8g2_GetU8x8(&desc));
u8x8_ClearDisplay(&u8x8);
u8x8_SetPowerSave(&u8x8, 0);
u8x8_SetFont(&u8x8, u8x8_font_amstrad_cpc_r);
u8x8_SetInverseFont(&u8x8, 1);
@ -149,8 +149,8 @@ int main(void)
tga_save_png("u8x8_inverse.png");
u8x8_ClearScreen(u8g2_GetU8x8(&desc));
u8x8_ClearScreen(&u8x8);
u8x8_ClearDisplay(u8g2_GetU8x8(&desc));
u8x8_ClearDisplay(&u8x8);
u8x8_SetPowerSave(&u8x8, 0);
u8x8_SetInverseFont(&u8x8, 0);
u8x8_SetFont(&u8x8, u8x8_font_amstrad_cpc_f);

View File

@ -139,7 +139,7 @@ void write_u8x8_md(FILE *fp)
}
void write_u8x8(const char *prefix, FILE *fp)
void write_class(const char *prefix, FILE *fp)
{
fprintf(fp, "class %s_%s : public %s {\n", prefix, CONSTRUCTOR, prefix);
fprintf(fp, " public: %s_%s(", prefix, CONSTRUCTOR);
@ -259,7 +259,7 @@ void readcsv_createu8x8md(const char *name, const char *mdname)
}
void readcsv_createu8x8(const char *name, const char *ctorname)
void readcsv_create(const char *prefix, const char *name, const char *ctorname)
{
FILE *fp;
FILE *ctor_fp;
@ -282,7 +282,7 @@ void readcsv_createu8x8(const char *name, const char *ctorname)
if ( s[0] == '#' )
continue;
readcsv_createu8x8line(s);
write_u8x8("U8X8", ctor_fp);
write_class(prefix, ctor_fp);
}
fclose(fp);
fclose(ctor_fp);
@ -293,11 +293,14 @@ void readcsv_createu8x8(const char *name, const char *ctorname)
int main(void)
{
readcsv_createu8x8("display.csv", "ctor.h");
readcsv_create("U8X8", "display.csv", "ctor.h");
//insert_into_file("../../cppsrc/U8x8lib.h", "ctor.h", "// constructor list start", "// constructor list end");
readcsv_create("U8G2", "display.csv", "ctor.h");
readcsv_createu8x8md("display.csv", "md");
//insert_into_file("../../cppsrc/U8x8lib.h", "ctor.h", "// constructor list start", "// constructor list end");
return 0;
}

View File

@ -667,7 +667,7 @@ void overviewpic(int i, int fm, char *fms, int bm, char *bms, int mm, char *mms)
u8g2_Setup_TGA(&u8g2, &u8g2_cb_r0);
u8x8_InitDisplay(u8g2_GetU8x8(&u8g2));
u8x8_SetPowerSave(u8g2_GetU8x8(&u8g2), 0);
//u8x8_ClearScreen(u8g2_GetU8x8(&u8g2));
//u8x8_ClearDisplay(u8g2_GetU8x8(&u8g2));
u8x8_SetFont(u8g2_GetU8x8(&u8g2), u8x8_font_amstrad_cpc_r);
u8x8_DrawString(u8g2_GetU8x8(&u8g2), 0, 0, target_font_identifier);
u8x8_SetFont(u8g2_GetU8x8(&u8g2), u8x8_font_list[u8x8_fnt_cnt]);
@ -736,7 +736,7 @@ void overviewshortpic(int i, int fm, char *fms, int bm, char *bms, int mm, char
u8g2_Setup_TGA(&u8g2, &u8g2_cb_r0);
u8x8_InitDisplay(u8g2_GetU8x8(&u8g2));
u8x8_SetPowerSave(u8g2_GetU8x8(&u8g2), 0);
//u8x8_ClearScreen(u8g2_GetU8x8(&u8g2));
//u8x8_ClearDisplay(u8g2_GetU8x8(&u8g2));
u8x8_SetFont(u8g2_GetU8x8(&u8g2), u8x8_font_list[u8x8_fnt_cnt]);
if ( mm == MM_N )