hw functions for the SOLID slow control

Dependents:   S_SCTRL_e_test SPItest sscm

Revision:
14:ee02872b282b
Parent:
11:0416cf017b7a
Child:
15:2cf8211a3870
--- a/DEIMOS32.h	Wed Nov 19 23:17:57 2014 +0000
+++ b/DEIMOS32.h	Sun Dec 07 22:38:07 2014 +0000
@@ -1,6 +1,16 @@
 #ifndef DEIMOS32_H
 #define DEIMOS32_H
 
+/*
+ * class related to DEIMOS specific operationt
+     
+ * v0.10  initial development 
+ * v1.00  added  class, only setHV 
+ 
+*/ 
+
+
+#include "AD5384.h"
 #define DEIMOSHDRVER 1.00
 
 // BIAS channel nr in the layout so have to subtract 1 to control the channel
@@ -11,4 +21,34 @@
 #define  DACCAL3CH  35
 #define  DACCAL4CH  36
 
+#define HVmin 60   
+#define DVmax 4.5  // max volt out of the DAC 
+class Deimos32  {
+    float HVnom;
+    u32 serialnr;
+    u8 con;
+    AD5384* dac; // 
+    public:
+        // init
+        // volt  the value of the HV source 
+        // connectornr : the connector the DEIMOS is conneted to
+        // dacdev to witch DAC device the channel is connected 
+        Deimos32( float volt, u8 connectornr,AD5384* dacdev  ){        
+            serialnr=2000; con=connectornr;
+            HVnom=volt; // can not be initialized now because need two parameters for the command            
+        }
+        
+        float   setHV(float volt) {
+            if (HVnom < HVmin ) return -2;
+            float dv=HVnom-volt;
+            if (dv > DVmax  || dv < 0  ) return -3;
+            dac->set_volt(DACBIASCH , dv);
+            return 0;
+        } 
+        float getHv(){
+            if (HVnom < HVmin ) return -2;
+            return HVnom - dac->get_volt(DACBIASCH);
+        }
+        
+    };
 #endif 
\ No newline at end of file