Skip to content

Commit bc1b01a

Browse files
committed
Moving dcPin init to SPI and parallel setup functions
1 parent 8b5645a commit bc1b01a

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/SFE_MicroOLED.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,6 @@ void MicroOLED::begin()
209209

210210
// Set up the selected interface:
211211
if (interface == MODE_SPI)
212-
{
213-
pinMode(dcPin, OUTPUT);
214212
spiSetup();
215213
}
216214
else if (interface == MODE_I2C)

src/hardware.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ SPISettings oledSettings(10000000, MSBFIRST, SPI_MODE0);
5050
void MicroOLED::spiSetup()
5151
{
5252
// Initialize the pins:
53+
pinMode(dcPin, OUTPUT); //dc Is used for SPI and parallel interfaces but not I2C
5354
pinMode(MOSI, OUTPUT); // MOSI is an OUTPUT
5455
pinMode(SCK, OUTPUT); // SCK is an OUTPUT
5556
pinMode(csPin, OUTPUT); // CS is an OUTPUT
@@ -107,6 +108,8 @@ void MicroOLED::i2cWrite(byte address, byte dc, byte data)
107108
**/
108109
void MicroOLED::parallelSetup()
109110
{
111+
pinMode(dcPin, OUTPUT); //dc Is used for SPI and parallel interfaces but not I2C
112+
110113
// Initialize WR, RD, CS and data pins as outputs.
111114
pinMode(wrPin, OUTPUT);
112115
digitalWrite(wrPin, HIGH);

0 commit comments

Comments
 (0)