Adafruit_BusIO
Adafruit_BusIO copied to clipboard
BusIO library won't build unless a serial device is configured
Adafruit_BusIO_Register.h
contains these prototypes:
void print(Stream *s = &Serial);
void println(Stream *s = &Serial);
If I try to configure my platform without a generic Serial instance, then compilation of the BusIO libraries fails with a 'Serial not declared' error. I feel like these two prototypes (and the implementation in the .cpp
file, of course) should probably be guarded with something so that they're only included if a Serial instance is present, but I don't know what that would be.
(Alternatively, this might be an STM32Duino issue where it's not doing the right thing if you disable the automatic serial port --- please let me know.)
- Arduino board: generic STM32F103 clone
- Arduino IDE version: 2.3.2
- List the steps to reproduce the problem below:
#include <Adafruit_SPIDevice.h>
void setup() {}
void loop() {}
Disable the serial port via the Tools menu, and compile. You get:
In file included from /home/dg/Arduino/libraries/Adafruit_BusIO/Adafruit_BusIO_Register.cpp:1:
/home/dg/Arduino/libraries/Adafruit_BusIO/Adafruit_BusIO_Register.h:75:27: error: 'Serial' was not declared in this scope; did you mean 'Serial3'?
75 | void print(Stream *s = &Serial);
| ^~~~~~
| Serial3
/home/dg/Arduino/libraries/Adafruit_BusIO/Adafruit_BusIO_Register.h:76:29: error: 'Serial' was not declared in this scope; did you mean 'Serial3'?
76 | void println(Stream *s = &Serial);
| ^~~~~~
| Serial3