diff src/g23m-aci/aci/ati_fcmisc.c @ 296:a927f030a4e0

add AT@VIBR and AT@VIBS commands for testing VIBR SWE
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 28 Mar 2022 00:43:11 +0000
parents fa8dc04885d8
children 91e61d00a6b5
line wrap: on
line diff
--- a/src/g23m-aci/aci/ati_fcmisc.c	Sun Mar 27 19:44:08 2022 +0000
+++ b/src/g23m-aci/aci/ati_fcmisc.c	Mon Mar 28 00:43:11 2022 +0000
@@ -56,10 +56,15 @@
 
 #endif /*FF_ATI_BAT*/
 
+#include "rv/rv_defined_swe.h"     /* for RVM_BUZM_SWE and RVM_VIBR_SWE */
 #include "main/sys_types.h"
 #include "fc-target.h"
 #include "armio.h"
 
+#ifdef RVM_VIBR_SWE
+#include "vibr/vibr_api.h"
+#endif
+
 extern SYS_UWORD8 SIM_allow_speed_enhancement;
 
 /* AT@SPENH - enable or disable SIM speed enhancement */
@@ -205,4 +210,30 @@
 	return (ATI_CMPL);
 }
 
+#ifdef RVM_VIBR_SWE
+/* AT@VIBR - run the vibrator by way of VIBR SWE */
+GLOBAL T_ATI_RSLT atAtVIBR ( char *cl, UBYTE srcId )
+{
+	int num_pulses = VIBR_INFINITE;
+	int vibr_level = VIBR_LEVEL_MAX;
+
+	cl = parse(cl, "dd", &num_pulses, &vibr_level);
+	if (!cl)
+		return (ATI_FAIL);
+	if (vibr_pulse_train_start(num_pulses, vibr_level) == RV_OK)
+		return (ATI_CMPL);
+	else
+		return (ATI_FAIL);
+}
+
+/* AT@VIBS - stop vibration that was started with AT@VIBR */
+GLOBAL T_ATI_RSLT atAtVIBS ( char *cl, UBYTE srcId )
+{
+	if (vibr_pulse_train_stop() == RV_OK)
+		return (ATI_CMPL);
+	else
+		return (ATI_FAIL);
+}
+#endif
+
 #endif /* ATI_FCMISC_C */