hw functions for the SOLID slow control

Dependents:   S_SCTRL_e_test SPItest sscm

Revision:
11:0416cf017b7a
Parent:
10:1cae1504a800
Child:
12:467def75b457
--- a/S_SCTRL_SM1_hwfunct.cpp	Sun Oct 05 17:11:18 2014 +0000
+++ b/S_SCTRL_SM1_hwfunct.cpp	Tue Oct 14 17:05:20 2014 +0000
@@ -3,7 +3,7 @@
  * ver 1.1x   connectors signal working   
  * ver 1.20   added serialnr read
  * ver 1.22   defined cs lines to inactive in safe settings
- 
+ * ver 1.30   added CAL puls function   
  */
 
 #include "mbed.h"
@@ -11,7 +11,7 @@
 #include "S_SCTRL_SM1_hwfunct.h"
 
 
-#define HW_LIB_SRC_VERSION "1.23"
+#define HW_LIB_SRC_VERSION "1.30"
 
 #define MAXLIBVERCHAR 100  // max char for lib version 
 
@@ -100,7 +100,7 @@
 
 // set the default , save values 
 void setdefault(HWlines hwl ) {
-        for ( int i=0;i<2;i++){
+        for ( int i=0;i<2;i++){  // i == connector
             hwl.msio[i]->input();
             *(hwl.direction[i])=RDIR_IN;
             *(hwl.stio_mo[i])=LDIR_IN;
@@ -113,6 +113,8 @@
             hwl.dac_cs[i]->write(0);
             hwl.dac_rst[i]->write(0);                                               
         }
+        hwl.cal13[0]->write(CAL_DEACTIVE); 
+        hwl.cal24[0]->write(CAL_DEACTIVE);  
         setcalsource(0,hwl); //intern
 }
 
@@ -136,6 +138,25 @@
 
 
 char libversion[MAXLIBVERCHAR]={'e','m','p','t','y','\0'};
+;
+
+void toggle_cal(HWlines  hwl, int calline){
+    if( calline == 0) {
+        hwl.cal13[0]->write(CAL_ACTIVE); //index can be hard coded as it are the same lines) 
+        hwl.cal24[0]->write(CAL_ACTIVE);  
+    }
+    if( calline == 1) {
+        hwl.cal13[0]->write(CAL_ACTIVE); //index can be hard coded as it are the same lines)         
+    }
+    if( calline == 2) {        
+        hwl.cal24[0]->write(CAL_ACTIVE);  
+    }
+    // else we don't do nothing 
+    wait_us(10);
+    hwl.cal13[0]->write(CAL_DEACTIVE); 
+    hwl.cal24[0]->write(CAL_DEACTIVE);  
+    
+}     
 
 
 char*   hwfunct_lib_version(){