Skip to content

Commit

Permalink
Moving dcPin init to SPI and parallel setup functions
Browse files Browse the repository at this point in the history
  • Loading branch information
nseidle committed Jun 11, 2018
1 parent 8b5645a commit bc1b01a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/SFE_MicroOLED.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,6 @@ void MicroOLED::begin()

// Set up the selected interface:
if (interface == MODE_SPI)
{
pinMode(dcPin, OUTPUT);
spiSetup();
}
else if (interface == MODE_I2C)
Expand Down
3 changes: 3 additions & 0 deletions src/hardware.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ SPISettings oledSettings(10000000, MSBFIRST, SPI_MODE0);
void MicroOLED::spiSetup()
{
// Initialize the pins:
pinMode(dcPin, OUTPUT); //dc Is used for SPI and parallel interfaces but not I2C
pinMode(MOSI, OUTPUT); // MOSI is an OUTPUT
pinMode(SCK, OUTPUT); // SCK is an OUTPUT
pinMode(csPin, OUTPUT); // CS is an OUTPUT
Expand Down Expand Up @@ -107,6 +108,8 @@ void MicroOLED::i2cWrite(byte address, byte dc, byte data)
**/
void MicroOLED::parallelSetup()
{
pinMode(dcPin, OUTPUT); //dc Is used for SPI and parallel interfaces but not I2C

// Initialize WR, RD, CS and data pins as outputs.
pinMode(wrPin, OUTPUT);
digitalWrite(wrPin, HIGH);
Expand Down

0 comments on commit bc1b01a

Please sign in to comment.