duff2013 / Snooze

Teensy Low Power Library
MIT License
134 stars 37 forks source link

Error compiling on board Teensy LC with RAW_HID #105

Open fbarbero opened 3 years ago

fbarbero commented 3 years ago

On Arduino 1.8.16 with Snooze v6.3.9 on the following config image

I only need SnoozeDigital driver and don't need USBSerial sleep functionality. It would be nice to have #include to not use other drivers like Touch, USBSerial or 5vBuffer.

Simple test project

#include <Snooze.h>
// Load drivers
SnoozeDigital digital;

int mode = 0;
// install drivers to a SnoozeBlock
SnoozeBlock config(digital);

void setup() 
{
Serial.begin(9600);
pinMode(LED_BUILTIN, OUTPUT);
Serial.println("Start");
digital.pinMode(6, INPUT_PULLUP, RISING);//pin, mode, type
digitalWrite(LED_BUILTIN, HIGH);
}

void loop() 
{
if (mode == 0)
{
  Snooze.deepSleep( config );// return module that woke processor
  mode = 1;
}
digitalWrite(LED_BUILTIN, HIGH);
delay(100);
digitalWrite(LED_BUILTIN, LOW);
delay(100);
digitalWrite(LED_BUILTIN, HIGH);
delay(200);
digitalWrite(LED_BUILTIN, LOW);
delay(500);
}

Here's the compile error

"C:\\Program Files (x86)\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -c -Os --specs=nano.specs -g -Wall -ffunction-sections -fdata-sections -nostdlib -mno-unaligned-access -MMD -fno-exceptions -fpermissive -felide-constructors -std=gnu++14 -Wno-error=narrowing -fno-rtti -mthumb -mcpu=cortex-m0plus -fsingle-precision-constant -D__MKL26Z64__ -DTEENSYDUINO=155 -DARDUINO=10816 -DARDUINO_TEENSYLC -DF_CPU=24000000 -DUSB_RAWHID -DLAYOUT_US_ENGLISH "-IF:\\Users\\Ferdie\\AppData\\Local\\Temp\\arduino_build_669291/pch" "-IC:\\Program Files (x86)\\Arduino\\hardware\\teensy\\avr\\cores\\teensy3" "-IC:\\Program Files (x86)\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src" "F:\\Users\\Ferdie\\AppData\\Local\\Temp\\arduino_build_669291\\sketch\\TestSleep.ino.cpp" -o "F:\\Users\\Ferdie\\AppData\\Local\\Temp\\arduino_build_669291\\sketch\\TestSleep.ino.cpp.o"
In file included from C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Snooze\src/hal/TEENSY_LC/hal.h:46:0,
                 from C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Snooze\src/Snooze.h:37,
                 from D:\Arduino\Projects\TestSleep\TestSleep.ino:1:
C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Snooze\src/hal/TEENSY_LC/SnoozeUSBSerial.h: In member function 'SnoozeUSBSerial::operator bool()':
C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Snooze\src/hal/TEENSY_LC/SnoozeUSBSerial.h:59:39: error: 'usb_cdc_line_rtsdtr' was not declared in this scope
         return usb_configuration && ( usb_cdc_line_rtsdtr & USB_SERIAL_DTR ) && ( ( uint32_t )( systick_millis_count - usb_cdc_line_rtsdtr_millis ) >= 15 );
                                       ^
C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Snooze\src/hal/TEENSY_LC/SnoozeUSBSerial.h:59:61: error: 'USB_SERIAL_DTR' was not declared in this scope
         return usb_configuration && ( usb_cdc_line_rtsdtr & USB_SERIAL_DTR ) && ( ( uint32_t )( systick_millis_count - usb_cdc_line_rtsdtr_millis ) >= 15 );
                                                             ^
C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Snooze\src/hal/TEENSY_LC/SnoozeUSBSerial.h:59:120: error: 'usb_cdc_line_rtsdtr_millis' was not declared in this scope
         return usb_configuration && ( usb_cdc_line_rtsdtr & USB_SERIAL_DTR ) && ( ( uint32_t )( systick_millis_count - usb_cdc_line_rtsdtr_millis ) >= 15 );
                                                                                                                        ^
Using library Snooze at version 6.3.8 in folder: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Snooze 
Error compiling for board Teensy LC.
fbarbero commented 3 years ago

I was able to get around this by commenting out #include "SnoozeUSBSerial.h" (and SnoozeTouch as well) in hal.h and then removing the cpp from hal\TEENSY_LC folder.