From 3b20aed15d46b26a6881ef80dfefa3c52a0ea792 Mon Sep 17 00:00:00 2001 From: olikraus Date: Sun, 1 May 2016 10:01:37 +0200 Subject: [PATCH] Removed SET_I2C and SET_DEVICE messages --- ChangeLog | 4 +++- cppsrc/U8x8lib.cpp | 23 ++++++++++++++++------- csrc/u8g2.h | 4 ++++ csrc/u8x8.h | 19 +++++++++++-------- csrc/u8x8_byte.c | 30 ------------------------------ csrc/u8x8_cad.c | 13 ------------- csrc/u8x8_setup.c | 1 + tools/buildcpp/OBSOLETE | 0 tools/release/print_release.sh | 2 +- 9 files changed, 36 insertions(+), 60 deletions(-) create mode 100644 tools/buildcpp/OBSOLETE diff --git a/ChangeLog b/ChangeLog index f1b2da2f..2d90612c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,4 +2,6 @@ https://github.com/olikraus/u8g2 ChangeLog -2016-01-01 v2.00 olikraus@gmail.com +2016-04-30 v2.0.1 olikraus@gmail.com + * Support for DOGS102, ST7920, SSD1306 + * Most graphics primitives are implemented diff --git a/cppsrc/U8x8lib.cpp b/cppsrc/U8x8lib.cpp index 743773c0..5b65ce09 100644 --- a/cppsrc/U8x8lib.cpp +++ b/cppsrc/U8x8lib.cpp @@ -151,10 +151,6 @@ extern "C" uint8_t u8x8_byte_arduino_hw_spi(u8x8_t *u8g2, uint8_t msg, uint8_t a SPI.end(); - break; - case U8X8_MSG_BYTE_SET_I2C_ADR: - break; - case U8X8_MSG_BYTE_SET_DEVICE: break; default: return 0; @@ -178,7 +174,7 @@ void u8x8_SetPin_4Wire_SW_SPI(u8x8_t *u8x8, uint8_t clock, uint8_t data, uint8_t u8x8_SetPin(u8x8, U8X8_PIN_RESET, reset); } - +#ifdef _obsolete_com_specific_setup 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); @@ -190,6 +186,7 @@ void u8x8_Setup_4Wire_SW_SPI(u8x8_t *u8x8, u8x8_msg_cb display_cb, uint8_t clock u8x8_SetPin(u8x8, U8X8_PIN_DC, dc); u8x8_SetPin(u8x8, U8X8_PIN_RESET, reset); } +#endif /* obsolete com specific setup */ void u8x8_SetPin_3Wire_SW_SPI(u8x8_t *u8x8, uint8_t clock, uint8_t data, uint8_t cs, uint8_t reset) { @@ -199,6 +196,7 @@ void u8x8_SetPin_3Wire_SW_SPI(u8x8_t *u8x8, uint8_t clock, uint8_t data, uint8_t u8x8_SetPin(u8x8, U8X8_PIN_RESET, reset); } +#ifdef _obsolete_com_specific_setup 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); @@ -209,6 +207,7 @@ void u8x8_Setup_3Wire_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_RESET, reset); } +#endif /* obsolete com specific setup */ /* use U8X8_PIN_NONE as value for "reset", if there is no reset line @@ -221,6 +220,7 @@ void u8x8_SetPin_4Wire_HW_SPI(u8x8_t *u8x8, uint8_t cs, uint8_t dc, uint8_t rese } +#ifdef _obsolete_com_specific_setup 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); @@ -230,15 +230,17 @@ void u8x8_Setup_4Wire_HW_SPI(u8x8_t *u8x8, u8x8_msg_cb display_cb, uint8_t cs, u u8x8_SetPin(u8x8, U8X8_PIN_DC, dc); u8x8_SetPin(u8x8, U8X8_PIN_RESET, reset); } +#endif /* obsolete com specific setup */ + void u8x8_SetPin_SSD13xx_SW_I2C(u8x8_t *u8x8, uint8_t clock, uint8_t data, uint8_t reset) { u8x8_SetPin(u8x8, U8X8_PIN_I2C_CLOCK, clock); u8x8_SetPin(u8x8, U8X8_PIN_I2C_DATA, data); u8x8_SetPin(u8x8, U8X8_PIN_RESET, reset); - } +#ifdef _obsolete_com_specific_setup 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); @@ -247,8 +249,8 @@ void u8x8_Setup_SSD13xx_SW_I2C(u8x8_t *u8x8, u8x8_msg_cb display_cb, uint8_t clo u8x8_SetPin(u8x8, U8X8_PIN_I2C_CLOCK, clock); u8x8_SetPin(u8x8, U8X8_PIN_I2C_DATA, data); u8x8_SetPin(u8x8, U8X8_PIN_RESET, reset); - } +#endif /* obsolete com specific setup */ void u8x8_SetPin_8Bit_6800(u8x8_t *u8x8, 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) { @@ -266,6 +268,7 @@ void u8x8_SetPin_8Bit_6800(u8x8_t *u8x8, uint8_t d0, uint8_t d1, uint8_t d2, uin u8x8_SetPin(u8x8, U8X8_PIN_RESET, reset); } +#ifdef _obsolete_com_specific_setup 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); @@ -284,6 +287,8 @@ void u8x8_Setup_8Bit_6800(u8x8_t *u8x8, u8x8_msg_cb display_cb, uint8_t d0, uint u8x8_SetPin(u8x8, U8X8_PIN_DC, dc); u8x8_SetPin(u8x8, U8X8_PIN_RESET, reset); } +#endif /* obsolete com specific setup */ + void u8x8_SetPin_8Bit_8080(u8x8_t *u8x8, 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) { @@ -301,6 +306,8 @@ void u8x8_SetPin_8Bit_8080(u8x8_t *u8x8, uint8_t d0, uint8_t d1, uint8_t d2, uin u8x8_SetPin(u8x8, U8X8_PIN_RESET, reset); } + +#ifdef _obsolete_com_specific_setup 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); @@ -319,3 +326,5 @@ void u8x8_Setup_8Bit_8080(u8x8_t *u8x8, u8x8_msg_cb display_cb, uint8_t d0, uint u8x8_SetPin(u8x8, U8X8_PIN_DC, dc); u8x8_SetPin(u8x8, U8X8_PIN_RESET, reset); } +#endif /* obsolete com specific setup */ + diff --git a/csrc/u8g2.h b/csrc/u8g2.h index 993f6b27..87068233 100644 --- a/csrc/u8g2.h +++ b/csrc/u8g2.h @@ -306,6 +306,7 @@ struct u8g2_struct uint8_t draw_color; /* 0: clear pixel, 1: set pixel, modified and restored by font procedures */ /* draw_color can be used also directly by the user API */ + #ifdef U8G2_WITH_HVLINE_COUNT unsigned long hv_cnt; @@ -330,6 +331,9 @@ struct u8g2_struct #define u8g2_GetDisplayWidth(u8g2) ((u8g2)->width) #define u8g2_GetDrawColor(u8g2) ((u8g2)->draw_color) +#define u8g2_SetI2CAddress(u8g2, address) ((u8g2_GetU8x8(u8g2))->i2c_address = (address)) +#define u8g2_GetI2CAddress(u8g2) u8x8_GetI2CAddress(u8g2_GetU8x8(u8g2)) + /*==========================================*/ /* u8g2_setup.c */ diff --git a/csrc/u8x8.h b/csrc/u8x8.h index c082148b..99060ae0 100644 --- a/csrc/u8x8.h +++ b/csrc/u8x8.h @@ -53,8 +53,8 @@ to communicate with the display hardware. This layer only deals with data, commands and arguments. D/C line is unknown. U8X8_MSG_CAD_INIT - U8X8_MSG_CAD_SET_I2C_ADR - U8X8_MSG_CAD_SET_DEVICE + U8X8_MSG_CAD_SET_I2C_ADR (obsolete) + U8X8_MSG_CAD_SET_DEVICE (obsolete) U8X8_MSG_CAD_START_TRANSFER U8X8_MSG_CAD_SEND_CMD U8X8_MSG_CAD_SEND_ARG @@ -71,8 +71,8 @@ U8X8_MSG_BYTE_SET_DC 31 U8X8_MSG_BYTE_START_TRANSFER U8X8_MSG_BYTE_END_TRANSFER - U8X8_MSG_BYTE_SET_I2C_ADR - U8X8_MSG_BYTE_SET_DEVICE + U8X8_MSG_BYTE_SET_I2C_ADR (obsolete) + U8X8_MSG_BYTE_SET_DEVICE (obsolete) GPIO and Delay U8X8_MSG_GPIO_INIT @@ -249,7 +249,10 @@ struct u8x8_struct uint8_t x_offset; /* copied from info struct, can be modified in flip mode */ uint8_t is_font_inverse_mode; /* 0: normal, 1: font glyphs are inverted */ uint8_t i2c_address; /* a valid i2c adr. Initially this is 255, but this is set to something usefull during DISPLAY_INIT */ + /* i2c_address is the address for writing data to the display */ + /* usually, the lowest bit must be zero for a valid address */ uint8_t i2c_started; /* for i2c interface */ + uint8_t device_address; /* this is the device address, replacement for U8X8_MSG_CAD_SET_DEVICE */ #ifdef U8X8_USE_PINS uint8_t pins[U8X8_PIN_CNT]; /* defines a pinlist: Mainly a list of pins for the Arduino Envionment, use U8X8_PIN_xxx to access */ #endif @@ -437,8 +440,8 @@ void u8x8_ClearDisplay(u8x8_t *u8x8); /* arg_int: expected cs level after processing this msg */ #define U8X8_MSG_CAD_END_TRANSFER 25 /* arg_int = 0: disable chip, arg_int = 1: enable chip */ -#define U8X8_MSG_CAD_SET_I2C_ADR 26 -#define U8X8_MSG_CAD_SET_DEVICE 27 +//#define U8X8_MSG_CAD_SET_I2C_ADR 26 +//#define U8X8_MSG_CAD_SET_DEVICE 27 @@ -489,8 +492,8 @@ uint8_t u8x8_cad_ssd13xx_i2c(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *a #define U8X8_MSG_BYTE_START_TRANSFER U8X8_MSG_CAD_START_TRANSFER #define U8X8_MSG_BYTE_END_TRANSFER U8X8_MSG_CAD_END_TRANSFER -#define U8X8_MSG_BYTE_SET_I2C_ADR U8X8_MSG_CAD_SET_I2C_ADR -#define U8X8_MSG_BYTE_SET_DEVICE U8X8_MSG_CAD_SET_DEVICE +//#define U8X8_MSG_BYTE_SET_I2C_ADR U8X8_MSG_CAD_SET_I2C_ADR +//#define U8X8_MSG_BYTE_SET_DEVICE U8X8_MSG_CAD_SET_DEVICE uint8_t u8x8_byte_SetDC(u8x8_t *u8x8, uint8_t dc) U8X8_NOINLINE; diff --git a/csrc/u8x8_byte.c b/csrc/u8x8_byte.c index 4d639bc1..52900626 100644 --- a/csrc/u8x8_byte.c +++ b/csrc/u8x8_byte.c @@ -83,8 +83,6 @@ uint8_t u8x8_byte_EndTransfer(u8x8_t *u8x8) U8X8_MSG_BYTE_SET_DC U8X8_MSG_BYTE_START_TRANSFER U8X8_MSG_BYTE_END_TRANSFER - U8X8_MSG_BYTE_SET_I2C_ADR (ignored) - U8X8_MSG_BYTE_SET_DEVICE (ignored) */ uint8_t u8x8_byte_4wire_sw_spi(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) @@ -138,10 +136,6 @@ uint8_t u8x8_byte_4wire_sw_spi(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void u8x8->gpio_and_delay_cb(u8x8, U8X8_MSG_DELAY_NANO, u8x8->display_info->pre_chip_disable_wait_ns, NULL); u8x8_gpio_SetCS(u8x8, u8x8->display_info->chip_disable_level); break; - case U8X8_MSG_BYTE_SET_I2C_ADR: - break; - case U8X8_MSG_BYTE_SET_DEVICE: - break; default: return 0; } @@ -194,10 +188,6 @@ uint8_t u8x8_byte_8bit_6800mode(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void u8x8->gpio_and_delay_cb(u8x8, U8X8_MSG_DELAY_NANO, u8x8->display_info->pre_chip_disable_wait_ns, NULL); u8x8_gpio_SetCS(u8x8, u8x8->display_info->chip_disable_level); break; - case U8X8_MSG_BYTE_SET_I2C_ADR: - break; - case U8X8_MSG_BYTE_SET_DEVICE: - break; default: return 0; } @@ -248,10 +238,6 @@ uint8_t u8x8_byte_8bit_8080mode(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void u8x8->gpio_and_delay_cb(u8x8, U8X8_MSG_DELAY_NANO, u8x8->display_info->pre_chip_disable_wait_ns, NULL); u8x8_gpio_SetCS(u8x8, u8x8->display_info->chip_disable_level); break; - case U8X8_MSG_BYTE_SET_I2C_ADR: - break; - case U8X8_MSG_BYTE_SET_DEVICE: - break; default: return 0; } @@ -315,10 +301,6 @@ uint8_t u8x8_byte_3wire_sw_spi(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void u8x8->gpio_and_delay_cb(u8x8, U8X8_MSG_DELAY_NANO, u8x8->display_info->pre_chip_disable_wait_ns, NULL); u8x8_gpio_SetCS(u8x8, u8x8->display_info->chip_disable_level); break; - case U8X8_MSG_BYTE_SET_I2C_ADR: - break; - case U8X8_MSG_BYTE_SET_DEVICE: - break; default: return 0; } @@ -407,10 +389,6 @@ uint8_t u8x8_byte_st7920_sw_spi(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void u8x8->gpio_and_delay_cb(u8x8, U8X8_MSG_DELAY_NANO, u8x8->display_info->pre_chip_disable_wait_ns, NULL); u8x8_gpio_SetCS(u8x8, u8x8->display_info->chip_disable_level); break; - case U8X8_MSG_BYTE_SET_I2C_ADR: - break; - case U8X8_MSG_BYTE_SET_DEVICE: - break; default: return 0; } @@ -596,10 +574,6 @@ uint8_t u8x8_byte_ssd13xx_sw_i2c(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, voi case U8X8_MSG_BYTE_END_TRANSFER: i2c_stop(u8x8); break; - case U8X8_MSG_BYTE_SET_I2C_ADR: - break; - case U8X8_MSG_BYTE_SET_DEVICE: - break; default: return 0; } @@ -637,10 +611,6 @@ uint8_t u8x8_byte_sw_i2c(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_p case U8X8_MSG_BYTE_END_TRANSFER: i2c_stop(u8x8); break; - case U8X8_MSG_BYTE_SET_I2C_ADR: - break; - case U8X8_MSG_BYTE_SET_DEVICE: - break; default: return 0; } diff --git a/csrc/u8x8_cad.c b/csrc/u8x8_cad.c index 7eb7d2c5..34a9d280 100644 --- a/csrc/u8x8_cad.c +++ b/csrc/u8x8_cad.c @@ -75,10 +75,6 @@ uint8_t u8x8_cad_template(u8x8_t *u8x8, uint8_t msg, uint16_t arg_int, void *arg return mcd->next->cb(mcd->next, msg, arg_int, arg_ptr); case U8X8_MSG_CAD_END_TRANSFER: return mcd->next->cb(mcd->next, msg, arg_int, arg_ptr); - case U8X8_MSG_CAD_SET_I2C_ADR: - return mcd->next->cb(mcd->next, msg, arg_int, arg_ptr); - case U8X8_MSG_CAD_SET_DEVICE: - return mcd->next->cb(mcd->next, msg, arg_int, arg_ptr); default: break; } @@ -187,8 +183,6 @@ uint8_t u8x8_cad_110(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) case U8X8_MSG_CAD_INIT: case U8X8_MSG_CAD_START_TRANSFER: case U8X8_MSG_CAD_END_TRANSFER: - case U8X8_MSG_CAD_SET_I2C_ADR: - case U8X8_MSG_CAD_SET_DEVICE: return u8x8->byte_cb(u8x8, msg, arg_int, arg_ptr); default: return 0; @@ -221,8 +215,6 @@ uint8_t u8x8_cad_001(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) case U8X8_MSG_CAD_INIT: case U8X8_MSG_CAD_START_TRANSFER: case U8X8_MSG_CAD_END_TRANSFER: - case U8X8_MSG_CAD_SET_I2C_ADR: - case U8X8_MSG_CAD_SET_DEVICE: return u8x8->byte_cb(u8x8, msg, arg_int, arg_ptr); default: return 0; @@ -271,8 +263,6 @@ uint8_t u8x8_cad_st7920_spi(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *ar case U8X8_MSG_CAD_INIT: case U8X8_MSG_CAD_START_TRANSFER: case U8X8_MSG_CAD_END_TRANSFER: - case U8X8_MSG_CAD_SET_I2C_ADR: - case U8X8_MSG_CAD_SET_DEVICE: return u8x8->byte_cb(u8x8, msg, arg_int, arg_ptr); default: return 0; @@ -310,9 +300,6 @@ uint8_t u8x8_cad_ssd13xx_i2c(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *a /* apply default i2c adr if required so that the start transfer msg can use this */ if ( u8x8->i2c_address == 255 ) u8x8->i2c_address = 0x078; - /* fall through */ - case U8X8_MSG_CAD_SET_I2C_ADR: - case U8X8_MSG_CAD_SET_DEVICE: return u8x8->byte_cb(u8x8, msg, arg_int, arg_ptr); case U8X8_MSG_CAD_START_TRANSFER: case U8X8_MSG_CAD_END_TRANSFER: diff --git a/csrc/u8x8_setup.c b/csrc/u8x8_setup.c index f7fba722..da9c0dfb 100644 --- a/csrc/u8x8_setup.c +++ b/csrc/u8x8_setup.c @@ -58,6 +58,7 @@ void u8x8_SetupDefaults(u8x8_t *u8x8) u8x8->gpio_and_delay_cb = u8x8_dummy_cb; u8x8->is_font_inverse_mode = 0; u8x8->i2c_address = 255; + u8x8->device_address = 0; #ifdef U8X8_USE_PINS { diff --git a/tools/buildcpp/OBSOLETE b/tools/buildcpp/OBSOLETE new file mode 100644 index 00000000..e69de29b diff --git a/tools/release/print_release.sh b/tools/release/print_release.sh index 101a092d..c94d48c9 100755 --- a/tools/release/print_release.sh +++ b/tools/release/print_release.sh @@ -1,2 +1,2 @@ # without 'v' prefix -echo -n "2.0.0" +echo -n "2.0.1"