From d1c2a5729da00be9d393015bbaa2d2f58e936d84 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 20 Feb 2017 17:34:43 -0800 Subject: [PATCH] altos/nucleo-32: Update lisp files, add beeper support Signed-off-by: Keith Packard --- src/nucleao-32/Makefile | 18 ++++++++++-------- src/nucleao-32/ao_nucleo.c | 7 +++++++ src/nucleao-32/ao_pins.h | 7 ++++++- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/nucleao-32/Makefile b/src/nucleao-32/Makefile index 57fb4cde..69049982 100644 --- a/src/nucleao-32/Makefile +++ b/src/nucleao-32/Makefile @@ -27,6 +27,7 @@ ALTOS_SRC = \ ao_config.c \ ao_task.c \ ao_led.c \ + ao_beep_stm.c \ ao_dma_stm.c \ ao_stdio.c \ ao_panic.c \ @@ -35,21 +36,22 @@ ALTOS_SRC = \ ao_usb_stm.c \ ao_serial_stm.c \ ao_flash_stm.c \ - ao_lisp_lex.c \ - ao_lisp_mem.c \ + ao_lisp_atom.c \ + ao_lisp_builtin.c \ ao_lisp_cons.c \ + ao_lisp_error.c \ ao_lisp_eval.c \ - ao_lisp_string.c \ - ao_lisp_atom.c \ + ao_lisp_frame.c \ ao_lisp_int.c \ + ao_lisp_lambda.c \ + ao_lisp_lex.c \ + ao_lisp_mem.c \ ao_lisp_poly.c \ - ao_lisp_builtin.c \ ao_lisp_read.c \ ao_lisp_rep.c \ - ao_lisp_frame.c \ - ao_lisp_error.c \ - ao_lisp_lambda.c \ ao_lisp_save.c \ + ao_lisp_stack.c \ + ao_lisp_string.c \ ao_lisp_os_save.c PRODUCT=Nucleo-32 diff --git a/src/nucleao-32/ao_nucleo.c b/src/nucleao-32/ao_nucleo.c index 3e448865..6b4cbaae 100644 --- a/src/nucleao-32/ao_nucleo.c +++ b/src/nucleao-32/ao_nucleo.c @@ -14,13 +14,19 @@ #include #include +#include static void lisp_cmd() { ao_lisp_read_eval_print(); } +static void beep() { + ao_beep_for(AO_BEEP_MID, AO_MS_TO_TICKS(200)); +} + static const struct ao_cmds blink_cmds[] = { { lisp_cmd, "l\0Run lisp interpreter" }, + { beep, "b\0Beep" }, { 0, 0 } }; @@ -33,6 +39,7 @@ void main(void) ao_dma_init(); ao_usb_init(); ao_serial_init(); + ao_beep_init(); ao_cmd_init(); ao_cmd_register(blink_cmds); ao_start_scheduler(); diff --git a/src/nucleao-32/ao_pins.h b/src/nucleao-32/ao_pins.h index e631db7b..cee4616f 100644 --- a/src/nucleao-32/ao_pins.h +++ b/src/nucleao-32/ao_pins.h @@ -47,7 +47,12 @@ #define HAS_USB 1 #define AO_USB_DIRECTIO 0 #define AO_PA11_PA12_RMP 0 -#define HAS_BEEP 0 +#define HAS_BEEP 1 + +#define BEEPER_TIMER 2 +#define BEEPER_CHANNEL 4 +#define BEEPER_PORT (&stm_gpioa) +#define BEEPER_PIN 3 #define IS_FLASH_LOADER 0 -- 2.30.2