2 * Copyright © 2016 Keith Packard <keithp@keithp.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
18 static uint16_t blink_delay, blink_running;
20 static void blink(void) {
23 ao_led_on(AO_LED_GREEN);
24 ao_delay(blink_delay);
25 ao_led_off(AO_LED_GREEN);
26 ao_delay(blink_delay);
29 ao_wakeup(&blink_running);
33 struct ao_task blink_task;
35 static void blink_cmd() {
37 blink_delay = ao_cmd_lex_i;
38 if (blink_delay && !blink_running)
39 ao_add_task(&blink_task, blink, "blink");
42 ao_sleep(&blink_running);
45 static void lisp_cmd() {
46 ao_lisp_read_eval_print();
49 static const struct ao_cmds blink_cmds[] = {
50 { blink_cmd, "b <delay, 0 off>\0Blink the green LED" },
51 { lisp_cmd, "l\0Run lisp interpreter" },
58 ao_led_init(LEDS_AVAILABLE);
66 ao_cmd_register(blink_cmds);