This commit is contained in:
olikraus 2015-12-12 17:26:10 +01:00
parent 83a738cc7e
commit d7320d7a7b
4 changed files with 195 additions and 315 deletions

View File

@ -1,4 +1,121 @@
#include "U8x8lib.h"
#include <SPI.h>
/*=============================================*/
/* callbacks */
extern "C" uint8_t u8x8_gpio_and_delay_arduino(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
{
uint8_t i;
switch(msg)
{
case U8X8_MSG_GPIO_AND_DELAY_INIT:
for( i = 0; i < U8X8_PIN_CNT; i++ )
if ( u8x8->pins[i] != U8X8_PIN_NONE )
pinMode(u8x8->pins[i], OUTPUT);
break;
case U8X8_MSG_DELAY_MILLI:
delay(arg_int);
break;
case U8X8_MSG_DELAY_I2C:
/* arg_int is 1 or 4: 100KHz (5us) or 400KHz (1.25us) */
delayMicroseconds(arg_int<=2?5:2);
break;
case U8X8_MSG_GPIO_I2C_CLOCK:
case U8X8_MSG_GPIO_I2C_DATA:
if ( arg_int == 0 )
{
pinMode(u8x8_GetPinValue(u8x8, msg), OUTPUT);
digitalWrite(u8x8_GetPinValue(u8x8, msg), 0);
}
else
{
pinMode(u8x8_GetPinValue(u8x8, msg), INPUT_PULLUP);
}
break;
default:
if ( msg >= U8X8_MSG_GPIO(0) )
{
i = u8x8_GetPinValue(u8x8, msg);
if ( i != U8X8_PIN_NONE )
digitalWrite(i, arg_int);
break;
}
return 0;
}
return 1;
}
/*=============================================*/
extern "C" uint8_t u8x8_byte_arduino_hw_spi(u8x8_t *u8g2, uint8_t msg, uint8_t arg_int, void *arg_ptr)
{
uint8_t *data;
switch(msg)
{
case U8X8_MSG_BYTE_SEND:
data = (uint8_t *)arg_ptr;
while( arg_int > 0 )
{
SPI.transfer((uint8_t)*data);
data++;
arg_int--;
}
break;
case U8X8_MSG_BYTE_INIT:
/* disable chipselect */
u8x8_gpio_SetCS(u8g2, u8g2->display_info->chip_disable_level);
/* no wait required here */
/* for SPI: setup correct level of the clock signal */
pinMode(11, OUTPUT);
pinMode(13, OUTPUT);
digitalWrite(13, u8g2->display_info->sck_takeover_edge);
break;
case U8X8_MSG_BYTE_SET_DC:
u8x8_gpio_SetDC(u8g2, arg_int);
break;
case U8X8_MSG_BYTE_START_TRANSFER:
SPI.begin();
if ( u8g2->display_info->sck_pulse_width_ns < 70 )
SPI.setClockDivider( SPI_CLOCK_DIV2 );
else
SPI.setClockDivider( SPI_CLOCK_DIV4 );
SPI.setDataMode(SPI_MODE0);
SPI.setBitOrder(MSBFIRST);
u8x8_gpio_SetCS(u8g2, u8g2->display_info->chip_enable_level);
u8g2->gpio_and_delay_cb(u8g2, U8X8_MSG_DELAY_NANO, u8g2->display_info->post_chip_enable_wait_ns, NULL);
break;
case U8X8_MSG_BYTE_END_TRANSFER:
u8g2->gpio_and_delay_cb(u8g2, U8X8_MSG_DELAY_NANO, u8g2->display_info->pre_chip_disable_wait_ns, NULL);
u8x8_gpio_SetCS(u8g2, u8g2->display_info->chip_disable_level);
SPI.end();
break;
case U8X8_MSG_BYTE_SET_I2C_ADR:
break;
case U8X8_MSG_BYTE_SET_DEVICE:
break;
default:
return 0;
}
return 1;
}
/*
@ -6,8 +123,7 @@
*/
void u8x8_Setup_4Wire_SW_SPI(u8x8_t *u8x8, u8x8_msg_cb display_cb, uint8_t clock, uint8_t data, uint8_t cs, uint8_t dc, uint8_t reset)
{
/* setup defaults and reset pins to U8X8_PIN_NONE */
u8x8_SetupDefaults(u8x8);
u8x8_Setup(u8x8, display_cb, u8x8_cad_001, u8x8_byte_4wire_sw_spi, u8x8_gpio_and_delay_arduino);
/* assign individual pin values (only for ARDUINO, if pin_list is available) */
u8x8_SetPin(u8x8, U8X8_PIN_SPI_CLOCK, clock);
@ -15,37 +131,18 @@ void u8x8_Setup_4Wire_SW_SPI(u8x8_t *u8x8, u8x8_msg_cb display_cb, uint8_t clock
u8x8_SetPin(u8x8, U8X8_PIN_CS, cs);
u8x8_SetPin(u8x8, U8X8_PIN_DC, dc);
u8x8_SetPin(u8x8, U8X8_PIN_RESET, reset);
/* setup specific callbacks */
u8x8->display_cb = display_cb;
u8x8->cad_cb = u8x8_cad_001;
u8x8->byte_cb = u8x8_byte_4wire_sw_spi;
u8x8->gpio_and_delay_cb = u8x8_gpio_and_delay_arduino;
/* setup display info */
u8x8_SetupMemory(u8x8);
}
void u8x8_Setup_3Wire_SW_SPI(u8x8_t *u8x8, u8x8_msg_cb display_cb, uint8_t clock, uint8_t data, uint8_t cs, uint8_t reset)
{
/* setup defaults and reset pins to U8X8_PIN_NONE */
u8x8_SetupDefaults(u8x8);
u8x8_Setup(u8x8, display_cb, u8x8_cad_001, u8x8_byte_3wire_sw_spi, u8x8_gpio_and_delay_arduino);
/* assign individual pin values (only for ARDUINO, if pin_list is available) */
u8x8_SetPin(u8x8, U8X8_PIN_SPI_CLOCK, clock);
u8x8_SetPin(u8x8, U8X8_PIN_SPI_DATA, data);
u8x8_SetPin(u8x8, U8X8_PIN_CS, cs);
u8x8_SetPin(u8x8, U8X8_PIN_RESET, reset);
/* setup specific callbacks */
u8x8->display_cb = display_cb;
u8x8->cad_cb = u8x8_cad_001;
u8x8->byte_cb = u8x8_byte_3wire_sw_spi;
u8x8->gpio_and_delay_cb = u8x8_gpio_and_delay_arduino;
/* setup display info */
u8x8_SetupMemory(u8x8);
}
/*
@ -53,48 +150,28 @@ void u8x8_Setup_3Wire_SW_SPI(u8x8_t *u8x8, u8x8_msg_cb display_cb, uint8_t clock
*/
void u8x8_Setup_4Wire_HW_SPI(u8x8_t *u8x8, u8x8_msg_cb display_cb, uint8_t cs, uint8_t dc, uint8_t reset)
{
/* setup defaults and reset pins to U8X8_PIN_NONE */
u8x8_SetupDefaults(u8x8);
u8x8_Setup(u8x8, display_cb, u8x8_cad_001, u8x8_byte_arduino_hw_spi, u8x8_gpio_and_delay_arduino);
/* assign individual pin values (only for ARDUINO, if pin_list is available) */
u8x8_SetPin(u8x8, U8X8_PIN_CS, cs);
u8x8_SetPin(u8x8, U8X8_PIN_DC, dc);
u8x8_SetPin(u8x8, U8X8_PIN_RESET, reset);
/* setup specific callbacks */
u8x8->display_cb = display_cb;
u8x8->cad_cb = u8x8_cad_001;
u8x8->byte_cb = u8x8_byte_arduino_hw_spi;
u8x8->gpio_and_delay_cb = u8x8_gpio_and_delay_arduino;
/* setup display info */
u8x8_SetupMemory(u8x8);
}
void u8x8_Setup_SSD13xx_SW_I2C(u8x8_t *u8x8, u8x8_msg_cb display_cb, uint8_t clock, uint8_t data, uint8_t reset)
{
/* setup defaults and reset pins to U8X8_PIN_NONE */
u8x8_SetupDefaults(u8x8);
u8x8_Setup(u8x8, display_cb, u8x8_cad_001, u8x8_byte_ssd13xx_sw_i2c, u8x8_gpio_and_delay_arduino);
/* assign individual pin values (only for ARDUINO, if pin_list is available) */
u8x8_SetPin(u8x8, U8X8_PIN_I2C_CLOCK, clock);
u8x8_SetPin(u8x8, U8X8_PIN_I2C_DATA, data);
u8x8_SetPin(u8x8, U8X8_PIN_RESET, reset);
/* setup specific callbacks */
u8x8->display_cb = display_cb;
u8x8->cad_cb = u8x8_cad_001;
u8x8->byte_cb = u8x8_byte_ssd13xx_sw_i2c;
u8x8->gpio_and_delay_cb = u8x8_gpio_and_delay_arduino;
/* setup display info */
u8x8_SetupMemory(u8x8);
}
void u8x8_Setup_8Bit_6800(u8x8_t *u8x8, u8x8_msg_cb display_cb, uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, uint8_t enable, uint8_t cs, uint8_t dc, uint8_t reset)
{
/* setup defaults and reset pins to U8X8_PIN_NONE */
u8x8_SetupDefaults(u8x8);
u8x8_Setup(u8x8, display_cb, u8x8_cad_001, u8x8_byte_8bit_6800mode, u8x8_gpio_and_delay_arduino);
/* assign individual pin values (only for ARDUINO, if pin_list is available) */
u8x8_SetPin(u8x8, U8X8_PIN_D0, d0);
@ -109,21 +186,11 @@ void u8x8_Setup_8Bit_6800(u8x8_t *u8x8, u8x8_msg_cb display_cb, uint8_t d0, uint
u8x8_SetPin(u8x8, U8X8_PIN_CS, cs);
u8x8_SetPin(u8x8, U8X8_PIN_DC, dc);
u8x8_SetPin(u8x8, U8X8_PIN_RESET, reset);
/* setup specific callbacks */
u8x8->display_cb = display_cb;
u8x8->cad_cb = u8x8_cad_001;
u8x8->byte_cb = u8x8_byte_8bit_6800mode;
u8x8->gpio_and_delay_cb = u8x8_gpio_and_delay_arduino;
/* setup display info */
u8x8_SetupMemory(u8x8);
}
void u8x8_Setup_8Bit_8080(u8x8_t *u8x8, u8x8_msg_cb display_cb, uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, uint8_t wr, uint8_t cs, uint8_t dc, uint8_t reset)
{
/* setup defaults and reset pins to U8X8_PIN_NONE */
u8x8_SetupDefaults(u8x8);
u8x8_Setup(u8x8, display_cb, u8x8_cad_001, u8x8_byte_8bit_8080mode, u8x8_gpio_and_delay_arduino);
/* assign individual pin values (only for ARDUINO, if pin_list is available) */
u8x8_SetPin(u8x8, U8X8_PIN_D0, d0);
@ -138,14 +205,4 @@ void u8x8_Setup_8Bit_8080(u8x8_t *u8x8, u8x8_msg_cb display_cb, uint8_t d0, uint
u8x8_SetPin(u8x8, U8X8_PIN_CS, cs);
u8x8_SetPin(u8x8, U8X8_PIN_DC, dc);
u8x8_SetPin(u8x8, U8X8_PIN_RESET, reset);
/* setup specific callbacks */
u8x8->display_cb = display_cb;
u8x8->cad_cb = u8x8_cad_001;
u8x8->byte_cb = u8x8_byte_8bit_8080mode;
u8x8->gpio_and_delay_cb = u8x8_gpio_and_delay_arduino;
/* setup display info */
u8x8_SetupMemory(u8x8);
}

View File

@ -7,23 +7,78 @@
#include "u8x8.h"
class U8x8 : public Print
extern "C" uint8_t u8x8_gpio_and_delay_arduino(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
extern "C" uint8_t u8x8_byte_arduino_hw_spi(u8x8_t *u8g2, uint8_t msg, uint8_t arg_int, void *arg_ptr);
void u8x8_Setup_4Wire_SW_SPI(u8x8_t *u8x8, u8x8_msg_cb display_cb, uint8_t clock, uint8_t data, uint8_t cs, uint8_t dc, uint8_t reset);
void u8x8_Setup_3Wire_SW_SPI(u8x8_t *u8x8, u8x8_msg_cb display_cb, uint8_t clock, uint8_t data, uint8_t cs, uint8_t reset);
void u8x8_Setup_4Wire_HW_SPI(u8x8_t *u8x8, u8x8_msg_cb display_cb, uint8_t cs, uint8_t dc, uint8_t reset);
void u8x8_Setup_SSD13xx_SW_I2C(u8x8_t *u8x8, u8x8_msg_cb display_cb, uint8_t clock, uint8_t data, uint8_t reset);
void u8x8_Setup_8Bit_6800(u8x8_t *u8x8, u8x8_msg_cb display_cb, uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, uint8_t enable, uint8_t cs, uint8_t dc, uint8_t reset);
void u8x8_Setup_8Bit_8080(u8x8_t *u8x8, u8x8_msg_cb display_cb, uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, uint8_t wr, uint8_t cs, uint8_t dc, uint8_t reset);
class U8X8 : public Print
{
protected:
u8x8_t u8x8;
public:
U8x8(void) {}
ucg_t *getU8x8(void) { return &u8x8; };
}
U8X8(void) {}
u8x8_t *getU8x8(void) { return &u8x8; }
class U8x8_4W_SW_SPI : public U8x8
void drawTile(uint8_t x, uint8_t y, uint8_t cnt, uint8_t *tile_ptr) {
u8x8_DrawTile(&u8x8, x, y, cnt, tile_ptr); }
void initDisplay(void) {
u8x8_InitDisplay(&u8x8); }
void clearScreen(void) {
u8x8_ClearScreen(&u8x8); }
void setPowerSave(uint8_t is_enable) {
u8x8_SetPowerSave(&u8x8, is_enable); }
void begin(void) {
initDisplay(); clearScreen(); setPowerSave(0); }
void setFlipMode(uint8_t mode) {
u8x8_SetFlipMode(&u8x8, mode); }
void setContrast(uint8_t value) {
u8x8_SetContrast(&u8x8, value); }
void setFont(const uint8_t *font_8x8) {
u8x8_SetFont(&u8x8, font_8x8); }
void drawGlyph(uint8_t x, uint8_t y, uint8_t encoding) {
u8x8_DrawGlyph(&u8x8, x, y, encoding); }
void drawString(uint8_t x, uint8_t y, const char *s) {
u8x8_DrawString(&u8x8, x, y, s); }
void drawUTF8(uint8_t x, uint8_t y, const char *s) {
u8x8_DrawUTF8(&u8x8, x, y, s); }
uint8_t getUTF8Len(const char *s) {
return u8x8_GetUTF8Len(&u8x8, s); }
size_t write(uint8_t v) {
}
};
class U8X8_SSD1306_128X64_4W_SW_SPI : public U8X8
{
}
public:
U8X8_SSD1306_128X64_4W_SW_SPI(uint8_t clock, uint8_t data, uint8_t cs, uint8_t dc, uint8_t reset = U8X8_PIN_NONE) : U8X8()
{
u8x8_Setup_4Wire_SW_SPI(&u8x8, u8x8_d_ssd1306_128x64_noname, clock, data, cs, dc, reset);
}
};
#endif /* _U8X8LIB_HH */
#endif /* _U8X8LIB_HH */

View File

@ -45,7 +45,7 @@ BOARD:=uno
U8G_PATH:=$(shell cd ../../.. && pwd)/csrc/
#U8G_CPP_PATH:=$(shell cd ../../.. && pwd)/cppsrc/
U8G_CPP_PATH:=$(shell cd ../../.. && pwd)/cppsrc/
#U8G_FONT_PATH:=$(shell cd ../../.. && pwd)/sfntsrc/
@ -102,9 +102,9 @@ CSRC:=$(shell ls $(CDIRS) 2>/dev/null)
CCSRC:=$(shell ls *.cc 2>/dev/null)
CPPDIRS:=$(EXTRA_DIRS) $(addsuffix utility/,$(EXTRA_DIRS))
CPPDIRS:=$(EXTRA_DIRS) $(addsuffix utility/,$(EXTRA_DIRS)) $(U8G_CPP_PATH)
CPPDIRS:=*.cpp utility/*.cpp $(addsuffix *.cpp,$(CPPDIRS)) $(ARDUINO_PATH)hardware/arduino/cores/arduino/*.cpp
CPPSRC:=$(shell ls $(CPPDIRS) 2>/dev/null)
CPPSRC:=$(shell ls $(CPPDIRS) 2>/dev/null)
#=== build internal variables ===
@ -156,10 +156,9 @@ COMMON_FLAGS = -DF_CPU=$(F_CPU) -mmcu=$(MCU) $(DEFS) -DARDUINO=100
# COMMON_FLAGS += -gdwarf-2
COMMON_FLAGS += -Os
COMMON_FLAGS += -Wall -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
COMMON_FLAGS += -I.
COMMON_FLAGS += -I$(ARDUINO_PATH)hardware/arduino/cores/arduino
COMMON_FLAGS += -I$(ARDUINO_PATH)hardware/arduino/variants/$(VARIANT)
COMMON_FLAGS += -I. -I$(U8G_PATH)
COMMON_FLAGS += -I. -I$(U8G_PATH) -I$(U8G_CPP_PATH)
COMMON_FLAGS += $(addprefix -I,$(EXTRA_DIRS))
COMMON_FLAGS += -ffunction-sections -fdata-sections -Wl,--gc-sections
COMMON_FLAGS += -Wl,--Map=output.map

View File

@ -3,239 +3,8 @@
#include <Arduino.h>
#include <SPI.h>
#include "u8x8.h"
/*=============================================*/
/* callbacks */
extern "C" uint8_t u8x8_gpio_and_delay_arduino(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
{
uint8_t i;
switch(msg)
{
case U8X8_MSG_GPIO_AND_DELAY_INIT:
for( i = 0; i < U8X8_PIN_CNT; i++ )
if ( u8x8->pins[i] != U8X8_PIN_NONE )
pinMode(u8x8->pins[i], OUTPUT);
break;
case U8X8_MSG_DELAY_MILLI:
delay(arg_int);
break;
case U8X8_MSG_DELAY_I2C:
/* arg_int is 1 or 4: 100KHz (5us) or 400KHz (1.25us) */
delayMicroseconds(arg_int<=2?5:2);
break;
case U8X8_MSG_GPIO_I2C_CLOCK:
case U8X8_MSG_GPIO_I2C_DATA:
if ( arg_int == 0 )
{
pinMode(u8x8_GetPinValue(u8x8, msg), OUTPUT);
digitalWrite(u8x8_GetPinValue(u8x8, msg), 0);
}
else
{
pinMode(u8x8_GetPinValue(u8x8, msg), INPUT_PULLUP);
}
break;
default:
if ( msg >= U8X8_MSG_GPIO(0) )
{
i = u8x8_GetPinValue(u8x8, msg);
if ( i != U8X8_PIN_NONE )
digitalWrite(i, arg_int);
break;
}
return 0;
}
return 1;
}
/*=============================================*/
extern "C" uint8_t u8x8_byte_arduino_hw_spi(u8x8_t *u8g2, uint8_t msg, uint8_t arg_int, void *arg_ptr)
{
uint8_t *data;
switch(msg)
{
case U8X8_MSG_BYTE_SEND:
data = (uint8_t *)arg_ptr;
while( arg_int > 0 )
{
SPI.transfer((uint8_t)*data);
data++;
arg_int--;
}
break;
case U8X8_MSG_BYTE_INIT:
/* disable chipselect */
u8x8_gpio_SetCS(u8g2, u8g2->display_info->chip_disable_level);
/* no wait required here */
/* for SPI: setup correct level of the clock signal */
pinMode(11, OUTPUT);
pinMode(13, OUTPUT);
digitalWrite(13, u8g2->display_info->sck_takeover_edge);
break;
case U8X8_MSG_BYTE_SET_DC:
u8x8_gpio_SetDC(u8g2, arg_int);
break;
case U8X8_MSG_BYTE_START_TRANSFER:
SPI.begin();
if ( u8g2->display_info->sck_pulse_width_ns < 70 )
SPI.setClockDivider( SPI_CLOCK_DIV2 );
else
SPI.setClockDivider( SPI_CLOCK_DIV4 );
SPI.setDataMode(SPI_MODE0);
SPI.setBitOrder(MSBFIRST);
u8x8_gpio_SetCS(u8g2, u8g2->display_info->chip_enable_level);
u8g2->gpio_and_delay_cb(u8g2, U8X8_MSG_DELAY_NANO, u8g2->display_info->post_chip_enable_wait_ns, NULL);
break;
case U8X8_MSG_BYTE_END_TRANSFER:
u8g2->gpio_and_delay_cb(u8g2, U8X8_MSG_DELAY_NANO, u8g2->display_info->pre_chip_disable_wait_ns, NULL);
u8x8_gpio_SetCS(u8g2, u8g2->display_info->chip_disable_level);
SPI.end();
break;
case U8X8_MSG_BYTE_SET_I2C_ADR:
break;
case U8X8_MSG_BYTE_SET_DEVICE:
break;
default:
return 0;
}
return 1;
}
/*=============================================*/
/* interface setup procedures */
/*
u8x8_SetPin(u8x8,pin,val)
values for "pin":
U8X8_PIN_D0
U8X8_PIN_SPI_CLOCK
U8X8_PIN_D1
U8X8_PIN_SPI_DATA
U8X8_PIN_D2
U8X8_PIN_D3
U8X8_PIN_D4
U8X8_PIN_D5
U8X8_PIN_D6
U8X8_PIN_D7
U8X8_PIN_E
U8X8_PIN_CS
U8X8_PIN_DC
U8X8_PIN_RESET
values vor "val":
any number or:
U8X8_PIN_NONE
*/
/*
use U8X8_PIN_NONE as value for "reset", if there is no reset line
*/
void u8x8_Setup_4Wire_SW_SPI(u8x8_t *u8x8, u8x8_msg_cb display_cb, uint8_t clock, uint8_t data, uint8_t cs, uint8_t dc, uint8_t reset)
{
u8x8_Setup(u8x8, display_cb, u8x8_cad_001, u8x8_byte_4wire_sw_spi, u8x8_gpio_and_delay_arduino);
/* assign individual pin values (only for ARDUINO, if pin_list is available) */
u8x8_SetPin(u8x8, U8X8_PIN_SPI_CLOCK, clock);
u8x8_SetPin(u8x8, U8X8_PIN_SPI_DATA, data);
u8x8_SetPin(u8x8, U8X8_PIN_CS, cs);
u8x8_SetPin(u8x8, U8X8_PIN_DC, dc);
u8x8_SetPin(u8x8, U8X8_PIN_RESET, reset);
}
void u8x8_Setup_3Wire_SW_SPI(u8x8_t *u8x8, u8x8_msg_cb display_cb, uint8_t clock, uint8_t data, uint8_t cs, uint8_t reset)
{
u8x8_Setup(u8x8, display_cb, u8x8_cad_001, u8x8_byte_3wire_sw_spi, u8x8_gpio_and_delay_arduino);
/* assign individual pin values (only for ARDUINO, if pin_list is available) */
u8x8_SetPin(u8x8, U8X8_PIN_SPI_CLOCK, clock);
u8x8_SetPin(u8x8, U8X8_PIN_SPI_DATA, data);
u8x8_SetPin(u8x8, U8X8_PIN_CS, cs);
u8x8_SetPin(u8x8, U8X8_PIN_RESET, reset);
}
/*
use U8X8_PIN_NONE as value for "reset", if there is no reset line
*/
void u8x8_Setup_4Wire_HW_SPI(u8x8_t *u8x8, u8x8_msg_cb display_cb, uint8_t cs, uint8_t dc, uint8_t reset)
{
u8x8_Setup(u8x8, display_cb, u8x8_cad_001, u8x8_byte_arduino_hw_spi, u8x8_gpio_and_delay_arduino);
/* assign individual pin values (only for ARDUINO, if pin_list is available) */
u8x8_SetPin(u8x8, U8X8_PIN_CS, cs);
u8x8_SetPin(u8x8, U8X8_PIN_DC, dc);
u8x8_SetPin(u8x8, U8X8_PIN_RESET, reset);
}
void u8x8_Setup_SSD13xx_SW_I2C(u8x8_t *u8x8, u8x8_msg_cb display_cb, uint8_t clock, uint8_t data, uint8_t reset)
{
u8x8_Setup(u8x8, display_cb, u8x8_cad_001, u8x8_byte_ssd13xx_sw_i2c, u8x8_gpio_and_delay_arduino);
/* assign individual pin values (only for ARDUINO, if pin_list is available) */
u8x8_SetPin(u8x8, U8X8_PIN_I2C_CLOCK, clock);
u8x8_SetPin(u8x8, U8X8_PIN_I2C_DATA, data);
u8x8_SetPin(u8x8, U8X8_PIN_RESET, reset);
}
void u8x8_Setup_8Bit_6800(u8x8_t *u8x8, u8x8_msg_cb display_cb, uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, uint8_t enable, uint8_t cs, uint8_t dc, uint8_t reset)
{
u8x8_Setup(u8x8, display_cb, u8x8_cad_001, u8x8_byte_8bit_6800mode, u8x8_gpio_and_delay_arduino);
/* assign individual pin values (only for ARDUINO, if pin_list is available) */
u8x8_SetPin(u8x8, U8X8_PIN_D0, d0);
u8x8_SetPin(u8x8, U8X8_PIN_D1, d1);
u8x8_SetPin(u8x8, U8X8_PIN_D2, d2);
u8x8_SetPin(u8x8, U8X8_PIN_D3, d3);
u8x8_SetPin(u8x8, U8X8_PIN_D4, d4);
u8x8_SetPin(u8x8, U8X8_PIN_D5, d5);
u8x8_SetPin(u8x8, U8X8_PIN_D6, d6);
u8x8_SetPin(u8x8, U8X8_PIN_D7, d7);
u8x8_SetPin(u8x8, U8X8_PIN_E, enable);
u8x8_SetPin(u8x8, U8X8_PIN_CS, cs);
u8x8_SetPin(u8x8, U8X8_PIN_DC, dc);
u8x8_SetPin(u8x8, U8X8_PIN_RESET, reset);
}
void u8x8_Setup_8Bit_8080(u8x8_t *u8x8, u8x8_msg_cb display_cb, uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, uint8_t wr, uint8_t cs, uint8_t dc, uint8_t reset)
{
u8x8_Setup(u8x8, display_cb, u8x8_cad_001, u8x8_byte_8bit_8080mode, u8x8_gpio_and_delay_arduino);
/* assign individual pin values (only for ARDUINO, if pin_list is available) */
u8x8_SetPin(u8x8, U8X8_PIN_D0, d0);
u8x8_SetPin(u8x8, U8X8_PIN_D1, d1);
u8x8_SetPin(u8x8, U8X8_PIN_D2, d2);
u8x8_SetPin(u8x8, U8X8_PIN_D3, d3);
u8x8_SetPin(u8x8, U8X8_PIN_D4, d4);
u8x8_SetPin(u8x8, U8X8_PIN_D5, d5);
u8x8_SetPin(u8x8, U8X8_PIN_D6, d6);
u8x8_SetPin(u8x8, U8X8_PIN_D7, d7);
u8x8_SetPin(u8x8, U8X8_PIN_E, wr);
u8x8_SetPin(u8x8, U8X8_PIN_CS, cs);
u8x8_SetPin(u8x8, U8X8_PIN_DC, dc);
u8x8_SetPin(u8x8, U8X8_PIN_RESET, reset);
}
#include "U8x8lib.h"
/*=============================================*/
@ -255,10 +24,10 @@ void setup(void)
digitalWrite(10, 0); // default output in I2C mode for the SSD1306 test shield
//u8x8_Setup_3Wire_SW_SPI(&u8x8, u8x8_d_ssd1306_128x64_noname, 13, 11, 10, 8);
//u8x8_Setup_4Wire_SW_SPI(&u8x8, u8x8_d_ssd1306_128x64_noname, 13, 11, 10, 9, 8);
u8x8_Setup_4Wire_SW_SPI(&u8x8, u8x8_d_ssd1306_128x64_noname, 13, 11, 10, 9, 8);
//u8x8_Setup_4Wire_HW_SPI(&u8x8, u8x8_d_ssd1306_128x64_noname, 10, 9, 8);
u8x8_Setup_SSD13xx_SW_I2C(&u8x8, u8x8_d_ssd1306_128x64_noname, 13, 11, 8);
//u8x8_Setup_SSD13xx_SW_I2C(&u8x8, u8x8_d_ssd1306_128x64_noname, 13, 11, 8);
//u8x8_Setup_8Bit_6800(&u8x8, u8x8_d_ssd1306_128x64_noname, 13, 11, 2, 3, 4, 5, 6, A4, /*enable=*/ 7, /*cs=*/ 10, /*dc=*/ 9, /*reset=*/ 8);
//u8x8_Setup_8Bit_8080(&u8x8, u8x8_d_ssd1306_128x64_noname, 13, 11, 2, 3, 4, 5, 6, A4, /*enable=*/ 7, /*cs=*/ 10, /*dc=*/ 9, /*reset=*/ 8);