qmk_sweep_skeletyl/platforms/chibios/suspend.c
Stefan Kerkmann a87c74ebe1
[Bug] Fix non-functional S3 wakeup / resume from suspense (#19780)
* Update ChibiOS-Contrib for USB suspend fixes

* Remove S3 wakup workaround

ChibiOS OTGv1 driver has a remote wakeup bug that prevents the device to
resume it's operation. 02516cbc24647f522eee975e69cc0c8a925470eb 
introduced a hotfix that forcefully restarted the usb driver as a workaround. 
This workaround broke multiple boards which do not use this driver / 
peripheral. With the update of ChibiOS this hotfix is now obsolete.

* Remove restart_usb_driver overrides

they are no longer necessary as the workaround is not needed anymore
for stm32f4

* Remove unused RP_USB_USE_SOF_INTR defines

The SOF interrupt is enabled dynamically by the RP2040 usb driver
2023-06-26 23:55:52 +02:00

56 lines
1.3 KiB
C

/* TODO */
#include <ch.h>
#include <hal.h>
#include "matrix.h"
#include "action.h"
#include "action_util.h"
#include "mousekey.h"
#include "programmable_button.h"
#include "host.h"
#include "suspend.h"
#include "led.h"
#include "wait.h"
/** \brief suspend power down
*
* FIXME: needs doc
*/
void suspend_power_down(void) {
suspend_power_down_quantum();
// on AVR, this enables the watchdog for 15ms (max), and goes to
// SLEEP_MODE_PWR_DOWN
wait_ms(17);
}
/** \brief suspend wakeup condition
*
* run immediately after wakeup
* FIXME: needs doc
*/
void suspend_wakeup_init(void) {
// clear keyboard state
// need to do it manually, because we're running from ISR
// and clear_keyboard() calls print
// so only clear the variables in memory
// the reports will be sent from main.c afterwards
// or if the PC asks for GET_REPORT
clear_mods();
clear_weak_mods();
clear_keys();
#ifdef MOUSEKEY_ENABLE
mousekey_clear();
mousekey_send();
#endif /* MOUSEKEY_ENABLE */
#ifdef PROGRAMMABLE_BUTTON_ENABLE
programmable_button_clear();
#endif /* PROGRAMMABLE_BUTTON_ENABLE */
#ifdef EXTRAKEY_ENABLE
host_system_send(0);
host_consumer_send(0);
#endif /* EXTRAKEY_ENABLE */
suspend_wakeup_init_quantum();
}