xrocusOS_ADXL355 version

Dependencies:   mbed SDFileSystem

Revision:
17:c2709a9c0a68
Parent:
13:7cda5bef6390
Child:
19:36072b9b79f3
--- a/event.cpp	Thu May 30 03:00:15 2019 +0000
+++ b/event.cpp	Mon Jun 10 23:50:04 2019 +0000
@@ -23,6 +23,7 @@
 static int checkRunStatHandler(CommandParser *pC, char *arg, int exarg);
 static int setRepeatCountHandler(CommandParser *pC, char *arg, int exarg);
 static int setRepeatStrideHandler(CommandParser *pC, char *arg, int exarg);
+static int setRepeatSingleShotMode(CommandParser *pC, char *arg, int exarg);
 
 /* Event Hankder */
 CmdParseRule rules[] = {
@@ -47,6 +48,7 @@
     {"CPS", checkRunStatHandler, 0},    /* Check ReadyToRun */
     {"RRP", setRepeatCountHandler, 0},  /* set repeat setting => Count */
     {"RMC", setRepeatStrideHandler, 0}, /* set repeat setting => Stride */
+    {"RSH", setRepeatSingleShotMode, 0}, /* set repeat setting => SingleShot */
     /* Device Control */
     {"SRS", softResetHanlder, 0},     /* TODO: Software Reset */
     {"CID", configIDHandler, 0},      /* Config ID Access */
@@ -136,6 +138,29 @@
     return 0;    
 }
 
+static int setRepeatSingleShotMode(CommandParser *pC, char *arg, int exarg)
+{
+    bool setMode = true;
+    bool success;
+    if (strcmp("SET1", arg) == 0) {
+        setMode = true;
+    } else if (strcmp("CLR0", arg) == 0) {
+        setMode = false;
+    } else {
+        /* INVALID COMMAND */
+        pC->reply(false, 7);
+        return 1;        
+    }
+    success = pDevRept->setRepeatSingleShot(setMode);
+    if (success != true) {
+        /* INVALID COMMAND in SetMode */
+        pC->reply(false, 5);
+        return 1;        
+    }
+    pC->reply();
+    return 0;
+}
+
 /****************************************************/
 /* Event Handlers (Device Control) */
 /****************************************************/