Less power consumption on suspend.
This commit is contained in:
@@ -8,7 +8,8 @@
|
||||
* src/main.c (main): Call chopstx_conf_idle.
|
||||
|
||||
* src/usb-ccid.c (usb_event_handle): Use 2 for call of
|
||||
chopstx_conf_idle on suspend.
|
||||
chopstx_conf_idle on suspend. Call random_fini on suspend
|
||||
to stop ADC module. Call random_init on wakeup.
|
||||
|
||||
2017-11-16 NIIBE Yutaka <gniibe@fsij.org>
|
||||
|
||||
|
||||
2
chopstx
2
chopstx
Submodule chopstx updated: e684e853c8...3071929c62
@@ -41,6 +41,7 @@
|
||||
#define main emulated_main
|
||||
#else
|
||||
#include "mcu/cortex-m.h"
|
||||
#include "mcu/stm32.h"
|
||||
#include "mcu/stm32f103.h"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include "mcu/stm32.h"
|
||||
#include "mcu/stm32f103.h"
|
||||
|
||||
uint8_t *
|
||||
|
||||
@@ -1558,6 +1558,10 @@ extern int usb_get_status_interface (struct usb_dev *dev);
|
||||
|
||||
extern int usb_get_descriptor (struct usb_dev *dev);
|
||||
|
||||
extern void random_init (void);
|
||||
extern void random_fini (void);
|
||||
|
||||
|
||||
/*
|
||||
* Return 0 for normal USB event
|
||||
* -1 for USB reset
|
||||
@@ -1649,12 +1653,14 @@ usb_event_handle (struct usb_dev *dev)
|
||||
|
||||
case USB_EVENT_DEVICE_SUSPEND:
|
||||
led_blink (LED_OFF);
|
||||
random_fini ();
|
||||
chopstx_conf_idle (2);
|
||||
bDeviceState |= USB_DEVICE_STATE_SUSPEND;
|
||||
break;
|
||||
|
||||
case USB_EVENT_DEVICE_WAKEUP:
|
||||
chopstx_conf_idle (1);
|
||||
random_init ();
|
||||
bDeviceState &= ~USB_DEVICE_STATE_SUSPEND;
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user