Library for using SI1141 sensor

Fork of SI1143 by Guillermo Torijano

Revision:
8:70933bf445af
Parent:
7:f1303b85db58
Child:
9:31d4e955ee92
diff -r f1303b85db58 -r 70933bf445af SI1143.cpp
--- a/SI1143.cpp	Wed May 14 19:01:05 2014 +0000
+++ b/SI1143.cpp	Tue May 20 21:33:31 2014 +0000
@@ -47,16 +47,33 @@
     command(RESET);
     wait_ms(30);
     
-    // Setting up LED Power to full
+    //Do this because you have to
     write_reg(HW_KEY,HW_KEY_VAL0);
+    
+    // Setting up LED Power to FULL JUICE
     write_reg(PS_LED21,0x0F); // Was 0x0A
     write_reg(PS_LED3,0x00);
     //write_reg(PS_LED21,0xAA);
     //write_reg(PS_LED3,0x0A);
-    //write_reg(PARAM_WR, ALS_IR_TASK + ALS_VIS_TASK + PS1_TASK + PS2_TASK + PS3_TASK);
+    
+    //Activate ALS_IR, ALS_VIS, and PS1
     write_reg(PARAM_WR, ALS_IR_TASK + ALS_VIS_TASK + PS1_TASK);
+    //write_reg(PARAM_WR, ALS_IR_TASK + ALS_VIS_TASK + PS1_TASK + PS2_TASK + PS3_TASK);
+    command(PARAM_SET + (CHLIST & 0x1F));
     
-    command(PARAM_SET + (CHLIST & 0x1F));
+    /*
+    // Set PS_RANGE to high signal range
+    write_reg(PARAM_WR, 0x04); // 0x24 for high signal, 0x04 for normal
+    command(PARAM_SET + (PS_ADC_MISC & 0x1F));
+    */
+    //Set PS_ADC_COUNTER to lower time between ADC samples
+    write_reg(PARAM_WR, 0x00);
+    command(PARAM_SET + (PS_ADC_COUNTER & 0x1F));
+    
+    //Turn up the juice on PS ACD GAIN!
+    write_reg(PARAM_WR, 0x04);
+    command(PARAM_SET + (PS_ADC_GAIN & 0x1F));
+    
     
     write_reg(INT_CFG,0);
     write_reg(IRQ_ENABLE,0);
@@ -118,7 +135,8 @@
 void SI1143::bias(int ready, int repeat)
 {
     wait(ready);
-    bias1 = 0; //get_ps1(repeat);
+    //bias1 = get_ps1(repeat);
+    bias1 = 0;
     bias2 = get_ps2(repeat);
     bias3 = get_ps3(repeat);
 }