Enviro pHAT interface for reading temperature, humidity, pressure, light, and color data using the BME280 and TCS34725 sensors, and LSM303 accelerometer/magnetometer, plus ADS1015 ADC.
More...
Enviro pHAT interface for reading temperature, humidity, pressure, light, and color data using the BME280 and TCS34725 sensors, and LSM303 accelerometer/magnetometer, plus ADS1015 ADC.
◆ driver_envirophat_t
Enviro pHAT sensor driver structure.
This structure contains the configuration and state information for the Enviro pHAT sensor instance, which includes TCS3472 color sensor, LSM303 accelerometer/magnetometer, and BME280 environmental sensor.
◆ driver_envirophat_finalize()
Finalize and release a Enviro pHAT driver.
- Parameters
-
| driver | Pointer to the Enviro pHAT driver structure to finalize. |
◆ driver_envirophat_init()
Initialize a Enviro pHAT driver using the I2C interface.
- Parameters
-
| driver | Pointer to the Enviro pHAT driver structure to initialize. |
- Returns
- true if the initialization was successful, false otherwise.
This function initializes a Enviro pHAT driver.
◆ driver_envirophat_read_accel()
Read accelerometer data from the LSM303 sensor.
- Parameters
-
| driver | Pointer to the Enviro pHAT driver structure. |
| data | Pointer to vector structure to receive x, y, z acceleration in g. |
- Returns
- true if read was successful, false otherwise.
◆ driver_envirophat_read_color()
Read RGBC color data from the TCS3472 sensor.
- Parameters
-
| driver | Pointer to the Enviro pHAT driver structure. |
| data | Pointer to structure to receive RGBC data. |
- Returns
- true if read was successful, false otherwise.
◆ driver_envirophat_read_environmental()
Read environmental data from BME280 sensor.
- Parameters
-
| driver | Pointer to the Enviro pHAT driver structure. |
| data | Pointer to structure to receive temperature, pressure, humidity. |
- Returns
- true if read was successful, false otherwise (sensor not present or read failed).
◆ driver_envirophat_read_mag()
Read magnetometer data from the LSM303 sensor.
- Parameters
-
| driver | Pointer to the Enviro pHAT driver structure. |
| data | Pointer to vector structure to receive x, y, z magnetic field in gauss. |
- Returns
- true if read was successful, false otherwise.
◆ driver_envirophat_read_temp()
Read temperature from the LSM303 sensor.
- Parameters
-
| driver | Pointer to the Enviro pHAT driver structure. |
| temp | Pointer to float to receive temperature in degrees Celsius. |
- Returns
- true if read was successful, false otherwise.
◆ driver_envirophat_set_led()
Set the state of the Enviro pHAT LED.
- Parameters
-
| driver | Pointer to the Enviro pHAT driver structure. |
| state | true to turn the LED on, false to turn it off. |