Hi,
I’m trying to simulate an old temperature sensor with the Adafruit DS3502 connected to an ESP8266 NodeMCU. It is my first custom component in ESPHome, so I am not quite sure if everything is correct.
My problem is that the project fails to compile with strange errors, to which I’m unable to find some solution:
INFO Reading configuration /config/esphome/esp-pot-test.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing esp-pot-test (board: nodemcuv2; framework: arduino; platform: platformio/espressif8266 @ 3.2.0)
--------------------------------------------------------------------------------
Library Manager: Installing ottowinter/ESPAsyncTCP-esphome @ 1.2.3
INFO Installing ottowinter/ESPAsyncTCP-esphome @ 1.2.3
Unpacking [####################################] 100%
Library Manager: [email protected] has been installed!
INFO [email protected] has been installed!
Library Manager: Installing adafruit/Adafruit BusIO
INFO Installing adafruit/Adafruit BusIO
Unpacking [####################################] 100%
Library Manager: Adafruit [email protected] has been installed!
INFO Adafruit [email protected] has been installed!
Library Manager: Installing adafruit/Adafruit DS3502
INFO Installing adafruit/Adafruit DS3502
Unpacking [####################################] 100%
Library Manager: Adafruit [email protected] has been installed!
INFO Adafruit [email protected] has been installed!
Library Manager: Resolving dependencies...
INFO Resolving dependencies...
Library Manager: Installing esphome/ESPAsyncWebServer-esphome @ 2.1.0
INFO Installing esphome/ESPAsyncWebServer-esphome @ 2.1.0
Unpacking [####################################] 100%
Library Manager: [email protected] has been installed!
INFO [email protected] has been installed!
Library Manager: Resolving dependencies...
INFO Resolving dependencies...
Library Manager: Installing esphome/AsyncTCP-esphome
INFO Installing esphome/AsyncTCP-esphome
Unpacking [####################################] 100%
Library Manager: [email protected] has been installed!
INFO [email protected] has been installed!
Library Manager: Installing esphome/noise-c @ 0.1.4
INFO Installing esphome/noise-c @ 0.1.4
Unpacking [####################################] 100%
Library Manager: [email protected] has been installed!
INFO [email protected] has been installed!
Library Manager: Resolving dependencies...
INFO Resolving dependencies...
Library Manager: Installing esphome/libsodium @ 1.10018.1
INFO Installing esphome/libsodium @ 1.10018.1
Unpacking [####################################] 100%
Library Manager: [email protected] has been installed!
INFO [email protected] has been installed!
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
Dependency Graph
|-- ESPAsyncTCP-esphome @ 1.2.3
|-- SPI @ 1.0
|-- Wire @ 1.0
|-- Adafruit BusIO @ 1.13.2
|-- Adafruit DS3502 @ 1.0.1
|-- ESPAsyncWebServer-esphome @ 2.1.0
| |-- ESPAsyncTCP-esphome @ 1.2.3
| |-- Hash @ 1.0
| |-- ESP8266WiFi @ 1.0
|-- DNSServer @ 1.1.1
|-- ESP8266WiFi @ 1.0
|-- ESP8266mDNS @ 1.2
|-- noise-c @ 0.1.4
| |-- libsodium @ 1.10018.1
Compiling /data/esp-pot-test/.pioenvs/esp-pot-test/src/Adafruit_BusIO_Register.cpp.o
Compiling /data/esp-pot-test/.pioenvs/esp-pot-test/src/Adafruit_DS3502.cpp.o
In file included from src/Adafruit_DS3502.cpp:34:
src/SPI.h: In member function 'void SPISettings::init_AlwaysInline(uint32_t, uint8_t, uint8_t)':
src/SPI.h:134:16: error: 'SPE' was not declared in this scope; did you mean 'GPE'?
134 | spcr = _BV(SPE) | _BV(MSTR) | ((bitOrder == LSBFIRST) ? _BV(DORD) : 0) |
| ^~~
/data/cache/platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:157:25: note: in definition of macro '_BV'
157 | #define _BV(b) (1UL << (b))
| ^
src/SPI.h:134:27: error: 'MSTR' was not declared in this scope; did you mean 'PSTR'?
134 | spcr = _BV(SPE) | _BV(MSTR) | ((bitOrder == LSBFIRST) ? _BV(DORD) : 0) |
| ^~~~
/data/cache/platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:157:25: note: in definition of macro '_BV'
157 | #define _BV(b) (1UL << (b))
| ^
src/SPI.h:134:65: error: 'DORD' was not declared in this scope
134 | spcr = _BV(SPE) | _BV(MSTR) | ((bitOrder == LSBFIRST) ? _BV(DORD) : 0) |
| ^~~~
/data/cache/platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:157:25: note: in definition of macro '_BV'
157 | #define _BV(b) (1UL << (b))
| ^
In file included from src/Adafruit_SPIDevice.h:9,
from src/Adafruit_BusIO_Register.h:10,
from src/Adafruit_DS3502.h:23,
from src/Adafruit_DS3502.cpp:37:
src/SPI.h: In static member function 'static void SPIClass::beginTransaction(SPISettings)':
src/SPI.h:168:22: error: 'SREG' was not declared in this scope
168 | uint8_t sreg = SREG;
| ^~~~
In file included from src/Adafruit_BusIO_Register.h:4,
from src/Adafruit_BusIO_Register.cpp:1:
src/SPI.h: In member function 'void SPISettings::init_AlwaysInline(uint32_t, uint8_t, uint8_t)':
src/SPI.h:134:16: error: 'SPE' was not declared in this scope; did you mean 'GPE'?
134 | spcr = _BV(SPE) | _BV(MSTR) | ((bitOrder == LSBFIRST) ? _BV(DORD) : 0) |
| ^~~
/data/cache/platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:157:25: note: in definition of macro '_BV'
157 | #define _BV(b) (1UL << (b))
| ^
src/SPI.h:134:27: error: 'MSTR' was not declared in this scope; did you mean 'PSTR'?
134 | spcr = _BV(SPE) | _BV(MSTR) | ((bitOrder == LSBFIRST) ? _BV(DORD) : 0) |
| ^~~~
/data/cache/platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:157:25: note: in definition of macro '_BV'
157 | #define _BV(b) (1UL << (b))
| ^
src/SPI.h:134:65: error: 'DORD' was not declared in this scope
134 | spcr = _BV(SPE) | _BV(MSTR) | ((bitOrder == LSBFIRST) ? _BV(DORD) : 0) |
| ^~~~
/data/cache/platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:157:25: note: in definition of macro '_BV'
157 | #define _BV(b) (1UL << (b))
| ^
In file included from src/Adafruit_SPIDevice.h:9,
from src/Adafruit_BusIO_Register.h:10,
from src/Adafruit_BusIO_Register.cpp:1:
src/SPI.h: In static member function 'static void SPIClass::beginTransaction(SPISettings)':
src/SPI.h:168:22: error: 'SREG' was not declared in this scope
168 | uint8_t sreg = SREG;
| ^~~~
src/SPI.h:191:5: error: 'SPCR' was not declared in this scope
191 | SPCR = settings.spcr;
| ^~~~
src/SPI.h:192:5: error: 'SPSR' was not declared in this scope; did you mean 'SS'?
192 | SPSR = settings.spsr;
| ^~~~
| SS
src/SPI.h: In static member function 'static uint8_t SPIClass::transfer(uint8_t)':
src/SPI.h:197:5: error: 'SPDR' was not declared in this scope
197 | SPDR = data;
| ^~~~
src/SPI.h:191:5: error: 'SPCR' was not declared in this scope
191 | SPCR = settings.spcr;
| ^~~~
src/SPI.h:192:5: error: 'SPSR' was not declared in this scope; did you mean 'SS'?
192 | SPSR = settings.spsr;
| ^~~~
| SS
src/SPI.h: In static member function 'static uint8_t SPIClass::transfer(uint8_t)':
src/SPI.h:197:5: error: 'SPDR' was not declared in this scope
197 | SPDR = data;
| ^~~~
src/SPI.h:205:14: error: 'SPSR' was not declared in this scope; did you mean 'SS'?
205 | while (!(SPSR & _BV(SPIF))) ; // wait
| ^~~~
| SS
In file included from src/Adafruit_DS3502.cpp:34:
src/SPI.h:205:25: error: 'SPIF' was not declared in this scope
205 | while (!(SPSR & _BV(SPIF))) ; // wait
| ^~~~
/data/cache/platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:157:25: note: in definition of macro '_BV'
157 | #define _BV(b) (1UL << (b))
| ^
In file included from src/Adafruit_SPIDevice.h:9,
from src/Adafruit_BusIO_Register.h:10,
from src/Adafruit_DS3502.h:23,
from src/Adafruit_DS3502.cpp:37:
src/SPI.h: In static member function 'static uint16_t SPIClass::transfer16(uint16_t)':
src/SPI.h:211:11: error: 'SPCR' was not declared in this scope
211 | if (!(SPCR & _BV(DORD))) {
| ^~~~
In file included from src/Adafruit_DS3502.cpp:34:
src/SPI.h:211:22: error: 'DORD' was not declared in this scope
211 | if (!(SPCR & _BV(DORD))) {
| ^~~~
/data/cache/platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:157:25: note: in definition of macro '_BV'
157 | #define _BV(b) (1UL << (b))
| ^
In file included from src/Adafruit_SPIDevice.h:9,
from src/Adafruit_BusIO_Register.h:10,
from src/Adafruit_DS3502.h:23,
from src/Adafruit_DS3502.cpp:37:
src/SPI.h:212:7: error: 'SPDR' was not declared in this scope
212 | SPDR = in.msb;
| ^~~~
src/SPI.h:214:16: error: 'SPSR' was not declared in this scope; did you mean 'SS'?
214 | while (!(SPSR & _BV(SPIF))) ;
| ^~~~
| SS
In file included from src/Adafruit_DS3502.cpp:34:
src/SPI.h:214:27: error: 'SPIF' was not declared in this scope
214 | while (!(SPSR & _BV(SPIF))) ;
| ^~~~
/data/cache/platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:157:25: note: in definition of macro '_BV'
157 | #define _BV(b) (1UL << (b))
| ^
In file included from src/Adafruit_SPIDevice.h:9,
from src/Adafruit_BusIO_Register.h:10,
from src/Adafruit_DS3502.h:23,
from src/Adafruit_DS3502.cpp:37:
src/SPI.h:218:16: error: 'SPSR' was not declared in this scope; did you mean 'SS'?
218 | while (!(SPSR & _BV(SPIF))) ;
| ^~~~
| SS
In file included from src/Adafruit_DS3502.cpp:34:
src/SPI.h:218:27: error: 'SPIF' was not declared in this scope
218 | while (!(SPSR & _BV(SPIF))) ;
| ^~~~
/data/cache/platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:157:25: note: in definition of macro '_BV'
157 | #define _BV(b) (1UL << (b))
| ^
In file included from src/Adafruit_SPIDevice.h:9,
from src/Adafruit_BusIO_Register.h:10,
from src/Adafruit_DS3502.h:23,
from src/Adafruit_DS3502.cpp:37:
src/SPI.h:221:7: error: 'SPDR' was not declared in this scope
221 | SPDR = in.lsb;
| ^~~~
src/SPI.h:223:16: error: 'SPSR' was not declared in this scope; did you mean 'SS'?
223 | while (!(SPSR & _BV(SPIF))) ;
| ^~~~
| SS
In file included from src/Adafruit_DS3502.cpp:34:
src/SPI.h:223:27: error: 'SPIF' was not declared in this scope
223 | while (!(SPSR & _BV(SPIF))) ;
| ^~~~
/data/cache/platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:157:25: note: in definition of macro '_BV'
157 | #define _BV(b) (1UL << (b))
| ^
In file included from src/Adafruit_SPIDevice.h:9,
from src/Adafruit_BusIO_Register.h:10,
from src/Adafruit_DS3502.h:23,
from src/Adafruit_DS3502.cpp:37:
src/SPI.h:227:16: error: 'SPSR' was not declared in this scope; did you mean 'SS'?
227 | while (!(SPSR & _BV(SPIF))) ;
| ^~~~
| SS
In file included from src/Adafruit_DS3502.cpp:34:
src/SPI.h:227:27: error: 'SPIF' was not declared in this scope
227 | while (!(SPSR & _BV(SPIF))) ;
| ^~~~
/data/cache/platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:157:25: note: in definition of macro '_BV'
157 | #define _BV(b) (1UL << (b))
| ^
In file included from src/Adafruit_SPIDevice.h:9,
from src/Adafruit_BusIO_Register.h:10,
from src/Adafruit_DS3502.h:23,
from src/Adafruit_DS3502.cpp:37:
src/SPI.h: In static member function 'static void SPIClass::transfer(void*, size_t)':
src/SPI.h:235:5: error: 'SPDR' was not declared in this scope
235 | SPDR = *p;
| ^~~~
src/SPI.h:238:16: error: 'SPSR' was not declared in this scope; did you mean 'SS'?
238 | while (!(SPSR & _BV(SPIF))) ;
| ^~~~
| SS
src/SPI.h:205:14: error: 'SPSR' was not declared in this scope; did you mean 'SS'?
205 | while (!(SPSR & _BV(SPIF))) ; // wait
| ^~~~
| SS
In file included from src/Adafruit_DS3502.cpp:34:
src/SPI.h:238:27: error: 'SPIF' was not declared in this scope
238 | while (!(SPSR & _BV(SPIF))) ;
| ^~~~
/data/cache/platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:157:25: note: in definition of macro '_BV'
157 | #define _BV(b) (1UL << (b))
| ^
In file included from src/Adafruit_SPIDevice.h:9,
from src/Adafruit_BusIO_Register.h:10,
from src/Adafruit_DS3502.h:23,
from src/Adafruit_DS3502.cpp:37:
src/SPI.h:243:14: error: 'SPSR' was not declared in this scope; did you mean 'SS'?
243 | while (!(SPSR & _BV(SPIF))) ;
| ^~~~
| SS
In file included from src/Adafruit_BusIO_Register.h:4,
from src/Adafruit_BusIO_Register.cpp:1:
src/SPI.h:205:25: error: 'SPIF' was not declared in this scope
205 | while (!(SPSR & _BV(SPIF))) ; // wait
| ^~~~
/data/cache/platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:157:25: note: in definition of macro '_BV'
157 | #define _BV(b) (1UL << (b))
| ^
In file included from src/Adafruit_DS3502.cpp:34:
src/SPI.h:243:25: error: 'SPIF' was not declared in this scope
243 | while (!(SPSR & _BV(SPIF))) ;
| ^~~~
/data/cache/platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:157:25: note: in definition of macro '_BV'
157 | #define _BV(b) (1UL << (b))
| ^
In file included from src/Adafruit_SPIDevice.h:9,
from src/Adafruit_BusIO_Register.h:10,
from src/Adafruit_BusIO_Register.cpp:1:
src/SPI.h: In static member function 'static uint16_t SPIClass::transfer16(uint16_t)':
src/SPI.h:211:11: error: 'SPCR' was not declared in this scope
211 | if (!(SPCR & _BV(DORD))) {
| ^~~~
In file included from src/Adafruit_SPIDevice.h:9,
from src/Adafruit_BusIO_Register.h:10,
from src/Adafruit_DS3502.h:23,
from src/Adafruit_DS3502.cpp:37:
src/SPI.h: In static member function 'static void SPIClass::endTransaction()':
src/SPI.h:269:9: error: 'SREG' was not declared in this scope
269 | SREG = interruptSave;
| ^~~~
In file included from src/Adafruit_BusIO_Register.h:4,
from src/Adafruit_BusIO_Register.cpp:1:
src/SPI.h:211:22: error: 'DORD' was not declared in this scope
211 | if (!(SPCR & _BV(DORD))) {
| ^~~~
/data/cache/platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:157:25: note: in definition of macro '_BV'
157 | #define _BV(b) (1UL << (b))
| ^
src/SPI.h: In static member function 'static void SPIClass::setBitOrder(uint8_t)':
src/SPI.h:280:31: error: 'SPCR' was not declared in this scope
280 | if (bitOrder == LSBFIRST) SPCR |= _BV(DORD);
| ^~~~
In file included from src/Adafruit_SPIDevice.h:9,
from src/Adafruit_BusIO_Register.h:10,
from src/Adafruit_BusIO_Register.cpp:1:
src/SPI.h:212:7: error: 'SPDR' was not declared in this scope
212 | SPDR = in.msb;
| ^~~~
In file included from src/Adafruit_DS3502.cpp:34:
src/SPI.h:280:43: error: 'DORD' was not declared in this scope
280 | if (bitOrder == LSBFIRST) SPCR |= _BV(DORD);
| ^~~~
/data/cache/platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:157:25: note: in definition of macro '_BV'
157 | #define _BV(b) (1UL << (b))
| ^
src/SPI.h:214:16: error: 'SPSR' was not declared in this scope; did you mean 'SS'?
214 | while (!(SPSR & _BV(SPIF))) ;
| ^~~~
| SS
In file included from src/Adafruit_SPIDevice.h:9,
from src/Adafruit_BusIO_Register.h:10,
from src/Adafruit_DS3502.h:23,
from src/Adafruit_DS3502.cpp:37:
src/SPI.h:281:10: error: 'SPCR' was not declared in this scope
281 | else SPCR &= ~(_BV(DORD));
| ^~~~
In file included from src/Adafruit_BusIO_Register.h:4,
from src/Adafruit_BusIO_Register.cpp:1:
src/SPI.h:214:27: error: 'SPIF' was not declared in this scope
214 | while (!(SPSR & _BV(SPIF))) ;
| ^~~~
/data/cache/platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:157:25: note: in definition of macro '_BV'
157 | #define _BV(b) (1UL << (b))
| ^
In file included from src/Adafruit_DS3502.cpp:34:
src/SPI.h:281:24: error: 'DORD' was not declared in this scope
281 | else SPCR &= ~(_BV(DORD));
| ^~~~
/data/cache/platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:157:25: note: in definition of macro '_BV'
157 | #define _BV(b) (1UL << (b))
| ^
In file included from src/Adafruit_SPIDevice.h:9,
from src/Adafruit_BusIO_Register.h:10,
from src/Adafruit_BusIO_Register.cpp:1:
src/SPI.h:218:16: error: 'SPSR' was not declared in this scope; did you mean 'SS'?
218 | while (!(SPSR & _BV(SPIF))) ;
| ^~~~
| SS
In file included from src/Adafruit_SPIDevice.h:9,
from src/Adafruit_BusIO_Register.h:10,
from src/Adafruit_DS3502.h:23,
from src/Adafruit_DS3502.cpp:37:
src/SPI.h: In static member function 'static void SPIClass::setDataMode(uint8_t)':
src/SPI.h:286:5: error: 'SPCR' was not declared in this scope
286 | SPCR = (SPCR & ~SPI_MODE_MASK) | dataMode;
| ^~~~
In file included from src/Adafruit_BusIO_Register.h:4,
from src/Adafruit_BusIO_Register.cpp:1:
src/SPI.h:218:27: error: 'SPIF' was not declared in this scope
218 | while (!(SPSR & _BV(SPIF))) ;
| ^~~~
/data/cache/platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:157:25: note: in definition of macro '_BV'
157 | #define _BV(b) (1UL << (b))
| ^
src/SPI.h: In static member function 'static void SPIClass::setClockDivider(uint8_t)':
src/SPI.h:291:5: error: 'SPCR' was not declared in this scope
291 | SPCR = (SPCR & ~SPI_CLOCK_MASK) | (clockDiv & SPI_CLOCK_MASK);
| ^~~~
In file included from src/Adafruit_SPIDevice.h:9,
from src/Adafruit_BusIO_Register.h:10,
from src/Adafruit_BusIO_Register.cpp:1:
src/SPI.h:221:7: error: 'SPDR' was not declared in this scope
221 | SPDR = in.lsb;
| ^~~~
src/SPI.h:292:5: error: 'SPSR' was not declared in this scope; did you mean 'SS'?
292 | SPSR = (SPSR & ~SPI_2XCLOCK_MASK) | ((clockDiv >> 2) & SPI_2XCLOCK_MASK);
| ^~~~
| SS
src/SPI.h:223:16: error: 'SPSR' was not declared in this scope; did you mean 'SS'?
223 | while (!(SPSR & _BV(SPIF))) ;
| ^~~~
| SS
src/SPI.h: In static member function 'static void SPIClass::attachInterrupt()':
src/SPI.h:297:42: error: 'SPCR' was not declared in this scope
297 | inline static void attachInterrupt() { SPCR |= _BV(SPIE); }
| ^~~~
In file included from src/Adafruit_BusIO_Register.h:4,
from src/Adafruit_BusIO_Register.cpp:1:
src/SPI.h:223:27: error: 'SPIF' was not declared in this scope
223 | while (!(SPSR & _BV(SPIF))) ;
| ^~~~
/data/cache/platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:157:25: note: in definition of macro '_BV'
157 | #define _BV(b) (1UL << (b))
| ^
In file included from src/Adafruit_DS3502.cpp:34:
src/SPI.h:297:54: error: 'SPIE' was not declared in this scope; did you mean 'SPISE'?
297 | inline static void attachInterrupt() { SPCR |= _BV(SPIE); }
| ^~~~
/data/cache/platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:157:25: note: in definition of macro '_BV'
157 | #define _BV(b) (1UL << (b))
| ^
In file included from src/Adafruit_SPIDevice.h:9,
from src/Adafruit_BusIO_Register.h:10,
from src/Adafruit_DS3502.h:23,
from src/Adafruit_DS3502.cpp:37:
src/SPI.h: In static member function 'static void SPIClass::detachInterrupt()':
src/SPI.h:298:42: error: 'SPCR' was not declared in this scope
298 | inline static void detachInterrupt() { SPCR &= ~_BV(SPIE); }
| ^~~~
In file included from src/Adafruit_DS3502.cpp:34:
src/SPI.h:298:55: error: 'SPIE' was not declared in this scope; did you mean 'SPISE'?
298 | inline static void detachInterrupt() { SPCR &= ~_BV(SPIE); }
| ^~~~
/data/cache/platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:157:25: note: in definition of macro '_BV'
157 | #define _BV(b) (1UL << (b))
| ^
In file included from src/Adafruit_SPIDevice.h:9,
from src/Adafruit_BusIO_Register.h:10,
from src/Adafruit_BusIO_Register.cpp:1:
src/SPI.h:227:16: error: 'SPSR' was not declared in this scope; did you mean 'SS'?
227 | while (!(SPSR & _BV(SPIF))) ;
| ^~~~
| SS
In file included from src/Adafruit_BusIO_Register.h:4,
from src/Adafruit_BusIO_Register.cpp:1:
src/SPI.h:227:27: error: 'SPIF' was not declared in this scope
227 | while (!(SPSR & _BV(SPIF))) ;
| ^~~~
/data/cache/platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:157:25: note: in definition of macro '_BV'
157 | #define _BV(b) (1UL << (b))
| ^
In file included from src/Adafruit_SPIDevice.h:9,
from src/Adafruit_BusIO_Register.h:10,
from src/Adafruit_BusIO_Register.cpp:1:
src/SPI.h: In static member function 'static void SPIClass::transfer(void*, size_t)':
src/SPI.h:235:5: error: 'SPDR' was not declared in this scope
235 | SPDR = *p;
| ^~~~
src/SPI.h:238:16: error: 'SPSR' was not declared in this scope; did you mean 'SS'?
238 | while (!(SPSR & _BV(SPIF))) ;
| ^~~~
| SS
In file included from src/Adafruit_BusIO_Register.h:4,
from src/Adafruit_BusIO_Register.cpp:1:
src/SPI.h:238:27: error: 'SPIF' was not declared in this scope
238 | while (!(SPSR & _BV(SPIF))) ;
| ^~~~
/data/cache/platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:157:25: note: in definition of macro '_BV'
157 | #define _BV(b) (1UL << (b))
| ^
In file included from src/Adafruit_SPIDevice.h:9,
from src/Adafruit_BusIO_Register.h:10,
from src/Adafruit_BusIO_Register.cpp:1:
src/SPI.h:243:14: error: 'SPSR' was not declared in this scope; did you mean 'SS'?
243 | while (!(SPSR & _BV(SPIF))) ;
| ^~~~
| SS
In file included from src/Adafruit_BusIO_Register.h:4,
from src/Adafruit_BusIO_Register.cpp:1:
src/SPI.h:243:25: error: 'SPIF' was not declared in this scope
243 | while (!(SPSR & _BV(SPIF))) ;
| ^~~~
/data/cache/platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:157:25: note: in definition of macro '_BV'
157 | #define _BV(b) (1UL << (b))
| ^
In file included from src/Adafruit_SPIDevice.h:9,
from src/Adafruit_BusIO_Register.h:10,
from src/Adafruit_BusIO_Register.cpp:1:
src/SPI.h: In static member function 'static void SPIClass::endTransaction()':
src/SPI.h:269:9: error: 'SREG' was not declared in this scope
269 | SREG = interruptSave;
| ^~~~
src/SPI.h: In static member function 'static void SPIClass::setBitOrder(uint8_t)':
src/SPI.h:280:31: error: 'SPCR' was not declared in this scope
280 | if (bitOrder == LSBFIRST) SPCR |= _BV(DORD);
| ^~~~
In file included from src/Adafruit_BusIO_Register.h:4,
from src/Adafruit_BusIO_Register.cpp:1:
src/SPI.h:280:43: error: 'DORD' was not declared in this scope
280 | if (bitOrder == LSBFIRST) SPCR |= _BV(DORD);
| ^~~~
/data/cache/platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:157:25: note: in definition of macro '_BV'
157 | #define _BV(b) (1UL << (b))
| ^
In file included from src/Adafruit_SPIDevice.h:9,
from src/Adafruit_BusIO_Register.h:10,
from src/Adafruit_BusIO_Register.cpp:1:
src/SPI.h:281:10: error: 'SPCR' was not declared in this scope
281 | else SPCR &= ~(_BV(DORD));
| ^~~~
In file included from src/Adafruit_BusIO_Register.h:4,
from src/Adafruit_BusIO_Register.cpp:1:
src/SPI.h:281:24: error: 'DORD' was not declared in this scope
281 | else SPCR &= ~(_BV(DORD));
| ^~~~
/data/cache/platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:157:25: note: in definition of macro '_BV'
157 | #define _BV(b) (1UL << (b))
| ^
In file included from src/Adafruit_SPIDevice.h:9,
from src/Adafruit_BusIO_Register.h:10,
from src/Adafruit_BusIO_Register.cpp:1:
src/SPI.h: In static member function 'static void SPIClass::setDataMode(uint8_t)':
src/SPI.h:286:5: error: 'SPCR' was not declared in this scope
286 | SPCR = (SPCR & ~SPI_MODE_MASK) | dataMode;
| ^~~~
src/SPI.h: In static member function 'static void SPIClass::setClockDivider(uint8_t)':
src/SPI.h:291:5: error: 'SPCR' was not declared in this scope
291 | SPCR = (SPCR & ~SPI_CLOCK_MASK) | (clockDiv & SPI_CLOCK_MASK);
| ^~~~
src/SPI.h:292:5: error: 'SPSR' was not declared in this scope; did you mean 'SS'?
292 | SPSR = (SPSR & ~SPI_2XCLOCK_MASK) | ((clockDiv >> 2) & SPI_2XCLOCK_MASK);
| ^~~~
| SS
src/SPI.h: In static member function 'static void SPIClass::attachInterrupt()':
src/SPI.h:297:42: error: 'SPCR' was not declared in this scope
297 | inline static void attachInterrupt() { SPCR |= _BV(SPIE); }
| ^~~~
In file included from src/Adafruit_BusIO_Register.h:4,
from src/Adafruit_BusIO_Register.cpp:1:
src/SPI.h:297:54: error: 'SPIE' was not declared in this scope; did you mean 'SPISE'?
297 | inline static void attachInterrupt() { SPCR |= _BV(SPIE); }
| ^~~~
/data/cache/platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:157:25: note: in definition of macro '_BV'
157 | #define _BV(b) (1UL << (b))
| ^
In file included from src/Adafruit_SPIDevice.h:9,
from src/Adafruit_BusIO_Register.h:10,
from src/Adafruit_BusIO_Register.cpp:1:
src/SPI.h: In static member function 'static void SPIClass::detachInterrupt()':
src/SPI.h:298:42: error: 'SPCR' was not declared in this scope
298 | inline static void detachInterrupt() { SPCR &= ~_BV(SPIE); }
| ^~~~
In file included from src/Adafruit_BusIO_Register.h:4,
from src/Adafruit_BusIO_Register.cpp:1:
src/SPI.h:298:55: error: 'SPIE' was not declared in this scope; did you mean 'SPISE'?
298 | inline static void detachInterrupt() { SPCR &= ~_BV(SPIE); }
| ^~~~
/data/cache/platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:157:25: note: in definition of macro '_BV'
157 | #define _BV(b) (1UL << (b))
| ^
*** [/data/esp-pot-test/.pioenvs/esp-pot-test/src/Adafruit_DS3502.cpp.o] Error 1
*** [/data/esp-pot-test/.pioenvs/esp-pot-test/src/Adafruit_BusIO_Register.cpp.o] Error 1
========================= [FAILED] Took 15.15 seconds =========================
My .yaml:
esphome:
name: esp-pot-test
includes:
- custom_component/digital-pot.h
libraries:
- SPI
- Wire
- adafruit/Adafruit BusIO
- adafruit/Adafruit DS3502
esp8266:
board: nodemcuv2
logger:
api:
encryption:
key: "5KCOH3ibAX3TIAk8JqEF0eJrs8dhj7kfF+3mu/W8QbM="
ota:
password: "d3b84b251a871d95a49c00f98159ec6c"
wifi:
networks:
- ssid: !secret wifi-keller_ssid
password: !secret wifi-keller_password
- ssid: !secret wifi_ssid
password: !secret wifi_password
manual_ip:
static_ip: 10.22.22.64
gateway: 10.22.22.1
subnet: 255.255.255.0
ap:
ssid: "esp-pot-fallback"
password: "5H856W6voU5a"
captive_portal:
number: #value to be setted on DS3502
- platform: template
name: "Pot-Position"
id: pot_position
optimistic: true
min_value: 1
max_value: 128
step: 1
custom_component:
- lambda: |-
auto myComponent = new DigitalPotentiometer(id(pot_position));
return {myComponent};
and my .h:
#include "esphome.h"
#include <Adafruit_DS3502.h>
class DigitalPotentiometer : public Component {
public:
Adafruit_DS3502 ds3502 = Adafruit_DS3502();
int pos = 0; //current value between 0 and 127
DigitalPotentiometer(esphome::template_::TemplateNumber *&_pos) {
_pos->add_on_state_callback([this](int newPos) { pos = newPos; });
}
void setup() override {
ds3502.begin();
}
void loop() override {
ds3502.setWiper(pos);
}
};
Any ideas?