simple CCS811 driver

Dependencies:   AMS_ENS210_temp_humid_sensor

Dependents:   TBSense2_Sensor_Demo

Fork of AMS_CCS811_gas_sensor by Marcus Lee

Committer:
UHSLMarcus
Date:
Thu Jan 19 14:27:44 2017 +0000
Revision:
4:a6b8881eae87
Parent:
2:e394671ef5f6
Child:
5:41e97348e9e7
starting tests on simple implimentations

Who changed what in which revision?

UserRevisionLine numberNew contents of line
UHSLMarcus 0:5edbf3550350 1 /**
UHSLMarcus 0:5edbf3550350 2 * @author Marcus Lee
UHSLMarcus 0:5edbf3550350 3 *
UHSLMarcus 0:5edbf3550350 4 * @section DESCRIPTION
UHSLMarcus 0:5edbf3550350 5 * A library for the AMS CCS811 digital gas sensor.
UHSLMarcus 0:5edbf3550350 6 *
UHSLMarcus 0:5edbf3550350 7 */
UHSLMarcus 0:5edbf3550350 8 #ifndef AMS_CCS811_H
UHSLMarcus 0:5edbf3550350 9 #define AMS_CCS811_H
UHSLMarcus 0:5edbf3550350 10
UHSLMarcus 0:5edbf3550350 11 #include "mbed.h"
UHSLMarcus 0:5edbf3550350 12
UHSLMarcus 0:5edbf3550350 13 /* Library defaults */
UHSLMarcus 1:acfca1d3256d 14 #define CONFIG_OP_MODE TEN_SECOND // Every 10 seconds
UHSLMarcus 0:5edbf3550350 15 #define CONFIG_INTR 0 // Interupt off
UHSLMarcus 1:acfca1d3256d 16 #define CONFIG_ADDR_DIR 0 // ADDR n_wake_pin pulled low
UHSLMarcus 2:e394671ef5f6 17 #define CONFIG_ENS210_POLL 3000 // ENS210 is polled every 3 seconds
UHSLMarcus 0:5edbf3550350 18
UHSLMarcus 0:5edbf3550350 19 /* Library Constants */
UHSLMarcus 0:5edbf3550350 20 #define SLAVE_ADDR_RAW_H 0x5B
UHSLMarcus 0:5edbf3550350 21 #define SLAVE_ADDR_RAW_L 0x5A
UHSLMarcus 0:5edbf3550350 22 #define SLAVE_ADDR_RAW slave_addr
UHSLMarcus 0:5edbf3550350 23 #define SLAVE_ADDR SLAVE_ADDR_RAW << 1 // 0x86
UHSLMarcus 0:5edbf3550350 24 #define SLAVE_ADDR_W SLAVE_ADDR
UHSLMarcus 0:5edbf3550350 25 #define SLAVE_ADDR_R SLAVE_ADDR | 1 // 0x87
UHSLMarcus 0:5edbf3550350 26
UHSLMarcus 0:5edbf3550350 27 #define SYS_MODE 0x01
UHSLMarcus 0:5edbf3550350 28 #define SYS_STATUS 0x00
UHSLMarcus 0:5edbf3550350 29
UHSLMarcus 0:5edbf3550350 30 #define ALG_DATA 0x02
UHSLMarcus 0:5edbf3550350 31 #define ENV_DATA 0x05
UHSLMarcus 0:5edbf3550350 32 #define ERROR_ID 0xE0
UHSLMarcus 0:5edbf3550350 33
UHSLMarcus 0:5edbf3550350 34 /** The AMS CCS811 class
UHSLMarcus 0:5edbf3550350 35 */
UHSLMarcus 0:5edbf3550350 36 class AMS_CCS811
UHSLMarcus 0:5edbf3550350 37 {
UHSLMarcus 0:5edbf3550350 38 public:
UHSLMarcus 0:5edbf3550350 39 /** Sensor operation modes.
UHSLMarcus 0:5edbf3550350 40 *
UHSLMarcus 0:5edbf3550350 41 */
UHSLMarcus 0:5edbf3550350 42 enum OP_MODES {
UHSLMarcus 0:5edbf3550350 43 IDLE, /**< Measurements disabled */
UHSLMarcus 0:5edbf3550350 44 SECOND, /**< Measurement every second */
UHSLMarcus 0:5edbf3550350 45 TEN_SECOND, /**< Measurement every 10 seconds */
UHSLMarcus 0:5edbf3550350 46 SIXTY_SECOND, /**< Measurement every 60 seconds */
UHSLMarcus 2:e394671ef5f6 47 CONSTANT, /**< Measurement every 250ms - Only raw data available */
UHSLMarcus 2:e394671ef5f6 48 INVALID /**< Invalid bit configuration */
UHSLMarcus 0:5edbf3550350 49 };
UHSLMarcus 0:5edbf3550350 50
UHSLMarcus 0:5edbf3550350 51 /** Data collection status.
UHSLMarcus 0:5edbf3550350 52 *
UHSLMarcus 0:5edbf3550350 53 */
UHSLMarcus 0:5edbf3550350 54 enum DATA_STATUS {
UHSLMarcus 0:5edbf3550350 55 DATA_NOT_READY, /**< No new data */
UHSLMarcus 0:5edbf3550350 56 DATA_READY, /**< New data */
UHSLMarcus 0:5edbf3550350 57 ERROR, /**< Error occurred */
UHSLMarcus 0:5edbf3550350 58 };
UHSLMarcus 0:5edbf3550350 59
UHSLMarcus 0:5edbf3550350 60 /** Create an AMS_CCS811 instance
UHSLMarcus 0:5edbf3550350 61 *
UHSLMarcus 0:5edbf3550350 62 * @param i2c The I2C interface to use for communication
UHSLMarcus 0:5edbf3550350 63 * @param n_wake_pin Pin nWAKE is attached to
UHSLMarcus 0:5edbf3550350 64 */
UHSLMarcus 0:5edbf3550350 65 AMS_CCS811(I2C * i2c, PinName n_wake_pin);
UHSLMarcus 0:5edbf3550350 66
UHSLMarcus 0:5edbf3550350 67 /** Create an AMS_CCS811 instance
UHSLMarcus 0:5edbf3550350 68 *
UHSLMarcus 0:5edbf3550350 69 * @param i2c The I2C interface to use for communication
UHSLMarcus 0:5edbf3550350 70 * @param n_wake_pin Pin nWAKE is attached to
UHSLMarcus 0:5edbf3550350 71 * @param ens210_i2c The I2C interface for an attached AMS_ENS210
UHSLMarcus 0:5edbf3550350 72 */
UHSLMarcus 0:5edbf3550350 73 AMS_CCS811(I2C * i2c, PinName n_wake_pin, I2C * ens210_i2c);
UHSLMarcus 0:5edbf3550350 74
UHSLMarcus 0:5edbf3550350 75 /** Destroy the AMS_CCS811 instance
UHSLMarcus 0:5edbf3550350 76 */
UHSLMarcus 0:5edbf3550350 77 ~AMS_CCS811();
UHSLMarcus 0:5edbf3550350 78
UHSLMarcus 0:5edbf3550350 79 /** Initalise the sensor
UHSLMarcus 0:5edbf3550350 80 *
UHSLMarcus 0:5edbf3550350 81 * @return Intalisation success
UHSLMarcus 0:5edbf3550350 82 */
UHSLMarcus 0:5edbf3550350 83 bool init();
UHSLMarcus 4:a6b8881eae87 84
UHSLMarcus 4:a6b8881eae87 85 /** Set the I2C interface
UHSLMarcus 4:a6b8881eae87 86 *
UHSLMarcus 4:a6b8881eae87 87 * @param i2c The I2C interface to use for communication
UHSLMarcus 4:a6b8881eae87 88 *
UHSLMarcus 4:a6b8881eae87 89 * @return Write success
UHSLMarcus 4:a6b8881eae87 90 */
UHSLMarcus 4:a6b8881eae87 91 void i2c_interface(I2C * i2c);
UHSLMarcus 4:a6b8881eae87 92
UHSLMarcus 4:a6b8881eae87 93 /** Set the ENS210 I2C interface
UHSLMarcus 4:a6b8881eae87 94 *
UHSLMarcus 4:a6b8881eae87 95 * @param i2c The I2C interface for an attached AMS_ENS210
UHSLMarcus 4:a6b8881eae87 96 *
UHSLMarcus 4:a6b8881eae87 97 * @return Write success
UHSLMarcus 4:a6b8881eae87 98 */
UHSLMarcus 4:a6b8881eae87 99 void ens210_i2c_interface(I2C * i2c);
UHSLMarcus 4:a6b8881eae87 100
UHSLMarcus 4:a6b8881eae87 101 /** Set whether the attached AMS_ENS210 is enabled.
UHSLMarcus 4:a6b8881eae87 102 * If an I2C interface is not set for the ENS210, calling this method will have no effect.
UHSLMarcus 4:a6b8881eae87 103 *
UHSLMarcus 4:a6b8881eae87 104 * @param enabled True for enabled, false for disabled
UHSLMarcus 4:a6b8881eae87 105 *
UHSLMarcus 4:a6b8881eae87 106 * @return enabled True for enabled, false for disabled
UHSLMarcus 4:a6b8881eae87 107 */
UHSLMarcus 4:a6b8881eae87 108 bool enable_ens210(bool enable);
UHSLMarcus 4:a6b8881eae87 109
UHSLMarcus 4:a6b8881eae87 110 /** Get whether the attached AMS_ENS210 is enabled.
UHSLMarcus 4:a6b8881eae87 111 *
UHSLMarcus 4:a6b8881eae87 112 * @return enabled True for enabled, false for disabled
UHSLMarcus 4:a6b8881eae87 113 *
UHSLMarcus 4:a6b8881eae87 114 */
UHSLMarcus 4:a6b8881eae87 115 bool ens210_is_enabled();
UHSLMarcus 4:a6b8881eae87 116
UHSLMarcus 4:a6b8881eae87 117 /** Set the AMS_ENS210 poll interval
UHSLMarcus 4:a6b8881eae87 118 *
UHSLMarcus 4:a6b8881eae87 119 * @param poll_ms Poll interval in ms
UHSLMarcus 4:a6b8881eae87 120 *
UHSLMarcus 4:a6b8881eae87 121 */
UHSLMarcus 4:a6b8881eae87 122 void ens210_poll_interval(int poll_ms);
UHSLMarcus 4:a6b8881eae87 123
UHSLMarcus 4:a6b8881eae87 124 /** Get the AMS_ENS210 poll interval
UHSLMarcus 4:a6b8881eae87 125 *
UHSLMarcus 4:a6b8881eae87 126 * @return The poll interval in ms
UHSLMarcus 4:a6b8881eae87 127 */
UHSLMarcus 4:a6b8881eae87 128 int ens210_poll_interval();
UHSLMarcus 0:5edbf3550350 129
UHSLMarcus 0:5edbf3550350 130 /** Set the operation mode \n
UHSLMarcus 0:5edbf3550350 131 * Note: \n When a sensor operating mode is changed to a new mode with\n
UHSLMarcus 0:5edbf3550350 132 * a lower sample rate (e.g.\ from SECOND to SIXTY_SECOND), it should be\n
UHSLMarcus 0:5edbf3550350 133 * placed in IDLE for at least 10 minutes before enabling the new mode.\ \n
UHSLMarcus 0:5edbf3550350 134 * When a sensor operating mode is changed to a new mode with a higher\n
UHSLMarcus 0:5edbf3550350 135 * sample rate (e.g.\ from SIXTY_SECOND to SECOND), there is no requirement\n
UHSLMarcus 0:5edbf3550350 136 * to wait before enabling the new mode.
UHSLMarcus 0:5edbf3550350 137 *
UHSLMarcus 0:5edbf3550350 138 * @param mode OP_MODES mode to set
UHSLMarcus 0:5edbf3550350 139 *
UHSLMarcus 0:5edbf3550350 140 * @return Write success
UHSLMarcus 0:5edbf3550350 141 */
UHSLMarcus 0:5edbf3550350 142 bool mode(OP_MODES mode);
UHSLMarcus 0:5edbf3550350 143
UHSLMarcus 0:5edbf3550350 144 /** Get the current power mode
UHSLMarcus 0:5edbf3550350 145 *
UHSLMarcus 0:5edbf3550350 146 * @return The current OP_MODES mode
UHSLMarcus 0:5edbf3550350 147 */
UHSLMarcus 2:e394671ef5f6 148 AMS_CCS811::OP_MODES mode();
UHSLMarcus 0:5edbf3550350 149
UHSLMarcus 0:5edbf3550350 150 /** Set the ADDR mode \n
UHSLMarcus 0:5edbf3550350 151 *
UHSLMarcus 0:5edbf3550350 152 * @param high True sets to high, false to low
UHSLMarcus 0:5edbf3550350 153 *
UHSLMarcus 0:5edbf3550350 154 * @return Write success
UHSLMarcus 0:5edbf3550350 155 */
UHSLMarcus 0:5edbf3550350 156 bool addr_mode(bool high);
UHSLMarcus 0:5edbf3550350 157
UHSLMarcus 0:5edbf3550350 158 /** Get the the ADDR mode
UHSLMarcus 0:5edbf3550350 159 *
UHSLMarcus 0:5edbf3550350 160 * @return The current ADDR mode, true for high, false for low
UHSLMarcus 0:5edbf3550350 161 */
UHSLMarcus 0:5edbf3550350 162 bool addr_mode();
UHSLMarcus 0:5edbf3550350 163
UHSLMarcus 0:5edbf3550350 164 /** Set the ADDR pin
UHSLMarcus 0:5edbf3550350 165 *
UHSLMarcus 0:5edbf3550350 166 * @param pin Pin ADDR is attached to
UHSLMarcus 0:5edbf3550350 167 *
UHSLMarcus 0:5edbf3550350 168 * @return Write success
UHSLMarcus 0:5edbf3550350 169 */
UHSLMarcus 0:5edbf3550350 170 bool addr_pin(PinName pin);
UHSLMarcus 0:5edbf3550350 171
UHSLMarcus 0:5edbf3550350 172 /** Get the the ADDR pin
UHSLMarcus 0:5edbf3550350 173 *
UHSLMarcus 0:5edbf3550350 174 * @return The addr pin
UHSLMarcus 0:5edbf3550350 175 */
UHSLMarcus 0:5edbf3550350 176 PinName addr_pin();
UHSLMarcus 0:5edbf3550350 177
UHSLMarcus 0:5edbf3550350 178 /** Set the nWAKE pin
UHSLMarcus 0:5edbf3550350 179 *
UHSLMarcus 0:5edbf3550350 180 * @param pin Pin nWAKE is attached to
UHSLMarcus 0:5edbf3550350 181 *
UHSLMarcus 0:5edbf3550350 182 * @return Write success
UHSLMarcus 0:5edbf3550350 183 */
UHSLMarcus 0:5edbf3550350 184 bool n_wake_pin(PinName pin);
UHSLMarcus 0:5edbf3550350 185
UHSLMarcus 0:5edbf3550350 186 /** Get the the nWAKE pin
UHSLMarcus 0:5edbf3550350 187 *
UHSLMarcus 0:5edbf3550350 188 * @return The nWAKE pin
UHSLMarcus 0:5edbf3550350 189 */
UHSLMarcus 0:5edbf3550350 190 PinName n_wake_pin();
UHSLMarcus 0:5edbf3550350 191
UHSLMarcus 0:5edbf3550350 192 /** Set the relative humidity (%) and temperature (C)
UHSLMarcus 0:5edbf3550350 193 * Use when AMS ENS210 is not linked
UHSLMarcus 0:5edbf3550350 194 *
UHSLMarcus 0:5edbf3550350 195 * @return Write success
UHSLMarcus 0:5edbf3550350 196 */
UHSLMarcus 0:5edbf3550350 197 bool env_data(float humid, float temp);
UHSLMarcus 0:5edbf3550350 198
UHSLMarcus 0:5edbf3550350 199 /** Get the sensor collection state
UHSLMarcus 0:5edbf3550350 200 * Use when interupts are disabled
UHSLMarcus 0:5edbf3550350 201 *
UHSLMarcus 0:5edbf3550350 202 * @return Current collection state
UHSLMarcus 0:5edbf3550350 203 */
UHSLMarcus 2:e394671ef5f6 204 AMS_CCS811::DATA_STATUS has_new_data();
UHSLMarcus 0:5edbf3550350 205
UHSLMarcus 0:5edbf3550350 206 /** Get the most recent CO2 measurement.
UHSLMarcus 0:5edbf3550350 207 * Must call has_new_data() first when when interupts are disabled otherwise the same data will be returned
UHSLMarcus 0:5edbf3550350 208 *
UHSLMarcus 0:5edbf3550350 209 * @return Most recent eCO2 measurement in ppm
UHSLMarcus 0:5edbf3550350 210 */
UHSLMarcus 0:5edbf3550350 211 uint16_t co2_read();
UHSLMarcus 0:5edbf3550350 212
UHSLMarcus 0:5edbf3550350 213 /** Get the most recent TVOC measurement.
UHSLMarcus 0:5edbf3550350 214 * Must call has_new_data() first when when interupts are disabled otherwise the same data will be returned
UHSLMarcus 0:5edbf3550350 215 *
UHSLMarcus 0:5edbf3550350 216 * @return Most recent TVOC measurement in ppb
UHSLMarcus 0:5edbf3550350 217 */
UHSLMarcus 0:5edbf3550350 218 uint16_t tvoc_read();
UHSLMarcus 0:5edbf3550350 219
UHSLMarcus 0:5edbf3550350 220 /** Get the most recent RAW data.
UHSLMarcus 0:5edbf3550350 221 * Must call has_new_data() first when when interupts are disabled otherwise the same data will be returned
UHSLMarcus 0:5edbf3550350 222 *
UHSLMarcus 0:5edbf3550350 223 * @return Most recent TVOC measurement in ppb
UHSLMarcus 0:5edbf3550350 224 */
UHSLMarcus 0:5edbf3550350 225 uint16_t raw_read();
UHSLMarcus 0:5edbf3550350 226
UHSLMarcus 0:5edbf3550350 227 /** Get the last error.
UHSLMarcus 0:5edbf3550350 228 * Must call has_new_data() first when when interupts are disabled otherwise the same error will be returned
UHSLMarcus 0:5edbf3550350 229 *
UHSLMarcus 0:5edbf3550350 230 * @return Last error.
UHSLMarcus 0:5edbf3550350 231 */
UHSLMarcus 0:5edbf3550350 232 const char * last_error();
UHSLMarcus 0:5edbf3550350 233
UHSLMarcus 0:5edbf3550350 234 /** Attach a function to be called when data is ready.
UHSLMarcus 0:5edbf3550350 235 * Calling this method enables interupts
UHSLMarcus 0:5edbf3550350 236 *
UHSLMarcus 0:5edbf3550350 237 * @param func_ptr A pointer to the function to be called
UHSLMarcus 0:5edbf3550350 238 * @param pin Pin attached to nINT
UHSLMarcus 0:5edbf3550350 239 *
UHSLMarcus 0:5edbf3550350 240 * @return Attach success
UHSLMarcus 0:5edbf3550350 241 */
UHSLMarcus 0:5edbf3550350 242 bool attach(void (*func_ptr)(void), PinName pin) {
UHSLMarcus 0:5edbf3550350 243 _isr_data_fp.attach(func_ptr);
UHSLMarcus 2:e394671ef5f6 244 interrupt_pin(pin);
UHSLMarcus 1:acfca1d3256d 245 return enable_interupt(true);
UHSLMarcus 0:5edbf3550350 246 }
UHSLMarcus 0:5edbf3550350 247
UHSLMarcus 0:5edbf3550350 248 /** Attach a member function to be called when data is ready.
UHSLMarcus 0:5edbf3550350 249 * Calling this method enables interupts
UHSLMarcus 0:5edbf3550350 250 *
UHSLMarcus 0:5edbf3550350 251 * @param type_ptr A pointer to the instance of the class
UHSLMarcus 0:5edbf3550350 252 * @param mem_ptr A pointer to the member function
UHSLMarcus 0:5edbf3550350 253 * @param pin Pin attached to nINT
UHSLMarcus 0:5edbf3550350 254 *
UHSLMarcus 0:5edbf3550350 255 * @return Attach success
UHSLMarcus 0:5edbf3550350 256 */
UHSLMarcus 0:5edbf3550350 257 template<typename T>
UHSLMarcus 0:5edbf3550350 258 bool attach(T *type_ptr, void (T::*mem_ptr)(void), PinName pin) {
UHSLMarcus 2:e394671ef5f6 259 _isr_data_fp.attach(callback(type_ptr, mem_ptr));
UHSLMarcus 2:e394671ef5f6 260 interrupt_pin(pin);
UHSLMarcus 1:acfca1d3256d 261 return enable_interupt(true);
UHSLMarcus 0:5edbf3550350 262 }
UHSLMarcus 0:5edbf3550350 263
UHSLMarcus 1:acfca1d3256d 264 /** Set whether the data ready interupt is enabled.
UHSLMarcus 1:acfca1d3256d 265 *
UHSLMarcus 1:acfca1d3256d 266 * @param enabled True for enabled, false for disabled
UHSLMarcus 0:5edbf3550350 267 *
UHSLMarcus 0:5edbf3550350 268 * @return Write success
UHSLMarcus 0:5edbf3550350 269 */
UHSLMarcus 1:acfca1d3256d 270 bool enable_interupt(bool enable);
UHSLMarcus 1:acfca1d3256d 271
UHSLMarcus 1:acfca1d3256d 272 /** Get whether the data ready interupt is enabled.
UHSLMarcus 1:acfca1d3256d 273 *
UHSLMarcus 1:acfca1d3256d 274 *
UHSLMarcus 1:acfca1d3256d 275 * @return True for enabled, false for disabled
UHSLMarcus 1:acfca1d3256d 276 */
UHSLMarcus 1:acfca1d3256d 277 bool interupt_enabled();
UHSLMarcus 0:5edbf3550350 278
UHSLMarcus 0:5edbf3550350 279 /** Set the nINT pin
UHSLMarcus 0:5edbf3550350 280 *
UHSLMarcus 0:5edbf3550350 281 * @param pin Pin nINT is attached to
UHSLMarcus 0:5edbf3550350 282 *
UHSLMarcus 0:5edbf3550350 283 * @return Write success
UHSLMarcus 0:5edbf3550350 284 */
UHSLMarcus 0:5edbf3550350 285 bool interrupt_pin(PinName pin);
UHSLMarcus 0:5edbf3550350 286
UHSLMarcus 0:5edbf3550350 287 /** Get the the nINT pin
UHSLMarcus 0:5edbf3550350 288 *
UHSLMarcus 0:5edbf3550350 289 * @return The nINT pin
UHSLMarcus 0:5edbf3550350 290 */
UHSLMarcus 0:5edbf3550350 291 PinName interrupt_pin();
UHSLMarcus 0:5edbf3550350 292
UHSLMarcus 0:5edbf3550350 293
UHSLMarcus 0:5edbf3550350 294
UHSLMarcus 0:5edbf3550350 295
UHSLMarcus 0:5edbf3550350 296 private:
UHSLMarcus 0:5edbf3550350 297 I2C* _i2c;
UHSLMarcus 2:e394671ef5f6 298 I2C* _ens210_i2c;
UHSLMarcus 2:e394671ef5f6 299
UHSLMarcus 1:acfca1d3256d 300 bool _addr_dir;
UHSLMarcus 0:5edbf3550350 301 int slave_addr;
UHSLMarcus 2:e394671ef5f6 302 void update_slave_addr();
UHSLMarcus 2:e394671ef5f6 303
UHSLMarcus 4:a6b8881eae87 304 bool _ens210_enabled;
UHSLMarcus 2:e394671ef5f6 305 int _ens210_poll_split;
UHSLMarcus 4:a6b8881eae87 306 void update_ens210_timer();
UHSLMarcus 4:a6b8881eae87 307 Ticker _ens210_poll_t;
UHSLMarcus 4:a6b8881eae87 308 void ens210_isr();
UHSLMarcus 2:e394671ef5f6 309
UHSLMarcus 0:5edbf3550350 310 OP_MODES _mode;
UHSLMarcus 2:e394671ef5f6 311
UHSLMarcus 1:acfca1d3256d 312 bool set_defaults();
UHSLMarcus 0:5edbf3550350 313
UHSLMarcus 1:acfca1d3256d 314 DigitalOut *_n_wake_out;
UHSLMarcus 1:acfca1d3256d 315 DigitalOut *_addr_out;
UHSLMarcus 0:5edbf3550350 316
UHSLMarcus 0:5edbf3550350 317
UHSLMarcus 0:5edbf3550350 318 FunctionPointer _isr_data_fp;
UHSLMarcus 1:acfca1d3256d 319 bool _int_data_enabled;
UHSLMarcus 1:acfca1d3256d 320 InterruptIn *_int_data;
UHSLMarcus 0:5edbf3550350 321 void _isr_data();
UHSLMarcus 0:5edbf3550350 322
UHSLMarcus 1:acfca1d3256d 323 bool write_config();
UHSLMarcus 1:acfca1d3256d 324
UHSLMarcus 1:acfca1d3256d 325 struct read_config_result {
UHSLMarcus 1:acfca1d3256d 326 bool success;
UHSLMarcus 1:acfca1d3256d 327 uint8_t byte;
UHSLMarcus 2:e394671ef5f6 328 read_config_result() : success(false), byte(0) {}
UHSLMarcus 2:e394671ef5f6 329 };
UHSLMarcus 1:acfca1d3256d 330 read_config_result read_config();
UHSLMarcus 2:e394671ef5f6 331
UHSLMarcus 2:e394671ef5f6 332 int i2c_read(char reg_addr, char* output, int len);
UHSLMarcus 2:e394671ef5f6 333 int i2c_write(char reg_addr, char* input, int len);
UHSLMarcus 0:5edbf3550350 334
UHSLMarcus 0:5edbf3550350 335 };
UHSLMarcus 0:5edbf3550350 336
UHSLMarcus 0:5edbf3550350 337
UHSLMarcus 0:5edbf3550350 338 #endif /* AMS_CCS811_H */