I’m porting some code I wrote initially (and is working) on arduino/esp8266. Due to the nature of the chip I’m interfacing with, I’m using the utility/twi.h portion of the Wire library rather than the Arduino-standard Wire class.
This is the minimum non-working code:
#include <Arduino.h>
#include <utility/twi.h>
void setup()
{
twi_init();
twi_stop();
}
void loop()
{
}
Which lints, but generates the following errors:
/var/folders/gw/hhfvl_n52w5dwvtd2c456mgm0000gn/T//cceW9bo6.ltrans0.ltrans.o: In function `main':
cceW9bo6.ltrans0.o:(.text.startup+0x15e): undefined reference to `twi_init()'
cceW9bo6.ltrans0.o:(.text.startup+0x162): undefined reference to `twi_stop()'
The complete build console is here.
Adding #include <Wire.h>
does not change this condition.
My platformio.ini looks like this:
[env:feather32u4]
platform = atmelavr
board = feather32u4
framework = arduino
The minimum working code on esp8266 is this:
#include <Arduino.h>
void setup()
{
twi_init(0,2);
twi_stop();
}
void loop()
{
}
With this platformio.ini:
[env:esp_wroom_02]
platform = espressif8266_stage
framework = arduino
board = esp_wroom_02