arduino-libraries / ArduinoLowPower

Powersave features for SAMD boards
GNU Lesser General Public License v2.1
80 stars 57 forks source link

Boards without SERIAL_PORT_USBVIRTUAL #32

Open maxholgasson opened 3 years ago

maxholgasson commented 3 years ago

When using a SAMD21 on a custom pcb without a USB connector and commented out (//#define SERIAL_PORT_USBVIRTUAL SerialUSB) in variant.h there appears an error.

Would it be possible to add a check whether it's defined in variant.h or not?

Error message: ArduinoLowPower-master/src/samd/ArduinoLowPower.cpp:41:6: error: 'SERIAL_PORT_USBVIRTUAL' was not declared in this scope if (SERIAL_PORT_USBVIRTUAL) {

facchinm commented 3 years ago

Hi @maxholgasson , the right approach to remove USB from a SAMD board is adding this line to its boards.txt entry: <board>.build.usb_flags= It removes all USB initialization code too. Then, the bug you reported is real, so if you could send a PR I'd be glad to merge it (to preserve attribution)