Less power consumption on suspend.

This commit is contained in:
NIIBE Yutaka
2017-11-17 15:49:56 +09:00
parent 9c63c874d0
commit d54712c04c
5 changed files with 11 additions and 2 deletions

View File

@@ -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>

Submodule chopstx updated: e684e853c8...3071929c62

View File

@@ -41,6 +41,7 @@
#define main emulated_main
#else
#include "mcu/cortex-m.h"
#include "mcu/stm32.h"
#include "mcu/stm32f103.h"
#endif

View File

@@ -23,6 +23,7 @@
*/
#include <stdint.h>
#include "mcu/stm32.h"
#include "mcu/stm32f103.h"
uint8_t *

View File

@@ -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;