changeset 562:adae731ae50d

aci3: implemented AT%VBAT command independent of FCHG
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 06 Jan 2019 22:33:33 +0000
parents dc1e0a1c100f
children d648cafa30cf
files src/g23m-aci/aci/aci_cmh.h src/g23m-aci/aci/ati_cmd.c src/g23m-aci/aci/ati_fchg.c
diffstat 3 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/g23m-aci/aci/aci_cmh.h	Sun Jan 06 21:12:51 2019 +0000
+++ b/src/g23m-aci/aci/aci_cmh.h	Sun Jan 06 22:33:33 2019 +0000
@@ -539,6 +539,7 @@
   AT_CMD_AT_VMRS,
   AT_CMD_P_CBC,
   AT_CMD_AT_CHG,
+  AT_CMD_P_VBAT,
   /* terminator */
   AT_CMD_MAX,                  /* maximum command id */
   AT_CMD_BIGGEST = 0x0000ffff  /* To avoid the lint warning 650 */
--- a/src/g23m-aci/aci/ati_cmd.c	Sun Jan 06 21:12:51 2019 +0000
+++ b/src/g23m-aci/aci/ati_cmd.c	Sun Jan 06 22:33:33 2019 +0000
@@ -765,6 +765,7 @@
 EXTERN T_ATI_RSLT atPercentCBC (char *cl, UBYTE srcId);
 EXTERN T_ATI_RSLT atAtCHG (char *cl, UBYTE srcId);
 #endif
+EXTERN T_ATI_RSLT atPercentVBAT (char *cl, UBYTE srcId);
 
 LOCAL const ATCommand_bas cmds_bas[] =
 {
@@ -1224,6 +1225,7 @@
     {"%CBC",	AT_CMD_P_CBC,    atPercentCBC,	0,	0,	0},
     {"@CHG",	AT_CMD_AT_CHG,   atAtCHG,	test_gen, 0,	"%s: (0,1)"},
 #endif
+    {"%VBAT",	AT_CMD_P_VBAT,   atPercentVBAT,	0,	0,	0},
     /* terminator */
     {NULL,AT_CMD_NONE,NULL,NULL,NULL,NULL}
 };
--- a/src/g23m-aci/aci/ati_fchg.c	Sun Jan 06 21:12:51 2019 +0000
+++ b/src/g23m-aci/aci/ati_fchg.c	Sun Jan 06 22:33:33 2019 +0000
@@ -93,4 +93,17 @@
 
 #endif /* RVM_FCHG_SWE */
 
+/* AT%VBAT - retrieve VBAT measurement, independent of FCHG */
+GLOBAL T_ATI_RSLT atPercentVBAT ( char *cl, UBYTE srcId )
+{
+	extern USHORT *csf_return_adc(void);
+	USHORT *adc_conversion;
+
+	TRACE_FUNCTION("atPercentVBAT()");
+	adc_conversion = csf_return_adc();
+	sprintf(g_sa, "%%VBAT: %u", adc_conversion[0]);
+	io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
+	return ATI_CMPL;
+}
+
 #endif /* ATI_FCHG_C */