EFM32 Giant Gecko Software Documentation  efm32gg-doc-5.1.2
ccs811.h File Reference

Detailed Description

Driver for the Cambridge CMOS Sensors CCS811 gas and indoor air quality sensor.

Version
5.1.1

License

Copyright 2016 Silicon Laboratories, Inc. http://www.silabs.com

This file is licensed under the Silicon Labs License Agreement. See the file "Silabs_License_Agreement.txt" for details. Before using this software for any purpose, you must agree to the terms of that agreement.

Definition in file ccs811.h.

#include <stdbool.h>
#include "ccs811_config.h"

Go to the source code of this file.

Macros

#define CCS811_ADDR_ALG_RESULT_DATA   0x02
 
#define CCS811_ADDR_APP_START   0xF4
 
#define CCS811_ADDR_ENV_DATA   0x05
 
#define CCS811_ADDR_ERR_ID   0xE0
 
#define CCS811_ADDR_FW_APP_VERSION   0x24
 
#define CCS811_ADDR_FW_BOOT_VERSION   0x23
 
#define CCS811_ADDR_FW_ERASE   0xF1
 
#define CCS811_ADDR_FW_PROGRAM   0xF2
 
#define CCS811_ADDR_FW_VERIFY   0xF3
 
#define CCS811_ADDR_HW_ID   0x20
 
#define CCS811_ADDR_HW_VERSION   0x21
 
#define CCS811_ADDR_MEASURE_MODE   0x01
 
#define CCS811_ADDR_NTC   0x06
 
#define CCS811_ADDR_RAW_DATA   0x03
 
#define CCS811_ADDR_STATUS   0x00
 
#define CCS811_ADDR_SW_RESET   0xFF
 
#define CCS811_ADDR_THRESHOLDS   0x10
 
#define CCS811_CONFIG_FIRMWARE_UPDATE   (0)
 
#define CCS811_CONFIG_I2C_BUS_ADDRESS   (0xB4)
 
#define CCS811_CONFIG_I2C_BUS_TIMEOUT   (1000)
 
#define CCS811_CONFIG_I2C_DEVICE   (I2C0)
 
#define CCS811_ERROR_APPLICATION_NOT_PRESENT   0x0001
 
#define CCS811_ERROR_DRIVER_NOT_INITIALIZED   0x0003
 
#define CCS811_ERROR_FIRMWARE_UPDATE_FAILED   0x0006
 
#define CCS811_ERROR_I2C_TRANSACTION_FAILED   0x0004
 
#define CCS811_ERROR_INIT_FAILED   0x0005
 
#define CCS811_ERROR_NOT_IN_APPLICATION_MODE   0x0002
 
#define CCS811_FIRMWARE_UPDATE   (CCS811_CONFIG_FIRMWARE_UPDATE)
 
#define CCS811_HW_ID   0x81
 
#define CCS811_I2C_DEVICE   (CCS811_CONFIG_I2C_DEVICE)
 
#define CCS811_I2C_DEVICE_BUS_ADDRESS   (CCS811_CONFIG_I2C_BUS_ADDRESS)
 
#define CCS811_I2C_DEVICE_BUS_TIMEOUT   (CCS811_CONFIG_I2C_BUS_TIMEOUT)
 
#define CCS811_MEASURE_MODE_DRIVE_MODE_10SEC   0x20
 
#define CCS811_MEASURE_MODE_DRIVE_MODE_1SEC   0x10
 
#define CCS811_MEASURE_MODE_DRIVE_MODE_60SEC   0x30
 
#define CCS811_MEASURE_MODE_DRIVE_MODE_IDLE   0x00
 
#define CCS811_MEASURE_MODE_DRIVE_MODE_RAW   0x40
 
#define CCS811_MEASURE_MODE_DRIVE_MODE_SHIFT   4
 
#define CCS811_MEASURE_MODE_INTERRUPT   0x08
 
#define CCS811_MEASURE_MODE_THRESH   0x04
 
#define CCS811_OK   0x0000
 

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