Skip to content

Commit

Permalink
fix GxIO_SPI
Browse files Browse the repository at this point in the history
  • Loading branch information
ZinggJM committed Nov 26, 2018
1 parent 6b75616 commit d7d9030
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 16 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ A simple E-Paper display library with common base class and separate IO class fo
### for pin mapping suggestions see ConnectingHardware.md


### Version 3.0.2
### Version 3.0.3
- fix GxIO_SPI: avoid nesting SPI transactions causing deadlock
#### Version 3.0.2
- added GxGDEW0213I5F for 2.13" b/w 104x212 flexible display, initial tests successful
- updated GxIO_SPI to use SPI transactions, for SPI speed with multiple devices, NUCLEO-64
- updated GxEPD_WiFi_Example to use BearSSL on ESP8266, for large bitmap downloads
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=GxEPD
version=3.0.2
version=3.0.3
author=Jean-Marc Zingg
maintainer=Jean-Marc Zingg
sentence=Display Library for SPI e-paper panels from Dalian Good Display and boards from Waveshare.
Expand Down
14 changes: 0 additions & 14 deletions src/GxIO/GxIO_SPI/GxIO_SPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,13 @@ uint16_t GxIO_SPI::readData16Transaction()

uint8_t GxIO_SPI::readData()
{
_spi.beginTransaction(_spi_settings);
uint8_t rv = _spi.transfer(0xFF);
_spi.endTransaction();
return rv;
}

uint16_t GxIO_SPI::readData16()
{
_spi.beginTransaction(_spi_settings);
uint16_t rv = _spi.transfer16(0xFFFF);
_spi.endTransaction();
return rv;
}

Expand Down Expand Up @@ -141,23 +137,18 @@ void GxIO_SPI::writeData16Transaction(uint16_t d, uint32_t num)

void GxIO_SPI::writeCommand(uint8_t c)
{
_spi.beginTransaction(_spi_settings);
if (_dc >= 0) digitalWrite(_dc, LOW);
_spi.transfer(c);
if (_dc >= 0) digitalWrite(_dc, HIGH);
_spi.endTransaction();
}

void GxIO_SPI::writeData(uint8_t d)
{
_spi.beginTransaction(_spi_settings);
_spi.transfer(d);
_spi.endTransaction();
}

void GxIO_SPI::writeData(uint8_t* d, uint32_t num)
{
_spi.beginTransaction(_spi_settings);
#if defined(ESP8266) || defined(ESP32)
_spi.writeBytes(d, num);
#else
Expand All @@ -168,12 +159,10 @@ void GxIO_SPI::writeData(uint8_t* d, uint32_t num)
num--;
}
#endif
_spi.endTransaction();
}

void GxIO_SPI::writeData16(uint16_t d, uint32_t num)
{
_spi.beginTransaction(_spi_settings);
#if defined(ESP8266) || defined(ESP32)
uint8_t b[2] = {uint8_t(d >> 8), uint8_t(d)};
_spi.writePattern(b, 2, num);
Expand All @@ -184,15 +173,12 @@ void GxIO_SPI::writeData16(uint16_t d, uint32_t num)
num--;
}
#endif
_spi.endTransaction();
}

void GxIO_SPI::writeAddrMSBfirst(uint16_t d)
{
_spi.beginTransaction(_spi_settings);
_spi.transfer(d >> 8);
_spi.transfer(d & 0xFF);
_spi.endTransaction();
}

void GxIO_SPI::startTransaction()
Expand Down

0 comments on commit d7d9030

Please sign in to comment.