objc

Data Structures | Typedefs | Functions

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...

Collaboration diagram for Enviro pHAT:

Data Structures

struct  driver_envirophat_t
 Enviro pHAT sensor driver structure. More...
 

Typedefs

typedef struct driver_envirophat_t driver_envirophat_t
 Enviro pHAT sensor driver structure. More...
 

Functions

bool driver_envirophat_init (driver_envirophat_t *driver)
 Initialize a Enviro pHAT driver using the I2C interface. More...
 
void driver_envirophat_finalize (driver_envirophat_t *driver)
 Finalize and release a Enviro pHAT driver. More...
 
void driver_envirophat_set_led (driver_envirophat_t *driver, bool state)
 Set the state of the Enviro pHAT LED. More...
 
bool driver_envirophat_read_color (driver_envirophat_t *driver, driver_tcs3472_rgbc_t *data)
 Read RGBC color data from the TCS3472 sensor. More...
 
bool driver_envirophat_read_accel (driver_envirophat_t *driver, driver_lsm303_vec3_t *data)
 Read accelerometer data from the LSM303 sensor. More...
 
bool driver_envirophat_read_mag (driver_envirophat_t *driver, driver_lsm303_vec3_t *data)
 Read magnetometer data from the LSM303 sensor. More...
 
bool driver_envirophat_read_temp (driver_envirophat_t *driver, float *temp)
 Read temperature from the LSM303 sensor. More...
 
bool driver_envirophat_read_environmental (driver_envirophat_t *driver, driver_bme280_data_t *data)
 Read environmental data from BME280 sensor. More...
 

Detailed Description

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.

Typedef Documentation

◆ 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.

Function Documentation

◆ driver_envirophat_finalize()

void driver_envirophat_finalize ( driver_envirophat_t driver)

Finalize and release a Enviro pHAT driver.

Parameters
driverPointer to the Enviro pHAT driver structure to finalize.

◆ driver_envirophat_init()

bool driver_envirophat_init ( driver_envirophat_t driver)

Initialize a Enviro pHAT driver using the I2C interface.

Parameters
driverPointer 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()

bool driver_envirophat_read_accel ( driver_envirophat_t driver,
driver_lsm303_vec3_t data 
)

Read accelerometer data from the LSM303 sensor.

Parameters
driverPointer to the Enviro pHAT driver structure.
dataPointer to vector structure to receive x, y, z acceleration in g.
Returns
true if read was successful, false otherwise.

◆ driver_envirophat_read_color()

bool driver_envirophat_read_color ( driver_envirophat_t driver,
driver_tcs3472_rgbc_t data 
)

Read RGBC color data from the TCS3472 sensor.

Parameters
driverPointer to the Enviro pHAT driver structure.
dataPointer to structure to receive RGBC data.
Returns
true if read was successful, false otherwise.

◆ driver_envirophat_read_environmental()

bool driver_envirophat_read_environmental ( driver_envirophat_t driver,
driver_bme280_data_t data 
)

Read environmental data from BME280 sensor.

Parameters
driverPointer to the Enviro pHAT driver structure.
dataPointer 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()

bool driver_envirophat_read_mag ( driver_envirophat_t driver,
driver_lsm303_vec3_t data 
)

Read magnetometer data from the LSM303 sensor.

Parameters
driverPointer to the Enviro pHAT driver structure.
dataPointer to vector structure to receive x, y, z magnetic field in gauss.
Returns
true if read was successful, false otherwise.

◆ driver_envirophat_read_temp()

bool driver_envirophat_read_temp ( driver_envirophat_t driver,
float *  temp 
)

Read temperature from the LSM303 sensor.

Parameters
driverPointer to the Enviro pHAT driver structure.
tempPointer to float to receive temperature in degrees Celsius.
Returns
true if read was successful, false otherwise.

◆ driver_envirophat_set_led()

void driver_envirophat_set_led ( driver_envirophat_t driver,
bool  state 
)

Set the state of the Enviro pHAT LED.

Parameters
driverPointer to the Enviro pHAT driver structure.
statetrue to turn the LED on, false to turn it off.