Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of LG by
Diff: DeviceUserEncoder.c
- Revision:
- 186:c7a9c309086c
- Parent:
- 184:2bd8ec44998f
--- a/DeviceUserEncoder.c	Sun Jul 10 05:35:08 2016 +0000
+++ b/DeviceUserEncoder.c	Sun Jul 31 06:19:02 2016 +0000
@@ -26,7 +26,7 @@
         return;
     }
 
-    switch(device.user.response.code){
+    switch(device.user.response.code){ //TODO: switch(device.user.response.code & 0xff00) { case group: switch (device.user.response.code & 0x00ff) { case cmd: ...}...}
       case DEV_MODE: EncodeDeviceMode(); break;
       case DELTA_BINS: EncodeDeltaBINS(); break;
       case DELTA_PS: EncodeDeltaPS(); break;
@@ -40,8 +40,9 @@
       case M0_CTL_A_M: EncodeMCtlAM(); break;
       case M0_CTL_B_M: EncodeMCtlBM(); break;
       case M0_CNT_R: EncodeMCntR(); break;
-      case M0_GPH_W: EncodeStart(); EncodeAddress(); Encode8(M0_GPH_W >> 8); Encode8(0); EncodeCRC(); break;
+      case M0_GPH_W: EncodeStart(); EncodeAddress(); Encode8(0xe6); Encode8(0); EncodeCRC(); break;
       case H_PARAM8_W:
+      case H_PARAM8_R:
       case H_PARAM16_W:
       case H_PARAM16_R:
       case H_PARAM32_W:
@@ -162,12 +163,14 @@
       param = (uint8_t)param16;
       break;
     case 2:
+      //ISACS output
+      param16 = var_HF_reg();
       //Hi byte of ISACS output
-      param = 0;
+      param = (uint8_t)(param16 >> 8);
       break;
     case 3:
       //Lo byte of ISACS output
-      param = 0;
+      param = (uint8_t)param16;
     break;
     case 4:
       //T_Vibro Dither drive period
@@ -189,9 +192,10 @@
       //Lo byte of dither pulse width
       param = (uint8_t)param16;
       break;
-    //Hi byte of PLCS output
     case 8:
-      param16 = (uint16_t)device.controller.SSP.out[1];
+      //PLCS output
+      param16 = var_WP_reg();
+      //Hi byte of PLCS output
       param = (uint8_t)(param16 >> 8);
       break;
     //Lo byte of PLCS output
@@ -294,13 +298,13 @@
   //Encode negative meander latched counter data
   Encode16((int16_t)device.counters.meander.state.b);
   //Encode accumulated meander latched counters difference
-  Encode16(countersGetRateAngle());
+  Encode16(var_Cnt_Dif());
   //Encode output frequency
   Encode16(var_F_ras());
   //Encode ISACS output
-  Encode16((uint16_t)device.controller.SSP.out[0]);
+  Encode16(var_HF_reg());
   //Encode ISACS error
-  Encode16((int16_t)device.isacs.regulator.state.error);
+  Encode16(var_HF_dif());
   //Encode dither divider
   Encode16(var_T_Vibro());
   //Encode dither phase detector output
@@ -310,9 +314,9 @@
   //Encode unused
   Encode16(0);
   //Encode PLCS output
-  Encode16((uint16_t)device.controller.SSP.out[1]);
+  Encode16(var_WP_reg());
   //Encode PLCS error
-  Encode16((int16_t)device.plcs.regulator.state.error);
+  Encode16(var_WP_pll());
   //Encode unused
   Encode16(0); //T0
   //Encode unused
    