Skip to content

Commit

Permalink
Merge pull request #2 from quinot/master
Browse files Browse the repository at this point in the history
Ensure compatibility with STM32duino
  • Loading branch information
omersiar authored Aug 1, 2019
2 parents 1259280 + 16b035b commit cba09a8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 20 deletions.
19 changes: 2 additions & 17 deletions src/ShiftedLCD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,6 @@ void LiquidCrystal::initSPI(uint8_t ssPin) //SPI ###############################

SPI.begin();

//set clockDivider to SPI_CLOCK_DIV2 by default which is 8MHz
_clockDivider = SPI_CLOCK_DIV2;
SPI.setClockDivider(_clockDivider);

//set data mode to SPI_MODE0 by default
_dataMode = SPI_MODE0;
SPI.setDataMode(_dataMode);

//set bitOrder to MSBFIRST by default
_bitOrder = MSBFIRST;
SPI.setBitOrder(_bitOrder);
}

void LiquidCrystal::begin(uint8_t cols, uint8_t lines, uint8_t dotsize) {
Expand Down Expand Up @@ -270,13 +259,9 @@ void LiquidCrystal::write4bits(uint8_t value) {

void LiquidCrystal::spiSendOut() //SPI #############################
{
//just in case you are using SPI for more then one device
//set bitOrder, clockDivider and dataMode each time
SPI.setClockDivider(_clockDivider);
SPI.setBitOrder(_bitOrder);
SPI.setDataMode(_dataMode);

digitalWrite(_latchPin, LOW);
SPI.beginTransaction(SPISettings(8000000, MSBFIRST, SPI_MODE0));
SPI.transfer(_bitString);
SPI.endTransaction();
digitalWrite(_latchPin, HIGH);
}
3 changes: 0 additions & 3 deletions src/ShiftedLCD.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@ class LiquidCrystal : public Print {
//SPI #####################################################################
uint8_t _bitString; //for SPI bit0=not used, bit1=RS, bit2=RW, bit3=Enable, bits4-7 = DB4-7
uint8_t _latchPin;
uint8_t _clockDivider;
uint8_t _dataMode;
uint8_t _bitOrder;//SPI ####################################################

uint8_t _displayfunction;
uint8_t _displaycontrol;
Expand Down

0 comments on commit cba09a8

Please sign in to comment.