Skip to content

Commit 43eed7d

Browse files
committed
Moving SPI pin initialization from constructor to begin() function. That way, the SPI library won't alter any pin states unless / until you call begin().
1 parent 50cc730 commit 43eed7d

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

examples/BarometricPressureWebServer/BarometricPressureWebServer.pde

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ long pressure = 0;
6060
long lastReadingTime = 0;
6161

6262
void setup() {
63+
// start the SPI library:
64+
SPI.begin();
65+
6366
// start the Ethernet connection and the server:
6467
Ethernet.begin(mac, ip);
6568
server.begin();
@@ -68,8 +71,6 @@ void setup() {
6871
pinMode(dataReadyPin, INPUT);
6972
pinMode(chipSelectPin, OUTPUT);
7073

71-
// start the SPI library:
72-
SPI.begin();
7374
Serial.begin(9600);
7475

7576
//Configure SCP1000 for low noise configuration:

utility/w5100.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@ W5100Class W5100;
2525

2626
void W5100Class::init(void)
2727
{
28-
initSS();
28+
delay(300);
2929

30+
SPI.begin();
31+
initSS();
32+
3033
writeMR(1<<RST);
3134
writeTMSR(0x55);
3235
writeRMSR(0x55);

0 commit comments

Comments
 (0)