EFM32 Gecko Software Documentation
efm32g-doc-5.1.2
|
CCS811 driver and support functions.
Functions | |
uint32_t | CCS811_deInit (void) |
De-initializes the chip. More... | |
void | CCS811_dumpRegisters (void) |
Dumps the registers of the CSS811. More... | |
uint32_t | CCS811_getHardwareID (uint8_t *hardwareID) |
Reads Hardware ID from the CSS811 sensor. More... | |
uint32_t | CCS811_getMeasurement (uint16_t *eco2, uint16_t *tvoc) |
Reads measurement data (eCO2 and TVOC) from the CSS811 sensor. More... | |
uint32_t | CCS811_getRawData (uint16_t *current, uint16_t *rawData) |
Gets the latest readings from the sense resistor of the CSS811 sensor. More... | |
uint32_t | CCS811_getStatus (uint8_t *status) |
Reads the status of the CSS811 sensor. More... | |
uint32_t | CCS811_init (void) |
Initializes the chip and performs firmware upgrade if required. More... | |
bool | CCS811_isDataAvailable (void) |
Checks if new measurement data available. More... | |
uint32_t | CCS811_readMailbox (uint8_t id, uint8_t length, uint8_t *data) |
Reads data from a specific Mailbox address. More... | |
uint32_t | CCS811_setEnvData (int32_t tempData, uint32_t rhData) |
Writes temperature and humidity values to the environmental data regs. More... | |
uint32_t | CCS811_setMeasureMode (uint8_t measMode) |
Sets the measurement mode of the CSS811 sensor. More... | |
uint32_t | CCS811_softwareReset (void) |
Performs software reset on the CCS811. More... | |
uint32_t | CCS811_startApplication (void) |
Switches the CSS811 chip from boot to application mode. More... | |
uint32_t CCS811_deInit | ( | void | ) |
De-initializes the chip.
Definition at line 106 of file ccs811.c.
References BOARD_gasSensorEnable(), BOARD_gasSensorWake(), and CCS811_OK.
void CCS811_dumpRegisters | ( | void | ) |
Dumps the registers of the CSS811.
Definition at line 193 of file ccs811.c.
References CCS811_ADDR_ALG_RESULT_DATA, CCS811_ADDR_ENV_DATA, CCS811_ADDR_ERR_ID, CCS811_ADDR_FW_APP_VERSION, CCS811_ADDR_FW_BOOT_VERSION, CCS811_ADDR_HW_ID, CCS811_ADDR_HW_VERSION, CCS811_ADDR_MEASURE_MODE, CCS811_ADDR_NTC, CCS811_ADDR_RAW_DATA, CCS811_ADDR_STATUS, CCS811_ADDR_THRESHOLDS, and CCS811_readMailbox().
uint32_t CCS811_getHardwareID | ( | uint8_t * | hardwareID | ) |
Reads Hardware ID from the CSS811 sensor.
[out] | hardwareID | The Hardware ID of the chip (should be 0x81) |
Definition at line 127 of file ccs811.c.
References CCS811_ADDR_HW_ID, and CCS811_readMailbox().
Referenced by CCS811_init().
uint32_t CCS811_getMeasurement | ( | uint16_t * | eco2, |
uint16_t * | tvoc | ||
) |
Reads measurement data (eCO2 and TVOC) from the CSS811 sensor.
[out] | eco2 | The eCO2 level read from the sensor |
[out] | tvoc | The TVOC level read from the sensor |
Definition at line 339 of file ccs811.c.
References I2C_TransferSeq_TypeDef::addr, BOARD_gasSensorWake(), I2C_TransferSeq_TypeDef::buf, CCS811_ADDR_ALG_RESULT_DATA, CCS811_ERROR_I2C_TRANSACTION_FAILED, CCS811_I2C_DEVICE, CCS811_I2C_DEVICE_BUS_ADDRESS, CCS811_OK, I2C_TransferSeq_TypeDef::data, I2C_TransferSeq_TypeDef::flags, I2C_FLAG_WRITE_READ, I2CSPM_Transfer(), i2cTransferDone, and I2C_TransferSeq_TypeDef::len.
uint32_t CCS811_getRawData | ( | uint16_t * | current, |
uint16_t * | rawData | ||
) |
Gets the latest readings from the sense resistor of the CSS811 sensor.
[out] | current | The value of current through the sensor |
[out] | rawData | The raw ADC reading of the voltage across the sensor with the selected current |
Definition at line 394 of file ccs811.c.
References I2C_TransferSeq_TypeDef::addr, BOARD_gasSensorWake(), I2C_TransferSeq_TypeDef::buf, CCS811_ADDR_RAW_DATA, CCS811_ERROR_I2C_TRANSACTION_FAILED, CCS811_I2C_DEVICE, CCS811_I2C_DEVICE_BUS_ADDRESS, CCS811_OK, I2C_TransferSeq_TypeDef::data, I2C_TransferSeq_TypeDef::flags, I2C_FLAG_WRITE_READ, I2CSPM_Transfer(), i2cTransferDone, and I2C_TransferSeq_TypeDef::len.
uint32_t CCS811_getStatus | ( | uint8_t * | status | ) |
Reads the status of the CSS811 sensor.
[out] | status | The content of the CSS811 Status Register |
Definition at line 148 of file ccs811.c.
References CCS811_ADDR_STATUS, and CCS811_readMailbox().
Referenced by CCS811_isDataAvailable().
uint32_t CCS811_init | ( | void | ) |
Initializes the chip and performs firmware upgrade if required.
DO_NOT_INCLUDE_WITH_DOXYGEN
Definition at line 67 of file ccs811.c.
References BOARD_gasSensorEnable(), BOARD_gasSensorWake(), CCS811_ERROR_INIT_FAILED, CCS811_getHardwareID(), CCS811_HW_ID, CCS811_OK, and UTIL_delay().
bool CCS811_isDataAvailable | ( | void | ) |
Checks if new measurement data available.
Definition at line 166 of file ccs811.c.
References CCS811_getStatus(), and CCS811_OK.
uint32_t CCS811_readMailbox | ( | uint8_t | id, |
uint8_t | length, | ||
uint8_t * | data | ||
) |
Reads data from a specific Mailbox address.
[in] | id | The address of the Mailbox register |
[in] | length | The number of bytes to read |
[out] | data | The data read from the sensor |
Definition at line 290 of file ccs811.c.
References I2C_TransferSeq_TypeDef::addr, BOARD_gasSensorWake(), I2C_TransferSeq_TypeDef::buf, CCS811_ERROR_I2C_TRANSACTION_FAILED, CCS811_I2C_DEVICE, CCS811_I2C_DEVICE_BUS_ADDRESS, CCS811_OK, I2C_TransferSeq_TypeDef::data, I2C_TransferSeq_TypeDef::flags, I2C_FLAG_WRITE_READ, I2CSPM_Transfer(), i2cTransferDone, and I2C_TransferSeq_TypeDef::len.
Referenced by CCS811_dumpRegisters(), CCS811_getHardwareID(), CCS811_getStatus(), and CCS811_startApplication().
uint32_t CCS811_setEnvData | ( | int32_t | tempData, |
uint32_t | rhData | ||
) |
Writes temperature and humidity values to the environmental data regs.
[in] | tempData | The environmental temperature in milli-Celsius |
[in] | rhData | The relative humidity in milli-percent |
Definition at line 942 of file ccs811.c.
References I2C_TransferSeq_TypeDef::addr, BOARD_gasSensorWake(), I2C_TransferSeq_TypeDef::buf, CCS811_ADDR_ENV_DATA, CCS811_ERROR_I2C_TRANSACTION_FAILED, CCS811_I2C_DEVICE, CCS811_I2C_DEVICE_BUS_ADDRESS, CCS811_OK, I2C_TransferSeq_TypeDef::data, I2C_TransferSeq_TypeDef::flags, I2C_FLAG_WRITE, I2CSPM_Transfer(), i2cTransferDone, and I2C_TransferSeq_TypeDef::len.
uint32_t CCS811_setMeasureMode | ( | uint8_t | measMode | ) |
Sets the measurement mode of the CSS811 sensor.
[in] | measMode | The desired measurement mode |
Definition at line 492 of file ccs811.c.
References I2C_TransferSeq_TypeDef::addr, BOARD_gasSensorWake(), I2C_TransferSeq_TypeDef::buf, CCS811_ADDR_MEASURE_MODE, CCS811_ERROR_I2C_TRANSACTION_FAILED, CCS811_I2C_DEVICE, CCS811_I2C_DEVICE_BUS_ADDRESS, CCS811_OK, I2C_TransferSeq_TypeDef::data, I2C_TransferSeq_TypeDef::flags, I2C_FLAG_WRITE, I2CSPM_Transfer(), i2cTransferDone, and I2C_TransferSeq_TypeDef::len.
uint32_t CCS811_softwareReset | ( | void | ) |
Performs software reset on the CCS811.
Definition at line 443 of file ccs811.c.
References I2C_TransferSeq_TypeDef::addr, BOARD_gasSensorWake(), I2C_TransferSeq_TypeDef::buf, CCS811_ADDR_SW_RESET, CCS811_ERROR_I2C_TRANSACTION_FAILED, CCS811_I2C_DEVICE, CCS811_I2C_DEVICE_BUS_ADDRESS, CCS811_OK, I2C_TransferSeq_TypeDef::data, I2C_TransferSeq_TypeDef::flags, I2C_FLAG_WRITE, I2CSPM_Transfer(), i2cTransferDone, and I2C_TransferSeq_TypeDef::len.
uint32_t CCS811_startApplication | ( | void | ) |
Switches the CSS811 chip from boot to application mode.
Definition at line 245 of file ccs811.c.
References CCS811_ADDR_STATUS, CCS811_ERROR_APPLICATION_NOT_PRESENT, CCS811_ERROR_NOT_IN_APPLICATION_MODE, and CCS811_readMailbox().