Enable SLEEP_LED on ATmega32A (#8531)

* Port over some AVR backlight logic to SLEEP_LED

* Port over some AVR backlight logic to SLEEP_LED - add timer 3

* Port over some AVR backlight logic to SLEEP_LED - clang format

* Enable SLEEP_LED within vusb protocol
This commit is contained in:
Joel Challis
2020-03-26 18:21:33 +00:00
committed by GitHub
parent c077300e19
commit 23e942ae4e
2 changed files with 44 additions and 9 deletions

View File

@ -20,6 +20,9 @@
#include "timer.h"
#include "uart.h"
#include "debug.h"
#ifdef SLEEP_LED_ENABLE
# include "sleep_led.h"
#endif
#define UART_BAUD_RATE 115200
@ -59,6 +62,9 @@ int main(void) {
initForUsbConnectivity();
keyboard_init();
#ifdef SLEEP_LED_ENABLE
sleep_led_init();
#endif
debug("main loop\n");
while (1) {
@ -67,10 +73,16 @@ int main(void) {
suspended = false;
usbSofCount = 0;
last_timer = timer_read();
# ifdef SLEEP_LED_ENABLE
sleep_led_disable();
# endif
} else {
// Suspend when no SOF in 3ms-10ms(7.1.7.4 Suspending of USB1.1)
if (timer_elapsed(last_timer) > 5) {
suspended = true;
# ifdef SLEEP_LED_ENABLE
sleep_led_enable();
# endif
/*
uart_putchar('S');
_delay_ms(1);