Fork

Dependencies:   mbed libscpi

Revision:
31:0475756cede6
Parent:
30:b463e1f3cae3
--- a/scpi-def.cpp	Thu Jun 10 12:45:11 2021 +0000
+++ b/scpi-def.cpp	Thu Jun 10 13:29:48 2021 +0000
@@ -113,6 +113,30 @@
     return SCPI_RES_OK;
 }
 
+scpi_result_t write_word(scpi_t* context)
+{
+    int address = 0;
+    int value = 0;
+  
+    /* read first parameter: address */
+    if (!SCPI_ParamInt(context, &address, TRUE)) {
+        return SCPI_RES_ERR;
+    }
+    
+    /* read first parameter: address */
+    if (!SCPI_ParamInt(context, &value, TRUE)) {
+        return SCPI_RES_ERR;
+    }
+    
+    if((address >= 0x1000) && (address < 0x1200)) {
+        address = (address - 0x1000) / 2;
+        i2c.i2c_word_write_simple(address, value);
+    } else {
+        i2c.i2c_word_write_interpreter(address, value);
+    }   
+    return SCPI_RES_OK;
+}
+
 
 /**
  * Reimplement IEEE488.2 *TST?
@@ -166,9 +190,12 @@
     /* DMM */
     {"TARGet:DUTYcycle", set_duty, 0},
     {"TARGet:DUTYcycle?", get_duty, 0},
+    {"TARGet:SPEED", set_duty, 0},
+    {"TARGet:SPEED?", get_duty, 0},
     {"LED1", set_led1, 0},
     {"LED1?", get_led1, 0},
     {"MEMory:WORD?", read_word, 0},
+    {"MEMory:WORD", write_word, 0},
     
 
     SCPI_CMD_LIST_END