This commit is contained in:
olikraus 2015-12-12 19:39:49 +01:00
parent f6302965e0
commit 110ef721b5
3 changed files with 23 additions and 3 deletions

View File

@ -72,6 +72,16 @@ class U8X8_SSD1306_128X64_4W_SW_SPI : public U8X8 {
u8x8_Setup_4Wire_SW_SPI(getU8x8(), u8x8_d_ssd1306_128x64_noname, clock, data, cs, dc, reset);
}
}
class U8X8_SSD1306_128X64_4W_HW_SPI : public U8X8 {
public: U8X8_SSD1306_128X64_4W_HW_SPI(uint8_t cs, uint8_t dc, uint8_t reset = U8X8_PIN_NONE) : U8X8() {
u8x8_Setup_4Wire_HW_SPI(getU8x8(), u8x8_d_ssd1306_128x64_noname, cs, dc, reset);
}
}
class U8X8_SSD1306_128X64_3W_SW_SPI : public U8X8 {
public: U8X8_SSD1306_128X64_3W_SW_SPI(uint8_t clock, uint8_t data, uint8_t cs, uint8_t reset = U8X8_PIN_NONE) : U8X8() {
u8x8_Setup_3Wire_SW_SPI(getU8x8(), u8x8_d_ssd1306_128x64_noname, clock, data, cs, reset);
}
}
// constructor list end

View File

@ -120,14 +120,22 @@ void write_u8x8(const char *prefix, FILE *fp)
{
fprintf(fp, "class %s_%s : public %s {\n", prefix, CONSTRUCTOR, prefix);
fprintf(fp, " public: %s_%s(", prefix, CONSTRUCTOR);
if ( strcmp(PINSET, "4WSPI") == 0 )
if ( strcmp(PINSET, "4WSWSPI") == 0 )
fprintf(fp, "uint8_t clock, uint8_t data, uint8_t cs, uint8_t dc, uint8_t reset = U8X8_PIN_NONE");
else if ( strcmp(PINSET, "4WHWSPI") == 0 )
fprintf(fp, "uint8_t cs, uint8_t dc, uint8_t reset = U8X8_PIN_NONE");
else if ( strcmp(PINSET, "3WSWSPI") == 0 )
fprintf(fp, "uint8_t clock, uint8_t data, uint8_t cs, uint8_t reset = U8X8_PIN_NONE");
else
fprintf(fp, "... unknown pinset ...");
fprintf(fp, ") : %s() {\n", prefix);
fprintf(fp, " %s(getU8x8(), %s", SETUP, DEVICE);
if ( strcmp(PINSET, "4WSPI") == 0 )
if ( strcmp(PINSET, "4WSWSPI") == 0 )
fprintf(fp, ", clock, data, cs, dc, reset");
else if ( strcmp(PINSET, "4WHWSPI") == 0 )
fprintf(fp, ", cs, dc, reset");
else if ( strcmp(PINSET, "3WSWSPI") == 0 )
fprintf(fp, ", clock, data, cs, reset");
else
fprintf(fp, "... unknown pinset ...");
fprintf(fp, ");\n");

View File

@ -4,6 +4,8 @@
# 3. constructor name w/o prefix,
# 4. setup function
u8x8_d_ssd1306_128x64_noname, 4WSPI, SSD1306_128X64_4W_SW_SPI, u8x8_Setup_4Wire_SW_SPI
u8x8_d_ssd1306_128x64_noname, 4WSWSPI, SSD1306_128X64_4W_SW_SPI, u8x8_Setup_4Wire_SW_SPI
u8x8_d_ssd1306_128x64_noname, 4WHWSPI, SSD1306_128X64_4W_HW_SPI, u8x8_Setup_4Wire_HW_SPI
u8x8_d_ssd1306_128x64_noname, 3WSWSPI, SSD1306_128X64_3W_SW_SPI, u8x8_Setup_3Wire_SW_SPI

1 # 1. device name
4 # 4. setup function
5 u8x8_d_ssd1306_128x64_noname, 4WSPI, SSD1306_128X64_4W_SW_SPI, u8x8_Setup_4Wire_SW_SPI u8x8_d_ssd1306_128x64_noname, 4WSWSPI, SSD1306_128X64_4W_SW_SPI, u8x8_Setup_4Wire_SW_SPI
6 u8x8_d_ssd1306_128x64_noname, 4WHWSPI, SSD1306_128X64_4W_HW_SPI, u8x8_Setup_4Wire_HW_SPI
7 u8x8_d_ssd1306_128x64_noname, 3WSWSPI, SSD1306_128X64_3W_SW_SPI, u8x8_Setup_3Wire_SW_SPI
8
9
10
11