njh / EtherCard

EtherCard is an IPv4 driver for the ENC28J60 chip, compatible with Arduino IDE
https://www.aelius.com/njh/ethercard/
GNU General Public License v2.0
1.03k stars 455 forks source link

Use selectPin rather than SS in initSPI #417

Closed jamesfowkes closed 3 years ago

jamesfowkes commented 3 years ago

I had an issue where I wanted to use digital pin 10 on the Arduino Nano for a purpose other than chip select, but the pin state was changing at boot when I did not expect it to.

I traced this to the initSPI method, which uses the hardcoded SS define rather than the selectPin variable.

This change fixes this in initSPI, as well as ensuring that selectPin is correctly set before initSPI is called.