class to readout the VEML7700 light sensor via i2c

Dependents:   veml7700_tst

Revision:
1:d6eb62dc0a1e
Parent:
0:e71d3ecdd257
diff -r e71d3ecdd257 -r d6eb62dc0a1e veml7700.h
--- a/veml7700.h	Tue Sep 10 11:11:19 2019 +0000
+++ b/veml7700.h	Tue Sep 10 13:33:10 2019 +0000
@@ -12,6 +12,7 @@
  * version 0.21  : just change the name from VEML770 VEML7700
  * version 0.30  : start with error reporting 
  * version 0.42  : more methodes 
+ * version 0.50  : added readout in lux 
  * This file make part of the PeriperalDevice package see repository  
  * https://github.com/wimbeaumont/PeripheralDevices
  *
@@ -21,7 +22,7 @@
  *
  **/
 
-#define VERSION_VEML7700_HDR "0.42"
+#define VERSION_VEML7700_HDR "0.51"
 
 
 class VEML7700 : public virtual getVersion {
@@ -59,11 +60,6 @@
 //  set interrupt enable    
 void set_int_enable( bool int_enable);
 
-// write the gain bits to reg 0 
-void set_gain_bits( u16 gbits ) ;
-// write the integration time  bits to reg 0 
-void set_IntT_bits( u16 InTgbits );
-
 // set the bits for the ALS config register (0) in one write cycle 
 void set_default_als_config ( bool shutdown=false  , bool int_enable=false ,u16 pres=0, u16 integationtime=0, u16 gain =1  );
 
@@ -85,12 +81,22 @@
 void set_gain( float gain );
 void set_integrationtime( int time_ms );
 
-// return convert the value readed from the als register, taking in acount the gain and integration factor in to lux 
-float get_lux_als(void) { return 0;}
+// returns convert  the value readed from the als or white  register, taking in acount the gain and integration time  in to lux 
+// if als   is true  the ALS register is read, else the white register is read 
+// if verify is flase it  doesn't reads the config register assumes the stored gain ant integration time are corrected stored in the program 
+float get_lux(bool als=true  ,bool verify_reg =false );
+
+
 
-float get_lux_white(void) { return 0;}
 // these could be private but could be useful for debugging 
 
+
+// write the gain bits to reg 0 
+void set_gain_bits( u16 gbits ) ;
+// write the integration time  bits to reg 0 
+void set_IntT_bits( u16 InTgbits );
+
+
 // get the gain bits depending on the value of gainsel, setgain <= gainsel  
 // so 0 -> .125 ,  .126 -> .25 ,  4 -> 2  1.1 -> 2 
 u16 get_gain_in_set_bit (float  gainsel );
@@ -101,9 +107,11 @@
 u16 get_bits(u16 regvalue,   u16 lsb ,u16 bsize );
 void set_bits_in_reg ( u8 reg , u16 value, u16 lsb ,u16 bsize ) {  set_bits_reg  ( reg ,  value,  lsb ,bsize ) ;}
 
-float decodeGainBits( u16 gb) ;
-int  decodeIntTbits( u16 ib ) ;    
-void decode_Reg0(  bool& sd ,bool& ie, u16& pers_protect,int& IntT, float& gain  ) ;
+float decodeGainBits( u16 gb , int& gainnr) ;
+float decodeGainBits( u16 gb);
+int  decodeIntTbits( u16 ib, int& InTnr ) ; 
+int  decodeIntTbits( u16 ib);
+u16  decode_Reg0(  bool& sd ,bool& ie, u16& pers_protect,int& IntT, float& gain  ) ;
 
 }; //end class