si1145 library

Dependents:   FRDM_ApplicationShield_GroveSensors

Committer:
brdarji
Date:
Sun Jul 03 08:01:08 2016 +0000
Revision:
10:ba32b0098ee8
Parent:
8:4511725f06b2
si1145 library

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ngood 0:0490a77adbc5 1
ngood 0:0490a77adbc5 2 #include "mbed.h"
caseyquinn 2:4d89a48e6174 3 #define SI1145_ADDRESS (0x60 << 1)
ngood 0:0490a77adbc5 4 extern Serial pc;
ngood 0:0490a77adbc5 5
ngood 0:0490a77adbc5 6 /** SI1145 class
ngood 0:0490a77adbc5 7 * SI1145: A library to correct environmental data using adafruit SI1145 device
ngood 0:0490a77adbc5 8 */
ngood 0:0490a77adbc5 9
ngood 0:0490a77adbc5 10 class SI1145
ngood 0:0490a77adbc5 11 {
ngood 0:0490a77adbc5 12 public:
ngood 0:0490a77adbc5 13
ngood 0:0490a77adbc5 14 /** Create a SI1145 instance
ngood 0:0490a77adbc5 15 * which is connected to specified I2C pins with specified address
ngood 0:0490a77adbc5 16 * @param sda I2C-bus SDA pin
ngood 0:0490a77adbc5 17 * @param scl I2C-bus SCL pin
ngood 0:0490a77adbc5 18 * @param slave_adr (option) I2C-bus address (default: 0x60)
ngood 0:0490a77adbc5 19 */
caseyquinn 2:4d89a48e6174 20 SI1145(PinName sda, PinName sck, char slave_adr = SI1145_ADDRESS);
ngood 0:0490a77adbc5 21 /** Create a SI1145 instance
ngood 0:0490a77adbc5 22 * which is connected to specified I2C pins with specified address
ngood 0:0490a77adbc5 23 * @param i2c_obj I2C object (instance)
ngood 0:0490a77adbc5 24 * @param slave_adr (option) I2C-bus address (default: 0x60)
ngood 0:0490a77adbc5 25 */
caseyquinn 2:4d89a48e6174 26 SI1145(I2C &i2c_obj, char slave_adr = SI1145_ADDRESS);
ngood 0:0490a77adbc5 27 /** Destructor of SI1145
ngood 0:0490a77adbc5 28 */
ngood 0:0490a77adbc5 29 //virtual ~SI1145();
ngood 0:0490a77adbc5 30 /** Initialize SI1145 sensor
ngood 0:0490a77adbc5 31 * Configure sensor setting and read parameters for calibration
ngood 0:0490a77adbc5 32 */
ngood 0:0490a77adbc5 33 void initalize(void);
ngood 0:0490a77adbc5 34 /** Begin Initialization SI1145 sensor
ngood 0:0490a77adbc5 35 * Configure sensor setting and read parameters for calibration
ngood 0:0490a77adbc5 36 */
caseyquinn 8:4511725f06b2 37 uint16_t getUV(void);
ngood 0:0490a77adbc5 38 /** Read the current VIS value from SI1145 sensor
ngood 0:0490a77adbc5 39 */
caseyquinn 8:4511725f06b2 40 uint16_t getVIS(void);
ngood 0:0490a77adbc5 41 float getUVlsb(void);
ngood 0:0490a77adbc5 42 float getUVmsb(void);
ngood 0:0490a77adbc5 43 /** Read the current IR value from SI1145 sensor
ngood 0:0490a77adbc5 44 */
caseyquinn 8:4511725f06b2 45 uint16_t getIR(void);
ngood 0:0490a77adbc5 46 /** Read the current PROX value from SI1145 sensor
ngood 0:0490a77adbc5 47 */
caseyquinn 1:8587b5583343 48 uint16_t getPROX(void);
ngood 0:0490a77adbc5 49
ngood 0:0490a77adbc5 50 private:
ngood 0:0490a77adbc5 51
ngood 0:0490a77adbc5 52 I2C *i2c_p;
ngood 0:0490a77adbc5 53 I2C &i2c;
ngood 0:0490a77adbc5 54 char address;
ngood 0:0490a77adbc5 55 int32_t t_fine;
ngood 0:0490a77adbc5 56 };
ngood 0:0490a77adbc5 57