mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-26 20:54:22 +01:00
WiFi: move init from constructor to method
Zero SPI library is not responding correctly when invoked before main() AVR compatibility ok fixes arduino/ArduinoCore-samd#18
This commit is contained in:
parent
5d388e1646
commit
1fb0f84c46
@ -32,8 +32,6 @@ uint16_t WiFiClass::_server_port[MAX_SOCK_NUM] = { 0, 0, 0, 0 };
|
||||
|
||||
WiFiClass::WiFiClass()
|
||||
{
|
||||
// Driver initialization
|
||||
init();
|
||||
}
|
||||
|
||||
void WiFiClass::init()
|
||||
|
@ -43,8 +43,8 @@ void SpiDrv::begin()
|
||||
pinMode(SLAVEREADY, INPUT);
|
||||
pinMode(WIFILED, OUTPUT);
|
||||
|
||||
digitalWrite(SCK, LOW);
|
||||
digitalWrite(MOSI, LOW);
|
||||
// digitalWrite(SCK, LOW);
|
||||
// digitalWrite(MOSI, LOW);
|
||||
digitalWrite(SS, HIGH);
|
||||
digitalWrite(SLAVESELECT, HIGH);
|
||||
digitalWrite(WIFILED, LOW);
|
||||
|
@ -30,11 +30,15 @@
|
||||
|
||||
#define DUMMY_DATA 0xFF
|
||||
|
||||
#define WAIT_FOR_SLAVE_SELECT() \
|
||||
SpiDrv::waitForSlaveReady(); \
|
||||
#define WAIT_FOR_SLAVE_SELECT() \
|
||||
if (!initialized) { \
|
||||
SpiDrv::begin(); \
|
||||
initialized = true; \
|
||||
} \
|
||||
SpiDrv::waitForSlaveReady(); \
|
||||
SpiDrv::spiSlaveSelect();
|
||||
|
||||
|
||||
static bool initialized = false;
|
||||
|
||||
class SpiDrv
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user