cortexelf-v1: Add serialblather command.
authorKeith Packard <keithp@keithp.com>
Sun, 2 Apr 2017 23:22:28 +0000 (16:22 -0700)
committerKeith Packard <keithp@keithp.com>
Sun, 2 Apr 2017 23:22:28 +0000 (16:22 -0700)
This reads from stdin and dumps it to both serial ports until you type ~

Signed-off-by: Keith Packard <keithp@keithp.com>
src/cortexelf-v1/ao_cortexelf.c
src/cortexelf-v1/ao_pins.h

index 1dc0a4be0180fc0d33f8784e9ca1e07abe9d4174..f9be59e835a11e7e78be52493f95f2cefac4b8c6 100644 (file)
@@ -187,11 +187,23 @@ static void lisp_cmd() {
        ao_lisp_read_eval_print();
 }
 
+static void
+ao_serial_blather(void)
+{
+       char c;
+
+       while ((c = getchar()) != '~') {
+               ao_serial1_putchar(c);
+               ao_serial2_putchar(c);
+       }
+}
+
 __code 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" },
        { lisp_cmd, "l\0Run lisp interpreter" },
        { 0, NULL }
 };
index bc8288cfe2bedd929be881d8117f9a199e9073e8..e9c9deb3b67fc7e0048ef1d8a774593a383f9fcd 100644 (file)
@@ -38,7 +38,7 @@
 
 /* Run APB1 at HCLK/1 */
 #define AO_APB1_PRESCALER      1
-#define AO_RCC_CFGR_PPRE1_DIV  STM_RCC_CFGR_PPRE2_DIV_1
+#define AO_RCC_CFGR_PPRE1_DIV  STM_RCC_CFGR_PPRE1_DIV_1
 
 /* Run APB2 at HCLK/1 */
 #define AO_APB2_PRESCALER      1