Source code for the Trusted Boot Module.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
tbm-mcu/source/shell/alarm.c

30 lines
458 B

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <libopencm3/stm32/gpio.h>
#include <console.h>
#include <rtc.h>
int shell_alarm(struct console *con, size_t argc, const char **argv)
{
int state = 0;
uint32_t timeout = 10;
(void)con;
if (argc >= 2)
timeout = strtoul(argv[0], NULL, 0);
if (argc >= 1)
state = (strcmp(argv[1], "on") == 0);
if (state) {
alarm_enable(timeout);
} else {
alarm_disable();
}
return 0;
}