30 lines
458 B
C
30 lines
458 B
C
#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;
|
|
}
|