Line 48 commented out
Dependents: UPAS_MicroBLE ENV_NODE_REQUEST_POC ENV_F303K8
Fork of SI1145 by
SI1145.h@0:0490a77adbc5, 2015-05-20 (annotated)
- Committer:
- ngood
- Date:
- Wed May 20 03:49:03 2015 +0000
- Revision:
- 0:0490a77adbc5
- Child:
- 1:8587b5583343
update
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ngood | 0:0490a77adbc5 | 1 | /** |
ngood | 0:0490a77adbc5 | 2 | * SI1145 Digital UV Index / IR / Visible Light Sensor library |
ngood | 0:0490a77adbc5 | 3 | * @author N Good |
ngood | 0:0490a77adbc5 | 4 | * @date 5-May-2015 |
ngood | 0:0490a77adbc5 | 5 | * Library for "SI1145 Digital UV Index / IR / Visible Light Sensor" from adafruit |
ngood | 0:0490a77adbc5 | 6 | * https://www.adafruit.com/products/1777 |
ngood | 0:0490a77adbc5 | 7 | */ |
ngood | 0:0490a77adbc5 | 8 | |
ngood | 0:0490a77adbc5 | 9 | #include "mbed.h" |
ngood | 0:0490a77adbc5 | 10 | #define SLAVE_ADDRESS (0x60 << 1) |
ngood | 0:0490a77adbc5 | 11 | extern Serial pc; |
ngood | 0:0490a77adbc5 | 12 | |
ngood | 0:0490a77adbc5 | 13 | /** SI1145 class |
ngood | 0:0490a77adbc5 | 14 | * SI1145: A library to correct environmental data using adafruit SI1145 device |
ngood | 0:0490a77adbc5 | 15 | */ |
ngood | 0:0490a77adbc5 | 16 | |
ngood | 0:0490a77adbc5 | 17 | class SI1145 |
ngood | 0:0490a77adbc5 | 18 | { |
ngood | 0:0490a77adbc5 | 19 | public: |
ngood | 0:0490a77adbc5 | 20 | |
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 sda I2C-bus SDA pin |
ngood | 0:0490a77adbc5 | 24 | * @param scl I2C-bus SCL pin |
ngood | 0:0490a77adbc5 | 25 | * @param slave_adr (option) I2C-bus address (default: 0x60) |
ngood | 0:0490a77adbc5 | 26 | */ |
ngood | 0:0490a77adbc5 | 27 | SI1145(PinName sda, PinName sck, char slave_adr = SLAVE_ADDRESS); |
ngood | 0:0490a77adbc5 | 28 | /** Create a SI1145 instance |
ngood | 0:0490a77adbc5 | 29 | * which is connected to specified I2C pins with specified address |
ngood | 0:0490a77adbc5 | 30 | * @param i2c_obj I2C object (instance) |
ngood | 0:0490a77adbc5 | 31 | * @param slave_adr (option) I2C-bus address (default: 0x60) |
ngood | 0:0490a77adbc5 | 32 | */ |
ngood | 0:0490a77adbc5 | 33 | SI1145(I2C &i2c_obj, char slave_adr = SLAVE_ADDRESS); |
ngood | 0:0490a77adbc5 | 34 | /** Destructor of SI1145 |
ngood | 0:0490a77adbc5 | 35 | */ |
ngood | 0:0490a77adbc5 | 36 | //virtual ~SI1145(); |
ngood | 0:0490a77adbc5 | 37 | /** Initialize SI1145 sensor |
ngood | 0:0490a77adbc5 | 38 | * Configure sensor setting and read parameters for calibration |
ngood | 0:0490a77adbc5 | 39 | */ |
ngood | 0:0490a77adbc5 | 40 | void initalize(void); |
ngood | 0:0490a77adbc5 | 41 | /** Begin Initialization SI1145 sensor |
ngood | 0:0490a77adbc5 | 42 | * Configure sensor setting and read parameters for calibration |
ngood | 0:0490a77adbc5 | 43 | */ |
ngood | 0:0490a77adbc5 | 44 | float getUV(void); |
ngood | 0:0490a77adbc5 | 45 | /** Read the current VIS value from SI1145 sensor |
ngood | 0:0490a77adbc5 | 46 | */ |
ngood | 0:0490a77adbc5 | 47 | float getVIS(void); |
ngood | 0:0490a77adbc5 | 48 | float getUVlsb(void); |
ngood | 0:0490a77adbc5 | 49 | float getUVmsb(void); |
ngood | 0:0490a77adbc5 | 50 | /** Read the current IR value from SI1145 sensor |
ngood | 0:0490a77adbc5 | 51 | */ |
ngood | 0:0490a77adbc5 | 52 | float getIR(void); |
ngood | 0:0490a77adbc5 | 53 | /** Read the current PROX value from SI1145 sensor |
ngood | 0:0490a77adbc5 | 54 | */ |
ngood | 0:0490a77adbc5 | 55 | float getPROX(void); |
ngood | 0:0490a77adbc5 | 56 | |
ngood | 0:0490a77adbc5 | 57 | private: |
ngood | 0:0490a77adbc5 | 58 | |
ngood | 0:0490a77adbc5 | 59 | I2C *i2c_p; |
ngood | 0:0490a77adbc5 | 60 | I2C &i2c; |
ngood | 0:0490a77adbc5 | 61 | char address; |
ngood | 0:0490a77adbc5 | 62 | int32_t t_fine; |
ngood | 0:0490a77adbc5 | 63 | }; |
ngood | 0:0490a77adbc5 | 64 |