Fix ESP8266 compilation

This commit is contained in:
Theo Arends 2023-01-21 15:42:31 +01:00
parent c85003c67d
commit 8b96f68a5b

View File

@ -252,6 +252,7 @@ int Ade7953RegSize(uint16_t reg) {
return size; return size;
} }
#ifdef USE_ESP32_SPI
void Ade7953SpiEnable(void) { void Ade7953SpiEnable(void) {
digitalWrite(Ade7953.pin_cs[Ade7953.cs_index], 0); digitalWrite(Ade7953.pin_cs[Ade7953.cs_index], 0);
delayMicroseconds(1); // CS 1uS to SCLK edge delayMicroseconds(1); // CS 1uS to SCLK edge
@ -263,6 +264,7 @@ void Ade7953SpiDisable(void) {
delayMicroseconds(2); // CS high 1.2uS after SCLK edge (when writing to COMM_LOCK bit) delayMicroseconds(2); // CS high 1.2uS after SCLK edge (when writing to COMM_LOCK bit)
digitalWrite(Ade7953.pin_cs[Ade7953.cs_index], 1); digitalWrite(Ade7953.pin_cs[Ade7953.cs_index], 1);
} }
#endif // USE_ESP32_SPI
void Ade7953Write(uint16_t reg, uint32_t val) { void Ade7953Write(uint16_t reg, uint32_t val) {
int size = Ade7953RegSize(reg); int size = Ade7953RegSize(reg);
@ -690,11 +692,13 @@ void Ade7953DrvInit(void) {
pinMode(pin_reset, INPUT); pinMode(pin_reset, INPUT);
} }
} }
#ifdef USE_ESP32_SPI
#ifdef USE_SHELLY_PRO #ifdef USE_SHELLY_PRO
if (Ade7953.model == ADE7953_SHELLY_PRO_4PM) { if (Ade7953.model == ADE7953_SHELLY_PRO_4PM) {
ShellyPro4Reset(); ShellyPro4Reset();
} }
#endif // USE_SHELLY_PRO #endif // USE_SHELLY_PRO
#endif // USE_ESP32_SPI
delay(100); // Need 100mS to init ADE7953 delay(100); // Need 100mS to init ADE7953
#ifdef USE_ESP32_SPI #ifdef USE_ESP32_SPI