For a project we first used an Arduino Leonardo and now we have built our own.
For the tests we are working on the sparkfun promicro board (https://www.sparkfun.com/products/12640).
Our problem deal with the USB functionalities. We want to put the atmega in eco power mode and wake it up by an external interruption or by the interrupt vector of the usb.
But when i set the VBUSTE bit of the USBCON register the atmel isn't recognized any more by the computer, and the flag VBUS doesn't rise ( Full_Bat_Warn() doesn't launch).
Here the main part of the program:
Init_io(); // Input and output setup
Init_PWM();//Init for the battery charge
strip.show(); // Initialize all pixels to 'off'
USBCON |= _BV(VBUSTE);
delay(1000); //delay for connect via USB before sleep_mode()
static char mode = OFF_MODE;
Update_Motion_Flag = 0;
Shake = Detect_Motion(&motion);
case OFF_MODE :
mode = NORMAL_MODE;
case CHARGE_MODE :
case LOW_B_MODE :
case NORMAL_MODE :
mode = OFF_MODE;
mode = Launch_Normal();
/* The program will continue from here. */
/* First thing to do is disable sleep. */