diff --git a/src/SFE_MicroOLED.cpp b/src/SFE_MicroOLED.cpp index 12723ca..d1bc81d 100644 --- a/src/SFE_MicroOLED.cpp +++ b/src/SFE_MicroOLED.cpp @@ -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) diff --git a/src/hardware.cpp b/src/hardware.cpp index 723ffb1..e2bc2e8 100644 --- a/src/hardware.cpp +++ b/src/hardware.cpp @@ -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 @@ -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);