diff --git a/cppsrc/U8x8lib.cpp b/cppsrc/U8x8lib.cpp index c9858d04..731529c7 100644 --- a/cppsrc/U8x8lib.cpp +++ b/cppsrc/U8x8lib.cpp @@ -211,8 +211,81 @@ extern "C" uint8_t u8x8_byte_arduino_4wire_sw_spi(u8x8_t *u8x8, uint8_t msg, uin switch(msg) { case U8X8_MSG_BYTE_SEND: - data = (uint8_t *)arg_ptr; - + + data = (uint8_t *)arg_ptr; + if ( takeover_edge == 0 ) + { + while( arg_int > 0 ) + { + b = *data; + data++; + arg_int--; + if ( b == 0 ) + { + *arduino_data_port &= arduino_data_n_mask; + for( i = 0; i < 4; i++ ) + { + *arduino_clock_port |= arduino_clock_mask; + *arduino_clock_port &= arduino_clock_n_mask; + *arduino_clock_port |= arduino_clock_mask; + *arduino_clock_port &= arduino_clock_n_mask; + } + } + else + { + for( i = 0; i < 8; i++ ) + { + if ( b & 128 ) + *arduino_data_port |= arduino_data_mask; + else + *arduino_data_port &= arduino_data_n_mask; + b <<= 1; + + *arduino_clock_port |= arduino_clock_mask; + *arduino_clock_port &= arduino_clock_n_mask; + } + } + } + } + else + { + while( arg_int > 0 ) + { + b = *data; + data++; + arg_int--; + if ( b == 0 ) + { + *arduino_data_port &= arduino_data_n_mask; + for( i = 0; i < 4; i++ ) + { + *arduino_clock_port &= arduino_clock_n_mask; + *arduino_clock_port |= arduino_clock_mask; + *arduino_clock_port &= arduino_clock_n_mask; + *arduino_clock_port |= arduino_clock_mask; + } + } + else + { + for( i = 0; i < 8; i++ ) + { + if ( b & 128 ) + *arduino_data_port |= arduino_data_mask; + else + *arduino_data_port &= arduino_data_n_mask; + b <<= 1; + + *arduino_clock_port &= arduino_clock_n_mask; + *arduino_clock_port |= arduino_clock_mask; + } + } + } + } + + +#ifdef NOTUSED + + data = (uint8_t *)arg_ptr; while( arg_int > 0 ) { b = *data; @@ -273,7 +346,7 @@ extern "C" uint8_t u8x8_byte_arduino_4wire_sw_spi(u8x8_t *u8x8, uint8_t msg, uin } } - +#endif break; diff --git a/sys/arduino/u8g2_page_buffer/FPS/FPS.ino b/sys/arduino/u8g2_page_buffer/FPS/FPS.ino index 1a1b87d5..176a9bfd 100644 --- a/sys/arduino/u8g2_page_buffer/FPS/FPS.ino +++ b/sys/arduino/u8g2_page_buffer/FPS/FPS.ino @@ -167,7 +167,7 @@ 26.Nov 2016 U8G2_ST7920_128X64_1_8080 Uno Clip=13.5 Box=12.1 @=3.6 Pix=5.9 atmega&arduino optimized - U8G2_ST7920_128X64_1_SW_SPI Uno Clip=12.9 Box=11.0 @=3.5 Pix=5.4 issue 87 + U8G2_ST7920_128X64_1_SW_SPI Uno Clip=13.5 Box=11.5 @=3.5 Pix=5.6 issue 87 U8G2_SSD1306_128X64_NONAME_1_4W_SW_SPI Uno Clip=21.7 Box=46.8 @=4.0 Pix=7.1 U8G2_SSD1306_128X64_NONAME_1_4W_HW_SPI Uno Clip=25.8 Box=84.2 @=4.2 Pix=7.8 U8G2_SSD1306_128X64_NONAME_1_8080 Uno Clip=16.1 Box=29.1 @=3.9 Pix=6.6 @@ -214,7 +214,7 @@ //U8G2_ST7920_192X32_1_SW_SPI u8g2(U8G2_R0, /* clock=*/ 18 /* A4 */ , /* data=*/ 16 /* A2 */, /* CS=*/ 17 /* A3 */, /* reset=*/ U8X8_PIN_NONE); //U8G2_ST7920_128X64_1_8080 u8g2(U8G2_R0, 8, 9, 10, 11, 4, 5, 6, 7, /*enable=*/ 18 /* A4 */, /*cs=*/ U8X8_PIN_NONE, /*dc/rs=*/ 17 /* A3 */, /*reset=*/ 15 /* A1 */); // Remember to set R/W to 0 //U8G2_ST7920_128X64_1_SW_SPI u8g2(U8G2_R0, /* clock=*/ 18 /* A4 */ , /* data=*/ 16 /* A2 */, /* CS=*/ 17 /* A3 */, /* reset=*/ U8X8_PIN_NONE); -//U8G2_ST7920_128X64_1_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* CS=*/ 10, /* reset=*/ 8); +U8G2_ST7920_128X64_1_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* CS=*/ 10, /* reset=*/ 8); //U8G2_ST7920_128X64_1_HW_SPI u8g2(U8G2_R0, /* CS=*/ 10, /* reset=*/ 8); //U8G2_ST7565_EA_DOGM128_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); //U8G2_ST7565_EA_DOGM128_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);