X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=src%2Fcortexelf-v1%2Fao_cortexelf.c;h=1c30cd85dda20a768642261c9a2d826c186ba07f;hp=776530e0c9a9a28c5ee82402656dd0c156d34160;hb=2f87e182d9f0b3c2856f62149371ad70b16148cf;hpb=637d522c6a15b47051103ccc3626be3206a7a2df diff --git a/src/cortexelf-v1/ao_cortexelf.c b/src/cortexelf-v1/ao_cortexelf.c index 776530e0..1c30cd85 100644 --- a/src/cortexelf-v1/ao_cortexelf.c +++ b/src/cortexelf-v1/ao_cortexelf.c @@ -25,6 +25,14 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include struct ao_task ball_task; @@ -141,17 +149,16 @@ ao_fb_init(void) static void ao_video_toggle(void) { - ao_cmd_decimal(); - if (ao_cmd_lex_i) + uint16_t r = ao_cmd_decimal(); + if (r) ao_fb_init(); - ao_vga_enable(ao_cmd_lex_i); + ao_vga_enable(r) } static void ao_ball_toggle(void) { - ao_cmd_decimal(); - ball_enable = ao_cmd_lex_i; + ball_enable = ao_cmd_decimal(); ao_wakeup(&ball_enable); } @@ -180,14 +187,60 @@ ao_console_send(void) } } -__code struct ao_cmds ao_demo_cmds[] = { +static void scheme_cmd() { + ao_scheme_read_eval_print(); +} + +static void +ao_serial_blather(void) +{ + char c; + + while ((c = getchar()) != '~') { + ao_serial1_putchar(c); + ao_serial2_putchar(c); + } +} + +static void +led_cmd(void) +{ + uint8_t start; + uint8_t value; + + start = ao_cmd_decimal(); + value = ao_cmd_hex(); + if (ao_cmd_status != ao_cmd_success) + return; + ao_as1107_write_8(start, value); +} + +const struct ao_cmds ao_demo_cmds[] = { { ao_video_toggle, "V\0Toggle video" }, { ao_ball_toggle, "B\0Toggle ball" }, { ao_ps2_read_keys, "K\0Read keys from keyboard" }, { ao_console_send, "C\0Send data to console, end with ~" }, + { ao_serial_blather, "S\0Blather on serial ports briefly" }, + { scheme_cmd, "l\0Run scheme interpreter" }, + { led_cmd, "L start value\0Show value (byte) at digit start" }, { 0, NULL } }; +static struct ao_task event_task; + +static void +ao_event_loop(void) +{ + for (;;) { + struct ao_event ev; + + ao_event_get(&ev); + printf("type %d uint %d tick %d value %d\n", + ev.type, ev.unit, ev.tick, ev.value); + flush(); + } +} + int main(void) { @@ -205,6 +258,9 @@ main(void) ao_dma_init(); ao_exti_init(); + ao_sdcard_init(); + ao_fat_init(); + ao_ps2_init(); ao_vga_init(); ao_console_init(); @@ -213,9 +269,18 @@ main(void) ao_usb_init(); + ao_button_init(); + + ao_as1107_init(); + ao_matrix_init(); + ao_1802_init(); + + ao_hex_init(); + ao_config_init(); ao_add_task(&ball_task, ao_ball, "ball"); + ao_add_task(&event_task, ao_event_loop, "events"); ao_cmd_register(&ao_demo_cmds[0]); ao_start_scheduler();