changeset 299:91e61d00a6b5 default tip

add AT@BUZ and AT@BZSTOP commands for testing BUZM SWE
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 29 Mar 2022 04:41:25 +0000
parents b1935a9ee04e
children
files src/g23m-aci/aci/ati_cmd.c src/g23m-aci/aci/ati_fcmisc.c
diffstat 2 files changed, 40 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/g23m-aci/aci/ati_cmd.c	Tue Mar 29 04:12:50 2022 +0000
+++ b/src/g23m-aci/aci/ati_cmd.c	Tue Mar 29 04:41:25 2022 +0000
@@ -782,6 +782,10 @@
 #endif
 EXTERN T_ATI_RSLT atPlusIOR (char *cl, UBYTE srcId);
 EXTERN T_ATI_RSLT atPlusIOW (char *cl, UBYTE srcId);
+#ifdef RVM_BUZM_SWE
+EXTERN T_ATI_RSLT atAtBUZ (char *cl, UBYTE srcId);
+EXTERN T_ATI_RSLT atAtBZSTOP (char *cl, UBYTE srcId);
+#endif
 #ifdef RVM_VIBR_SWE
 EXTERN T_ATI_RSLT atAtVIBR (char *cl, UBYTE srcId);
 EXTERN T_ATI_RSLT atAtVIBS (char *cl, UBYTE srcId);
@@ -1261,6 +1265,10 @@
     {"+IOR",	AT_CMD_IOR,      atPlusIOR,	test_gen, 0,	"%s: (0-13)"},
     {"+IOW",	AT_CMD_IOW,      atPlusIOW,	test_gen, 0,
 						"%s: (0-13),(0,1)"},
+#ifdef RVM_BUZM_SWE
+    {"@BUZ",	AT_CMD_AT_BUZ,   atAtBUZ,	0,	0,	0},
+    {"@BZSTOP",	AT_CMD_AT_BZSTOP,atAtBZSTOP,	0,	0,	0},
+#endif
 #ifdef RVM_VIBR_SWE
     {"@VIBR",	AT_CMD_AT_VIBR,  atAtVIBR,	0,	0,	0},
     {"@VIBS",	AT_CMD_AT_VIBS,  atAtVIBS,	0,	0,	0},
--- a/src/g23m-aci/aci/ati_fcmisc.c	Tue Mar 29 04:12:50 2022 +0000
+++ b/src/g23m-aci/aci/ati_fcmisc.c	Tue Mar 29 04:41:25 2022 +0000
@@ -61,6 +61,10 @@
 #include "fc-target.h"
 #include "armio.h"
 
+#ifdef RVM_BUZM_SWE
+#include "buzm/buzm_api.h"
+#endif
+
 #ifdef RVM_VIBR_SWE
 #include "vibr/vibr_api.h"
 #endif
@@ -210,6 +214,34 @@
 	return (ATI_CMPL);
 }
 
+#ifdef RVM_BUZM_SWE
+/* AT@BUZ - play a buzzer melody */
+GLOBAL T_ATI_RSLT atAtBUZ ( char *cl, UBYTE srcId )
+{
+	char melody_name[20];
+	int play_volume = BUZM_VOLUME_MAX;
+	int loopback = 0;
+
+	cl = parse(cl, "Sdd", (LONG)(sizeof(melody_name)), melody_name,
+		   &play_volume, &loopback);
+	if (!cl || !melody_name[0])
+		return (ATI_FAIL);
+	if (buzm_play_melody(melody_name, play_volume, loopback) == RV_OK)
+		return (ATI_CMPL);
+	else
+		return (ATI_FAIL);
+}
+
+/* AT@BZSTOP - stop melody started with AT@BUZ */
+GLOBAL T_ATI_RSLT atAtBZSTOP ( char *cl, UBYTE srcId )
+{
+	if (buzm_stop_melody() == RV_OK)
+		return (ATI_CMPL);
+	else
+		return (ATI_FAIL);
+}
+#endif
+
 #ifdef RVM_VIBR_SWE
 /* AT@VIBR - run the vibrator by way of VIBR SWE */
 GLOBAL T_ATI_RSLT atAtVIBR ( char *cl, UBYTE srcId )