Skip to content

Commit

Permalink
1.5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
olikraus committed Dec 16, 2017
1 parent a5cef38 commit e21641a
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 22 deletions.
1 change: 1 addition & 0 deletions examples/Box3D/Box3D.ino
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
//Ucglib_SSD1351_18x128x128_HWSPI ucg(/*cd=*/ 9, /*cs=*/ 10, /*reset=*/ 8);
//Ucglib_SSD1351_18x128x128_FT_SWSPI ucg(/*sclk=*/ 13, /*data=*/ 11, /*cd=*/ 9, /*cs=*/ 10, /*reset=*/ 8);
//Ucglib_SSD1351_18x128x128_FT_HWSPI ucg(/*cd=*/ 9, /*cs=*/ 10, /*reset=*/ 8);
//Ucglib_SSD1351_18x128x128_FT_SWSPI ucg(/*sclk=*/ 4, /*data=*/ 17, /*cd=*/ 16, /*cs=*/ 0, /*reset=*/ 2); /* FT SSD1351 direct connect to ESP32 */

//Ucglib_PCF8833_16x132x132_SWSPI ucg(/*sclk=*/ 13, /*data=*/ 11, /*cs=*/ 9, /*reset=*/ 8); /* linksprite board */
//Ucglib_PCF8833_16x132x132_HWSPI ucg(/*cs=*/ 9, /*reset=*/ 8); /* linksprite board */
Expand Down
1 change: 1 addition & 0 deletions examples/HelloWorld/HelloWorld.ino
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
//Ucglib_SSD1351_18x128x128_HWSPI ucg(/*cd=*/ 9, /*cs=*/ 10, /*reset=*/ 8);
//Ucglib_SSD1351_18x128x128_FT_SWSPI ucg(/*sclk=*/ 13, /*data=*/ 11, /*cd=*/ 9, /*cs=*/ 10, /*reset=*/ 8);
//Ucglib_SSD1351_18x128x128_FT_HWSPI ucg(/*cd=*/ 9, /*cs=*/ 10, /*reset=*/ 8);
//Ucglib_SSD1351_18x128x128_FT_SWSPI ucg(/*sclk=*/ 4, /*data=*/ 17, /*cd=*/ 16, /*cs=*/ 0, /*reset=*/ 2); /* FT SSD1351 direct connect to ESP32 */

//Ucglib_PCF8833_16x132x132_SWSPI ucg(/*sclk=*/ 13, /*data=*/ 11, /*cs=*/ 9, /*reset=*/ 8); /* linksprite board */
//Ucglib_PCF8833_16x132x132_HWSPI ucg(/*cs=*/ 9, /*reset=*/ 8); /* linksprite board */
Expand Down
3 changes: 3 additions & 0 deletions extras/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ Changelog Ucglib (http://code.google.com/p/ucglib/)
* Support for SSD1331 OLEDs
2016-01-07 v1.4.0 Oliver Kraus <olikraus@gmail.com>
* Support for ESP8266 (issue 61)
2017-12-16 v1.5.2 Oliver Kraus <olikraus@gmail.com>
* Integration of HX8352C and ILI9486 support
* Fix ESP32 errors



Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Ucglib
version=1.5.1
version=1.5.2
author=oliver <olikraus@gmail.com>
maintainer=oliver <olikraus@gmail.com>
sentence=True color TFT and OLED library, Up to 18 Bit color depth. Supported display controller: ST7735, ILI9163, ILI9325, ILI9341, ILI9486,LD50T6160, PCF8833, SEPS225, SSD1331, SSD1351, HX8352C.
Expand Down
61 changes: 42 additions & 19 deletions src/Ucglib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,13 @@ static void ucg_com_arduino_send_generic_SW_SPI(ucg_t *ucg, uint8_t data)
digitalWrite(ucg->pin_list[UCG_PIN_SDA], 0 );
}
// no delay required, also Arduino Due is slow enough
//delayMicroseconds(1);
// delay required for ESP32
delayMicroseconds(1);
digitalWrite(ucg->pin_list[UCG_PIN_SCL], 1 );
//delayMicroseconds(1);
delayMicroseconds(1);
i--;
digitalWrite(ucg->pin_list[UCG_PIN_SCL], 0 );
//delayMicroseconds(1);
delayMicroseconds(1);
data <<= 1;
} while( i > 0 );

Expand Down Expand Up @@ -664,21 +665,29 @@ static int16_t ucg_com_arduino_3wire_9bit_HW_SPI(ucg_t *ucg, int16_t msg, uint16
digitalWrite(ucg->pin_list[UCG_PIN_RST], 1);

/* setup Arduino SPI */
#if ARDUINO >= 10600
SPI.begin();
#if defined(__AVR__)
SPI.setClockDivider( SPI_CLOCK_DIV2 );
//SPI.setClockDivider( SPI_CLOCK_DIV64 );
//SPI.setDataMode(SPI_MODE0);

#endif
#if defined(__SAM3X8E__)
SPI.setClockDivider( (((ucg_com_info_t *)data)->serial_clk_speed * 84L + 999)/1000L );
#endif
SPI.beginTransaction(SPISettings(1000000000UL/((ucg_com_info_t *)data)->serial_clk_speed, MSBFIRST, SPI_MODE0));
#else
SPI.begin();

if ( ((ucg_com_info_t *)data)->serial_clk_speed/2 < 70 )
SPI.setClockDivider( SPI_CLOCK_DIV2 );
else if ( ((ucg_com_info_t *)data)->serial_clk_speed/2 < 140 )
SPI.setClockDivider( SPI_CLOCK_DIV4 );
else
SPI.setClockDivider( SPI_CLOCK_DIV8 );
SPI.setDataMode(SPI_MODE0);
SPI.setBitOrder(MSBFIRST);
#endif
break;
case UCG_COM_MSG_POWER_DOWN:
#if ARDUINO >= 10600
SPI.endTransaction();
SPI.end();
#else
SPI.end();
#endif
break;
case UCG_COM_MSG_DELAY:
/* flush pending data first, then do the delay */
Expand Down Expand Up @@ -1189,18 +1198,32 @@ static int16_t ucg_com_arduino_4wire_HW_SPI(ucg_t *ucg, int16_t msg, uint16_t ar
pinMode(ucg->pin_list[UCG_PIN_CS], OUTPUT);

/* setup Arduino SPI */

#if ARDUINO >= 10600
SPI.begin();
#if defined(__AVR__)
SPI.setClockDivider( SPI_CLOCK_DIV2 );
#endif
#if defined(__SAM3X8E__)
SPI.setClockDivider( (((ucg_com_info_t *)data)->serial_clk_speed * 84L + 999)/1000L );
#endif
SPI.beginTransaction(SPISettings(1000000000UL/((ucg_com_info_t *)data)->serial_clk_speed, MSBFIRST, SPI_MODE0));
#else
SPI.begin();

if ( ((ucg_com_info_t *)data)->serial_clk_speed/2 < 70 )
SPI.setClockDivider( SPI_CLOCK_DIV2 );
else if ( ((ucg_com_info_t *)data)->serial_clk_speed/2 < 140 )
SPI.setClockDivider( SPI_CLOCK_DIV4 );
else
SPI.setClockDivider( SPI_CLOCK_DIV8 );
SPI.setDataMode(SPI_MODE0);
SPI.setBitOrder(MSBFIRST);
#endif


break;
case UCG_COM_MSG_POWER_DOWN:
SPI.end();
#if ARDUINO >= 10600
SPI.endTransaction();
SPI.end();
#else
SPI.end();
#endif
break;
case UCG_COM_MSG_DELAY:
delayMicroseconds(arg);
Expand Down
4 changes: 2 additions & 2 deletions src/clib/ucg.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@ struct _ucg_arg_t

struct _ucg_com_info_t
{
uint16_t serial_clk_speed;
uint16_t parallel_clk_speed;
uint16_t serial_clk_speed; /* nano seconds cycle time */
uint16_t parallel_clk_speed; /* nano seconds cycle time */
};


Expand Down

0 comments on commit e21641a

Please sign in to comment.