keycard-pro/app/pwr.c

33 lines
478 B
C
Raw Normal View History

2023-08-22 12:37:29 +00:00
#include "pwr.h"
#include "hal.h"
2023-08-22 12:51:15 +00:00
static void pwr_wait_idle() {
//TODO: check that no flash and smartcard communication is active
}
2023-08-22 12:37:29 +00:00
void pwr_reboot() {
2023-08-22 12:51:15 +00:00
pwr_wait_idle();
hal_reboot();
2023-08-22 12:37:29 +00:00
}
void pwr_shutdown() {
2023-08-22 12:51:15 +00:00
pwr_wait_idle();
2023-08-22 12:37:29 +00:00
hal_gpio_set(GPIO_PWR_KILL, GPIO_SET);
}
void pwr_usb_plugged() {
//TODO: start usb
}
void pwr_usb_unplugged() {
//TODO: stop usb
}
void pwr_smartcard_inserted() {
pwr_reboot();
}
void pwr_smartcard_removed() {
pwr_shutdown();
}