Line 48 commented out
Dependents: UPAS_MicroBLE ENV_NODE_REQUEST_POC ENV_F303K8
Fork of SI1145 by
SI1145.h@8:4511725f06b2, 2015-06-14 (annotated)
- Committer:
- caseyquinn
- Date:
- Sun Jun 14 01:40:33 2015 +0000
- Revision:
- 8:4511725f06b2
- Parent:
- 6:642ece0fad39
again and again
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" |
caseyquinn | 2:4d89a48e6174 | 10 | #define SI1145_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 | */ |
caseyquinn | 2:4d89a48e6174 | 27 | SI1145(PinName sda, PinName sck, char slave_adr = SI1145_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 | */ |
caseyquinn | 2:4d89a48e6174 | 33 | SI1145(I2C &i2c_obj, char slave_adr = SI1145_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 | */ |
caseyquinn | 8:4511725f06b2 | 44 | uint16_t getUV(void); |
ngood | 0:0490a77adbc5 | 45 | /** Read the current VIS value from SI1145 sensor |
ngood | 0:0490a77adbc5 | 46 | */ |
caseyquinn | 8:4511725f06b2 | 47 | uint16_t 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 | */ |
caseyquinn | 8:4511725f06b2 | 52 | uint16_t getIR(void); |
ngood | 0:0490a77adbc5 | 53 | /** Read the current PROX value from SI1145 sensor |
ngood | 0:0490a77adbc5 | 54 | */ |
caseyquinn | 1:8587b5583343 | 55 | uint16_t 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 |