keycard-pro/app/pwr.c

35 lines
515 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
2023-08-29 06:49:51 +00:00
hal_usb_start();
2023-08-22 12:37:29 +00:00
}
void pwr_usb_unplugged() {
//TODO: stop usb
2023-08-29 06:49:51 +00:00
hal_usb_stop();
2023-08-22 12:37:29 +00:00
}
void pwr_smartcard_inserted() {
pwr_reboot();
}
void pwr_smartcard_removed() {
pwr_shutdown();
}