AmbiMate Sensor Module
AMBIMATE_MS4.h@3:891e0af7da10, 2021-06-03 (annotated)
- Committer:
- mcm
- Date:
- Thu Jun 03 18:04:59 2021 +0000
- Revision:
- 3:891e0af7da10
- Parent:
- 2:6c5fac3dfd44
The driver was completed and tested (NUCLEO-L152RE), it works as expected.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mcm | 0:8d9328d3ff35 | 1 | /** |
mcm | 0:8d9328d3ff35 | 2 | * @brief AMBIMATE_MS4.h |
mcm | 0:8d9328d3ff35 | 3 | * @details AmbiMate Sensor Module. |
mcm | 0:8d9328d3ff35 | 4 | * Header file. |
mcm | 0:8d9328d3ff35 | 5 | * |
mcm | 0:8d9328d3ff35 | 6 | * |
mcm | 1:f0711d344f71 | 7 | * @return N/A |
mcm | 0:8d9328d3ff35 | 8 | * |
mcm | 0:8d9328d3ff35 | 9 | * @author Manuel Caballero |
mcm | 0:8d9328d3ff35 | 10 | * @date 03/June/2021 |
mcm | 0:8d9328d3ff35 | 11 | * @version 03/June/2021 The ORIGIN |
mcm | 0:8d9328d3ff35 | 12 | * @pre N/A. |
mcm | 0:8d9328d3ff35 | 13 | * @warning N/A |
mcm | 0:8d9328d3ff35 | 14 | * @pre This code belongs to AqueronteBlog ( http://unbarquero.blogspot.com ). |
mcm | 0:8d9328d3ff35 | 15 | */ |
mcm | 0:8d9328d3ff35 | 16 | #ifndef AMBIMATE_MS4_H |
mcm | 0:8d9328d3ff35 | 17 | #define AMBIMATE_MS4_H |
mcm | 0:8d9328d3ff35 | 18 | |
mcm | 0:8d9328d3ff35 | 19 | #include "mbed.h" |
mcm | 0:8d9328d3ff35 | 20 | |
mcm | 0:8d9328d3ff35 | 21 | |
mcm | 0:8d9328d3ff35 | 22 | /** |
mcm | 0:8d9328d3ff35 | 23 | Example: |
mcm | 0:8d9328d3ff35 | 24 | @code |
mcm | 3:891e0af7da10 | 25 | #include "mbed.h" |
mcm | 3:891e0af7da10 | 26 | #include "AMBIMATE_MS4.h" |
mcm | 0:8d9328d3ff35 | 27 | |
mcm | 3:891e0af7da10 | 28 | AMBIMATE_MS4 myAMBIMATE_MS4 ( I2C_SDA, I2C_SCL, AMBIMATE_MS4::AMBIMATE_MS4_ADDRESS, 100000 ); // I2C_SDA | I2C_SCL |
mcm | 3:891e0af7da10 | 29 | Serial pc ( USBTX, USBRX ); // tx, rx |
mcm | 3:891e0af7da10 | 30 | |
mcm | 3:891e0af7da10 | 31 | DigitalOut myled ( LED1 ); |
mcm | 3:891e0af7da10 | 32 | Ticker newAction; |
mcm | 3:891e0af7da10 | 33 | |
mcm | 3:891e0af7da10 | 34 | |
mcm | 3:891e0af7da10 | 35 | //@brief Constants. |
mcm | 3:891e0af7da10 | 36 | |
mcm | 3:891e0af7da10 | 37 | |
mcm | 3:891e0af7da10 | 38 | //@brief Variables. |
mcm | 3:891e0af7da10 | 39 | volatile uint32_t myState; // State that indicates when to perform a new sample |
mcm | 3:891e0af7da10 | 40 | |
mcm | 3:891e0af7da10 | 41 | |
mcm | 3:891e0af7da10 | 42 | //@brief FUNCTION PROTOTYPES |
mcm | 3:891e0af7da10 | 43 | void changeDATA ( void ); |
mcm | 3:891e0af7da10 | 44 | |
mcm | 3:891e0af7da10 | 45 | |
mcm | 3:891e0af7da10 | 46 | //@brief FUNCTION FOR APPLICATION MAIN ENTRY. |
mcm | 3:891e0af7da10 | 47 | int main() |
mcm | 3:891e0af7da10 | 48 | { |
mcm | 3:891e0af7da10 | 49 | AMBIMATE_MS4::AMBIMATE_MS4_status_t aux; |
mcm | 3:891e0af7da10 | 50 | AMBIMATE_MS4::AMBIMATE_MS4_data_t myAMBIMATE_MS4_Data; |
mcm | 3:891e0af7da10 | 51 | |
mcm | 3:891e0af7da10 | 52 | pc.baud ( 115200 ); |
mcm | 3:891e0af7da10 | 53 | |
mcm | 3:891e0af7da10 | 54 | myled = 1; |
mcm | 3:891e0af7da10 | 55 | wait(3); |
mcm | 3:891e0af7da10 | 56 | myled = 0; |
mcm | 3:891e0af7da10 | 57 | |
mcm | 3:891e0af7da10 | 58 | // Get the firmware version |
mcm | 3:891e0af7da10 | 59 | aux = myAMBIMATE_MS4.AMBIMATE_MS4_GetFirmwareVersion ( &myAMBIMATE_MS4_Data.info.firmware_version ); |
mcm | 3:891e0af7da10 | 60 | |
mcm | 3:891e0af7da10 | 61 | // Get the firmware sub-version |
mcm | 3:891e0af7da10 | 62 | aux = myAMBIMATE_MS4.AMBIMATE_MS4_GetFirmwareSubVersion ( &myAMBIMATE_MS4_Data.info.firmware_sub_version ); |
mcm | 3:891e0af7da10 | 63 | |
mcm | 3:891e0af7da10 | 64 | // Get the optional sensors on the board |
mcm | 3:891e0af7da10 | 65 | aux = myAMBIMATE_MS4.AMBIMATE_MS4_GetOptionalSensorsByte ( &myAMBIMATE_MS4_Data.info.optional_sensors ); |
mcm | 3:891e0af7da10 | 66 | |
mcm | 3:891e0af7da10 | 67 | pc.printf ( "FW version: %d | FW subversion: %d | Optional sensors: %d\r\n", myAMBIMATE_MS4_Data.info.firmware_version,myAMBIMATE_MS4_Data.info.firmware_sub_version, myAMBIMATE_MS4_Data.info.optional_sensors ); |
mcm | 3:891e0af7da10 | 68 | |
mcm | 3:891e0af7da10 | 69 | |
mcm | 3:891e0af7da10 | 70 | myState = 0UL; // Reset the variable |
mcm | 3:891e0af7da10 | 71 | newAction.attach( &changeDATA, 5U ); // the address of the function to be attached ( changeDATA ) and the interval ( 5s ) |
mcm | 3:891e0af7da10 | 72 | |
mcm | 3:891e0af7da10 | 73 | // Let the callbacks take care of everything |
mcm | 3:891e0af7da10 | 74 | while(1) { |
mcm | 3:891e0af7da10 | 75 | sleep(); |
mcm | 3:891e0af7da10 | 76 | |
mcm | 3:891e0af7da10 | 77 | if ( myState == 1UL ) { |
mcm | 3:891e0af7da10 | 78 | myled = 1U; |
mcm | 3:891e0af7da10 | 79 | |
mcm | 3:891e0af7da10 | 80 | aux = myAMBIMATE_MS4.AMBIMATE_MS4_ScanStartByte ( AMBIMATE_MS4::WRITEABLE_REGISTERS_GAS_INITIATE_NEW_MEASUREMENT, AMBIMATE_MS4::WRITEABLE_REGISTERS_BATT_INITIATE_NEW_MEASUREMENT, AMBIMATE_MS4::WRITEABLE_REGISTERS_AUD_INITIATE_NEW_MEASUREMENT, AMBIMATE_MS4::WRITEABLE_REGISTERS_LIGHT_INITIATE_NEW_MEASUREMENT, AMBIMATE_MS4::WRITEABLE_REGISTERS_HUM_INITIATE_NEW_MEASUREMENT, AMBIMATE_MS4::WRITEABLE_REGISTERS_TEMP_INITIATE_NEW_MEASUREMENT, AMBIMATE_MS4::WRITEABLE_REGISTERS_STATUS_INITIATE_NEW_MEASUREMENT ); |
mcm | 3:891e0af7da10 | 81 | |
mcm | 3:891e0af7da10 | 82 | // Wait for a new data set value |
mcm | 3:891e0af7da10 | 83 | do { |
mcm | 3:891e0af7da10 | 84 | // Reset the variable |
mcm | 3:891e0af7da10 | 85 | myAMBIMATE_MS4_Data.start_scan_byte = (uint8_t)( AMBIMATE_MS4::WRITEABLE_REGISTERS_GAS_INITIATE_NEW_MEASUREMENT | AMBIMATE_MS4::WRITEABLE_REGISTERS_BATT_INITIATE_NEW_MEASUREMENT | AMBIMATE_MS4::WRITEABLE_REGISTERS_AUD_INITIATE_NEW_MEASUREMENT | AMBIMATE_MS4::WRITEABLE_REGISTERS_LIGHT_INITIATE_NEW_MEASUREMENT | AMBIMATE_MS4::WRITEABLE_REGISTERS_HUM_INITIATE_NEW_MEASUREMENT | AMBIMATE_MS4::WRITEABLE_REGISTERS_TEMP_INITIATE_NEW_MEASUREMENT | AMBIMATE_MS4::WRITEABLE_REGISTERS_STATUS_INITIATE_NEW_MEASUREMENT ); |
mcm | 3:891e0af7da10 | 86 | |
mcm | 3:891e0af7da10 | 87 | aux = myAMBIMATE_MS4.AMBIMATE_MS4_GetScanStartByte ( &myAMBIMATE_MS4_Data.start_scan_byte ); |
mcm | 3:891e0af7da10 | 88 | wait_ms (700); |
mcm | 3:891e0af7da10 | 89 | } while( ( myAMBIMATE_MS4_Data.start_scan_byte & ( AMBIMATE_MS4::WRITEABLE_REGISTERS_GAS_MASK | AMBIMATE_MS4::WRITEABLE_REGISTERS_BATT_MASK | AMBIMATE_MS4::WRITEABLE_REGISTERS_AUD_MASK | AMBIMATE_MS4::WRITEABLE_REGISTERS_LIGHT_MASK | AMBIMATE_MS4::WRITEABLE_REGISTERS_HUM_MASK | AMBIMATE_MS4::WRITEABLE_REGISTERS_TEMP_MASK | AMBIMATE_MS4::WRITEABLE_REGISTERS_STATUS_MASK ) ) != 0x00 ); |
mcm | 3:891e0af7da10 | 90 | |
mcm | 3:891e0af7da10 | 91 | // Get all the raw values |
mcm | 3:891e0af7da10 | 92 | aux = myAMBIMATE_MS4.AMBIMATE_MS4_GetRawAllSensors ( &myAMBIMATE_MS4_Data.status, &myAMBIMATE_MS4_Data.raw_data ); |
mcm | 3:891e0af7da10 | 93 | |
mcm | 3:891e0af7da10 | 94 | // Process all the data |
mcm | 3:891e0af7da10 | 95 | myAMBIMATE_MS4_Data.data = myAMBIMATE_MS4.AMBIMATE_MS4_ProcessAllData ( myAMBIMATE_MS4_Data.raw_data ); |
mcm | 3:891e0af7da10 | 96 | |
mcm | 3:891e0af7da10 | 97 | // Send data through the UART |
mcm | 3:891e0af7da10 | 98 | pc.printf ( "CO2: %d ppm, VOC: %d, T: %d C, RH: %d %%, Lux: %d, Batt: %d V, Aud: %d db\r\n", (uint32_t)myAMBIMATE_MS4_Data.data.eco2, (uint32_t)myAMBIMATE_MS4_Data.data.voc, (uint32_t)myAMBIMATE_MS4_Data.data.temperature, (uint32_t)myAMBIMATE_MS4_Data.data.humidity, myAMBIMATE_MS4_Data.data.light, (uint32_t)myAMBIMATE_MS4_Data.data.battery_volts, myAMBIMATE_MS4_Data.data.audio ); |
mcm | 3:891e0af7da10 | 99 | |
mcm | 3:891e0af7da10 | 100 | // Reset the variables |
mcm | 3:891e0af7da10 | 101 | myState = 0UL; |
mcm | 3:891e0af7da10 | 102 | myled = 0U; |
mcm | 3:891e0af7da10 | 103 | } |
mcm | 3:891e0af7da10 | 104 | } |
mcm | 3:891e0af7da10 | 105 | } |
mcm | 3:891e0af7da10 | 106 | |
mcm | 3:891e0af7da10 | 107 | |
mcm | 3:891e0af7da10 | 108 | // @brief changeDATA ( void ) |
mcm | 3:891e0af7da10 | 109 | // |
mcm | 3:891e0af7da10 | 110 | // @details It changes myState variable |
mcm | 3:891e0af7da10 | 111 | // |
mcm | 3:891e0af7da10 | 112 | // @param[in] N/A |
mcm | 3:891e0af7da10 | 113 | // |
mcm | 3:891e0af7da10 | 114 | // @param[out] N/A. |
mcm | 3:891e0af7da10 | 115 | // |
mcm | 3:891e0af7da10 | 116 | // @return N/A. |
mcm | 3:891e0af7da10 | 117 | // |
mcm | 3:891e0af7da10 | 118 | // @author Manuel Caballero |
mcm | 3:891e0af7da10 | 119 | // @date 03/June/2021 |
mcm | 3:891e0af7da10 | 120 | // @version 03/June/2021 The ORIGIN |
mcm | 3:891e0af7da10 | 121 | // @pre N/A |
mcm | 3:891e0af7da10 | 122 | // @warning N/A. |
mcm | 3:891e0af7da10 | 123 | void changeDATA ( void ) |
mcm | 3:891e0af7da10 | 124 | { |
mcm | 3:891e0af7da10 | 125 | myState = 1UL; |
mcm | 3:891e0af7da10 | 126 | } |
mcm | 0:8d9328d3ff35 | 127 | @endcode |
mcm | 0:8d9328d3ff35 | 128 | */ |
mcm | 0:8d9328d3ff35 | 129 | |
mcm | 0:8d9328d3ff35 | 130 | |
mcm | 0:8d9328d3ff35 | 131 | /*! |
mcm | 1:f0711d344f71 | 132 | Library for the AMBIMATE_MS4 AmbiMate Sensor Module. |
mcm | 0:8d9328d3ff35 | 133 | */ |
mcm | 0:8d9328d3ff35 | 134 | class AMBIMATE_MS4 |
mcm | 0:8d9328d3ff35 | 135 | { |
mcm | 0:8d9328d3ff35 | 136 | public: |
mcm | 0:8d9328d3ff35 | 137 | /** |
mcm | 1:f0711d344f71 | 138 | * @brief DEFAULT ADDRESS |
mcm | 1:f0711d344f71 | 139 | */ |
mcm | 1:f0711d344f71 | 140 | typedef enum { |
mcm | 1:f0711d344f71 | 141 | AMBIMATE_MS4_ADDRESS = ( 0x2A << 1U ) /*!< AMBIMATE_MS4 ADDR */ |
mcm | 1:f0711d344f71 | 142 | } AMBIMATE_MS4_address_t; |
mcm | 1:f0711d344f71 | 143 | |
mcm | 1:f0711d344f71 | 144 | |
mcm | 1:f0711d344f71 | 145 | |
mcm | 1:f0711d344f71 | 146 | /** |
mcm | 1:f0711d344f71 | 147 | * @brief COMMAND REGISTERS |
mcm | 0:8d9328d3ff35 | 148 | */ |
mcm | 0:8d9328d3ff35 | 149 | typedef enum { |
mcm | 1:f0711d344f71 | 150 | AMBIMATE_MS4_STATUS_HIGH_BYTE = 0x00, /*!< Status register */ |
mcm | 1:f0711d344f71 | 151 | AMBIMATE_MS4_TEMPERATURE_HIGH_BYTE = 0x01, /*!< Temperature register. High byte */ |
mcm | 1:f0711d344f71 | 152 | AMBIMATE_MS4_TEMPERATURE_LOW_BYTE = 0x02, /*!< Temperature register. Low byte */ |
mcm | 1:f0711d344f71 | 153 | AMBIMATE_MS4_HUMIDITY_HIGH_BYTE = 0x03, /*!< Humidity register. High byte */ |
mcm | 1:f0711d344f71 | 154 | AMBIMATE_MS4_HUMIDITY_LOW_BYTE = 0x04, /*!< Humidity register. Low byte */ |
mcm | 1:f0711d344f71 | 155 | AMBIMATE_MS4_LIGHT_HIGH_BYTE = 0x05, /*!< Light register. High byte */ |
mcm | 1:f0711d344f71 | 156 | AMBIMATE_MS4_LIGHT_LOW_BYTE = 0x06, /*!< Light register. Low byte */ |
mcm | 1:f0711d344f71 | 157 | AMBIMATE_MS4_AUDIO_HIGH_BYTE = 0x07, /*!< Audio register. High byte */ |
mcm | 1:f0711d344f71 | 158 | AMBIMATE_MS4_AUDIO_LOW_BYTE = 0x08, /*!< Audio register. Low byte */ |
mcm | 1:f0711d344f71 | 159 | AMBIMATE_MS4_BATTERY_VOLTS_HIGH_BYTE = 0x09, /*!< Battery voltage register. High byte */ |
mcm | 1:f0711d344f71 | 160 | AMBIMATE_MS4_BATTERY_VOLTS_LOW_BYTE = 0x0A, /*!< Battery voltage register. Low byte */ |
mcm | 1:f0711d344f71 | 161 | AMBIMATE_MS4_ECO2_HIGH_BYTE = 0x0B, /*!< eCO2 register. High byte */ |
mcm | 1:f0711d344f71 | 162 | AMBIMATE_MS4_ECO2_LOW_BYTE = 0x0C, /*!< eCO2 register. Low byte */ |
mcm | 1:f0711d344f71 | 163 | AMBIMATE_MS4_VOC_HIGH_BYTE = 0x0D, /*!< VOC register. High byte */ |
mcm | 1:f0711d344f71 | 164 | AMBIMATE_MS4_VOC_LOW_BYTE = 0x0E /*!< VOC register. Low byte */ |
mcm | 1:f0711d344f71 | 165 | } AMBIMATE_MS4_sensor_data_registers_t; |
mcm | 1:f0711d344f71 | 166 | |
mcm | 1:f0711d344f71 | 167 | |
mcm | 1:f0711d344f71 | 168 | typedef enum { |
mcm | 1:f0711d344f71 | 169 | AMBIMATE_MS4_8BIT_STATUS_HIGH_BYTE = 0x40, /*!< Status register */ |
mcm | 1:f0711d344f71 | 170 | AMBIMATE_MS4_8BIT_TEMPERATURE_HIGH_BYTE = 0x41, /*!< Temperature register. High byte */ |
mcm | 1:f0711d344f71 | 171 | AMBIMATE_MS4_8BIT_HUMIDITY_HIGH_BYTE = 0x42, /*!< Humidity register. High byte */ |
mcm | 1:f0711d344f71 | 172 | AMBIMATE_MS4_8BIT_LIGHT_HIGH_BYTE = 0x43, /*!< Light register. High byte */ |
mcm | 1:f0711d344f71 | 173 | AMBIMATE_MS4_8BIT_AUDIO_HIGH_BYTE = 0x44, /*!< Audio register. High byte */ |
mcm | 1:f0711d344f71 | 174 | AMBIMATE_MS4_8BIT_BATTERY_VOLTS_HIGH_BYTE = 0x45, /*!< Battery voltage register. High byte */ |
mcm | 1:f0711d344f71 | 175 | AMBIMATE_MS4_8BIT_ECO2_HIGH_BYTE = 0x46, /*!< eCO2 register. High byte */ |
mcm | 1:f0711d344f71 | 176 | AMBIMATE_MS4_8BIT_VOC_HIGH_BYTE = 0x47 /*!< VOC register. High byte */ |
mcm | 1:f0711d344f71 | 177 | } AMBIMATE_MS4_8bit_sensor_data_registers_t; |
mcm | 1:f0711d344f71 | 178 | |
mcm | 1:f0711d344f71 | 179 | |
mcm | 1:f0711d344f71 | 180 | typedef enum { |
mcm | 1:f0711d344f71 | 181 | AMBIMATE_MS4_FIRMWARE_VERSION = 0x80, /*!< Firmware version */ |
mcm | 1:f0711d344f71 | 182 | AMBIMATE_MS4_FIRMWARE_SUB_VERSION = 0x81, /*!< Firmware sub-version */ |
mcm | 1:f0711d344f71 | 183 | AMBIMATE_MS4_OPTIONAL_SENSORS = 0x82 /*!< Optional sensors */ |
mcm | 1:f0711d344f71 | 184 | } AMBIMATE_MS4_other_registers_t; |
mcm | 1:f0711d344f71 | 185 | |
mcm | 1:f0711d344f71 | 186 | |
mcm | 1:f0711d344f71 | 187 | typedef enum { |
mcm | 1:f0711d344f71 | 188 | AMBIMATE_MS4_SCAN_START_BYTE = 0xC0, /*!< Scan start byte */ |
mcm | 1:f0711d344f71 | 189 | AMBIMATE_MS4_AUDIO_EVENT_LEVEL = 0xC1, /*!< Audio level event */ |
mcm | 1:f0711d344f71 | 190 | AMBIMATE_MS4_PROCESSOR_RESET = 0xF0 /*!< Initiates a processor reset */ |
mcm | 1:f0711d344f71 | 191 | } AMBIMATE_MS4_writable_registers_t; |
mcm | 1:f0711d344f71 | 192 | |
mcm | 1:f0711d344f71 | 193 | |
mcm | 1:f0711d344f71 | 194 | |
mcm | 1:f0711d344f71 | 195 | |
mcm | 1:f0711d344f71 | 196 | /** |
mcm | 1:f0711d344f71 | 197 | * @brief OPTIONAL SENSORS BYTE REGISTER. |
mcm | 1:f0711d344f71 | 198 | * NOTE: N/A. |
mcm | 1:f0711d344f71 | 199 | */ |
mcm | 1:f0711d344f71 | 200 | /* CO2 <0> |
mcm | 1:f0711d344f71 | 201 | * NOTE: N/A. |
mcm | 1:f0711d344f71 | 202 | */ |
mcm | 1:f0711d344f71 | 203 | typedef enum { |
mcm | 1:f0711d344f71 | 204 | OPTIONAL_SENSORS_BYTE_CO2_MASK = ( 1U << 0U ), /*!< CO2 mask */ |
mcm | 1:f0711d344f71 | 205 | OPTIONAL_SENSORS_BYTE_CO2_SENSOR_NOT_INSTALLED = ( 0U << 0U ), /*!< CO2 sensor is not installed */ |
mcm | 1:f0711d344f71 | 206 | OPTIONAL_SENSORS_BYTE_CO2_SENSOR_INSTALLED = ( 1U << 0U ) /*!< CO2 sensor is installed */ |
mcm | 1:f0711d344f71 | 207 | } AMBIMATE_MS4_optional_sensors_byte_co2_t; |
mcm | 1:f0711d344f71 | 208 | |
mcm | 1:f0711d344f71 | 209 | |
mcm | 1:f0711d344f71 | 210 | /* MIC <2> |
mcm | 1:f0711d344f71 | 211 | * NOTE: N/A. |
mcm | 1:f0711d344f71 | 212 | */ |
mcm | 1:f0711d344f71 | 213 | typedef enum { |
mcm | 1:f0711d344f71 | 214 | OPTIONAL_SENSORS_BYTE_MIC_MASK = ( 1U << 2U ), /*!< MIC mask */ |
mcm | 1:f0711d344f71 | 215 | OPTIONAL_SENSORS_BYTE_MIC_SENSOR_NOT_INSTALLED = ( 0U << 2U ), /*!< MIC sensor is not installed */ |
mcm | 1:f0711d344f71 | 216 | OPTIONAL_SENSORS_BYTE_MIC_SENSOR_INSTALLED = ( 1U << 2U ) /*!< MIC sensor is installed */ |
mcm | 1:f0711d344f71 | 217 | } AMBIMATE_MS4_optional_sensors_byte_mic_t; |
mcm | 1:f0711d344f71 | 218 | |
mcm | 0:8d9328d3ff35 | 219 | |
mcm | 0:8d9328d3ff35 | 220 | |
mcm | 0:8d9328d3ff35 | 221 | /** |
mcm | 1:f0711d344f71 | 222 | * @brief WRITEABLE REGISTERS. |
mcm | 1:f0711d344f71 | 223 | * NOTE: N/A. |
mcm | 1:f0711d344f71 | 224 | */ |
mcm | 1:f0711d344f71 | 225 | /* GAS <6> |
mcm | 1:f0711d344f71 | 226 | * NOTE: N/A. |
mcm | 1:f0711d344f71 | 227 | */ |
mcm | 1:f0711d344f71 | 228 | typedef enum { |
mcm | 1:f0711d344f71 | 229 | WRITEABLE_REGISTERS_GAS_MASK = ( 1U << 6U ), /*!< GAS mask */ |
mcm | 1:f0711d344f71 | 230 | WRITEABLE_REGISTERS_GAS_MEASUREMENT_COMPLETED = ( 0U << 6U ), /*!< Measurement is completed */ |
mcm | 1:f0711d344f71 | 231 | WRITEABLE_REGISTERS_GAS_INITIATE_NEW_MEASUREMENT = ( 1U << 6U ) /*!< Initiates a measurement of the VOC sensor if installed */ |
mcm | 1:f0711d344f71 | 232 | } AMBIMATE_MS4_writeable_reg_gas_t; |
mcm | 1:f0711d344f71 | 233 | |
mcm | 1:f0711d344f71 | 234 | |
mcm | 1:f0711d344f71 | 235 | /* BATT <5> |
mcm | 1:f0711d344f71 | 236 | * NOTE: N/A. |
mcm | 0:8d9328d3ff35 | 237 | */ |
mcm | 1:f0711d344f71 | 238 | typedef enum { |
mcm | 1:f0711d344f71 | 239 | WRITEABLE_REGISTERS_BATT_MASK = ( 1U << 5U ), /*!< BATT mask */ |
mcm | 1:f0711d344f71 | 240 | WRITEABLE_REGISTERS_BATT_MEASUREMENT_COMPLETED = ( 0U << 5U ), /*!< Measurement is completed */ |
mcm | 1:f0711d344f71 | 241 | WRITEABLE_REGISTERS_BATT_INITIATE_NEW_MEASUREMENT = ( 1U << 5U ) /*!< Initiates a measurement of the BATTERY voltage */ |
mcm | 1:f0711d344f71 | 242 | } AMBIMATE_MS4_writeable_reg_batt_t; |
mcm | 1:f0711d344f71 | 243 | |
mcm | 1:f0711d344f71 | 244 | |
mcm | 1:f0711d344f71 | 245 | /* AUD <4> |
mcm | 1:f0711d344f71 | 246 | * NOTE: N/A. |
mcm | 1:f0711d344f71 | 247 | */ |
mcm | 1:f0711d344f71 | 248 | typedef enum { |
mcm | 1:f0711d344f71 | 249 | WRITEABLE_REGISTERS_AUD_MASK = ( 1U << 4U ), /*!< AUD mask */ |
mcm | 1:f0711d344f71 | 250 | WRITEABLE_REGISTERS_AUD_MEASUREMENT_COMPLETED = ( 0U << 4U ), /*!< Measurement is completed */ |
mcm | 1:f0711d344f71 | 251 | WRITEABLE_REGISTERS_AUD_INITIATE_NEW_MEASUREMENT = ( 1U << 4U ) /*!< Initiates a measurement of the AUDIO sensor if installed */ |
mcm | 1:f0711d344f71 | 252 | } AMBIMATE_MS4_writeable_reg_aud_t; |
mcm | 1:f0711d344f71 | 253 | |
mcm | 1:f0711d344f71 | 254 | |
mcm | 1:f0711d344f71 | 255 | /* LIGHT <3> |
mcm | 1:f0711d344f71 | 256 | * NOTE: N/A. |
mcm | 1:f0711d344f71 | 257 | */ |
mcm | 1:f0711d344f71 | 258 | typedef enum { |
mcm | 1:f0711d344f71 | 259 | WRITEABLE_REGISTERS_LIGHT_MASK = ( 1U << 3U ), /*!< LIGHT mask */ |
mcm | 1:f0711d344f71 | 260 | WRITEABLE_REGISTERS_LIGHT_MEASUREMENT_COMPLETED = ( 0U << 3U ), /*!< Measurement is completed */ |
mcm | 1:f0711d344f71 | 261 | WRITEABLE_REGISTERS_LIGHT_INITIATE_NEW_MEASUREMENT = ( 1U << 3U ) /*!< Initiates a measurement of the LIGHT sensor */ |
mcm | 1:f0711d344f71 | 262 | } AMBIMATE_MS4_writeable_reg_light_t; |
mcm | 0:8d9328d3ff35 | 263 | |
mcm | 0:8d9328d3ff35 | 264 | |
mcm | 1:f0711d344f71 | 265 | /* HUM <2> |
mcm | 1:f0711d344f71 | 266 | * NOTE: N/A. |
mcm | 1:f0711d344f71 | 267 | */ |
mcm | 1:f0711d344f71 | 268 | typedef enum { |
mcm | 1:f0711d344f71 | 269 | WRITEABLE_REGISTERS_HUM_MASK = ( 1U << 2U ), /*!< HUM mask */ |
mcm | 1:f0711d344f71 | 270 | WRITEABLE_REGISTERS_HUM_MEASUREMENT_COMPLETED = ( 0U << 2U ), /*!< Measurement is completed */ |
mcm | 1:f0711d344f71 | 271 | WRITEABLE_REGISTERS_HUM_INITIATE_NEW_MEASUREMENT = ( 1U << 2U ) /*!< Initiates a measurement of the HUMIDITY sensor */ |
mcm | 1:f0711d344f71 | 272 | } AMBIMATE_MS4_writeable_reg_hum_t; |
mcm | 1:f0711d344f71 | 273 | |
mcm | 1:f0711d344f71 | 274 | |
mcm | 1:f0711d344f71 | 275 | /* TEMP <1> |
mcm | 1:f0711d344f71 | 276 | * NOTE: N/A. |
mcm | 1:f0711d344f71 | 277 | */ |
mcm | 1:f0711d344f71 | 278 | typedef enum { |
mcm | 1:f0711d344f71 | 279 | WRITEABLE_REGISTERS_TEMP_MASK = ( 1U << 1U ), /*!< TEMP mask */ |
mcm | 1:f0711d344f71 | 280 | WRITEABLE_REGISTERS_TEMP_MEASUREMENT_COMPLETED = ( 0U << 1U ), /*!< Measurement is completed */ |
mcm | 1:f0711d344f71 | 281 | WRITEABLE_REGISTERS_TEMP_INITIATE_NEW_MEASUREMENT = ( 1U << 1U ) /*!< Initiates a measurement of the TEMPERATURE sensor */ |
mcm | 1:f0711d344f71 | 282 | } AMBIMATE_MS4_writeable_reg_temp_t; |
mcm | 1:f0711d344f71 | 283 | |
mcm | 1:f0711d344f71 | 284 | |
mcm | 1:f0711d344f71 | 285 | /* STATUS <0> |
mcm | 1:f0711d344f71 | 286 | * NOTE: N/A. |
mcm | 1:f0711d344f71 | 287 | */ |
mcm | 0:8d9328d3ff35 | 288 | typedef enum { |
mcm | 1:f0711d344f71 | 289 | WRITEABLE_REGISTERS_STATUS_MASK = ( 1U << 0U ), /*!< STATUS mask */ |
mcm | 1:f0711d344f71 | 290 | WRITEABLE_REGISTERS_STATUS_MEASUREMENT_COMPLETED = ( 0U << 0U ), /*!< Measurement is completed */ |
mcm | 1:f0711d344f71 | 291 | WRITEABLE_REGISTERS_STATUS_INITIATE_NEW_MEASUREMENT = ( 1U << 0U ) /*!< Initiates a measurement of the STATUS */ |
mcm | 1:f0711d344f71 | 292 | } AMBIMATE_MS4_writeable_reg_status_t; |
mcm | 1:f0711d344f71 | 293 | |
mcm | 1:f0711d344f71 | 294 | |
mcm | 1:f0711d344f71 | 295 | |
mcm | 1:f0711d344f71 | 296 | |
mcm | 0:8d9328d3ff35 | 297 | /** |
mcm | 1:f0711d344f71 | 298 | * @brief RESET REGISTER. |
mcm | 1:f0711d344f71 | 299 | * NOTE: N/A. |
mcm | 1:f0711d344f71 | 300 | */ |
mcm | 1:f0711d344f71 | 301 | /* PROCESSOR_RESET <7:0> |
mcm | 1:f0711d344f71 | 302 | * NOTE: N/A. |
mcm | 1:f0711d344f71 | 303 | */ |
mcm | 1:f0711d344f71 | 304 | typedef enum { |
mcm | 1:f0711d344f71 | 305 | RESET_REGISTER_PROCESSOR_RESET = 0xA5 /*!< It initiates an AmbiMate processor reset */ |
mcm | 1:f0711d344f71 | 306 | } AMBIMATE_MS4_reset_t; |
mcm | 1:f0711d344f71 | 307 | |
mcm | 1:f0711d344f71 | 308 | |
mcm | 1:f0711d344f71 | 309 | |
mcm | 1:f0711d344f71 | 310 | |
mcm | 1:f0711d344f71 | 311 | /** |
mcm | 1:f0711d344f71 | 312 | * @brief OPTIONAL SENSORS BYTE. |
mcm | 1:f0711d344f71 | 313 | * NOTE: N/A. |
mcm | 0:8d9328d3ff35 | 314 | */ |
mcm | 0:8d9328d3ff35 | 315 | typedef enum { |
mcm | 1:f0711d344f71 | 316 | OPTIONAL_SENSORS_NONE = 0, /*!< No optional sensors on board */ |
mcm | 1:f0711d344f71 | 317 | OPTIONAL_SENSORS_CO2 = 1, /*!< Optional sensors: C02 only */ |
mcm | 1:f0711d344f71 | 318 | OPTIONAL_SENSORS_MIC = 3, /*!< Optional sensors: MIC only */ |
mcm | 1:f0711d344f71 | 319 | OPTIONAL_SENSORS_CO2_AND_MIC = 4 /*!< Optional sensors: CO2 and MIC */ |
mcm | 1:f0711d344f71 | 320 | } AMBIMATE_MS4_op_sensors_byte_t; |
mcm | 0:8d9328d3ff35 | 321 | |
mcm | 0:8d9328d3ff35 | 322 | |
mcm | 0:8d9328d3ff35 | 323 | |
mcm | 0:8d9328d3ff35 | 324 | |
mcm | 0:8d9328d3ff35 | 325 | |
mcm | 1:f0711d344f71 | 326 | |
mcm | 1:f0711d344f71 | 327 | #ifndef AMBIMATE_MS4_VECTOR_STRUCT_H |
mcm | 1:f0711d344f71 | 328 | #define AMBIMATE_MS4_VECTOR_STRUCT_H |
mcm | 1:f0711d344f71 | 329 | /* OTHER REGISTERS */ |
mcm | 0:8d9328d3ff35 | 330 | typedef struct { |
mcm | 1:f0711d344f71 | 331 | uint8_t firmware_version; /*< Firmware version */ |
mcm | 1:f0711d344f71 | 332 | uint8_t firmware_sub_version; /*< Firmware sub-version */ |
mcm | 1:f0711d344f71 | 333 | AMBIMATE_MS4_op_sensors_byte_t optional_sensors; /*< Optional sensors */ |
mcm | 1:f0711d344f71 | 334 | } AMBIMATE_MS4_other_reg_param_t; |
mcm | 1:f0711d344f71 | 335 | |
mcm | 0:8d9328d3ff35 | 336 | |
mcm | 1:f0711d344f71 | 337 | /* RAW DATA VALUES: 16-bit */ |
mcm | 1:f0711d344f71 | 338 | typedef struct { |
mcm | 1:f0711d344f71 | 339 | uint16_t raw_temperature; /*< Raw temperature value */ |
mcm | 1:f0711d344f71 | 340 | uint16_t raw_humidity; /*< Raw humidity value */ |
mcm | 1:f0711d344f71 | 341 | uint16_t raw_light; /*< Raw light value */ |
mcm | 1:f0711d344f71 | 342 | uint16_t raw_audio; /*< Raw audio value */ |
mcm | 1:f0711d344f71 | 343 | uint16_t raw_battery_volts; /*< Raw battery volts value */ |
mcm | 1:f0711d344f71 | 344 | uint16_t raw_eco2; /*< Raw eCO2 value */ |
mcm | 1:f0711d344f71 | 345 | uint16_t raw_voc; /*< Raw VOC value */ |
mcm | 1:f0711d344f71 | 346 | } AMBIMATE_MS4_raw_data_values_t; |
mcm | 1:f0711d344f71 | 347 | |
mcm | 1:f0711d344f71 | 348 | |
mcm | 1:f0711d344f71 | 349 | /* RAW DATA VALUES: 8-bit */ |
mcm | 0:8d9328d3ff35 | 350 | typedef struct { |
mcm | 1:f0711d344f71 | 351 | uint16_t raw_8bit_temperature; /*< Raw temperature value */ |
mcm | 1:f0711d344f71 | 352 | uint16_t raw_8bit_humidity; /*< Raw humidity value */ |
mcm | 1:f0711d344f71 | 353 | uint16_t raw_8bit_light; /*< Raw light value */ |
mcm | 1:f0711d344f71 | 354 | uint16_t raw_8bit_audio; /*< Raw audio value */ |
mcm | 1:f0711d344f71 | 355 | uint16_t raw_8bit_battery_volts; /*< Raw battery volts value */ |
mcm | 1:f0711d344f71 | 356 | uint16_t raw_8bit_eco2; /*< Raw eCO2 value */ |
mcm | 1:f0711d344f71 | 357 | uint16_t raw_8bit_voc; /*< Raw VOC value */ |
mcm | 1:f0711d344f71 | 358 | } AMBIMATE_MS4_raw_8bit_data_values_t; |
mcm | 1:f0711d344f71 | 359 | |
mcm | 1:f0711d344f71 | 360 | |
mcm | 1:f0711d344f71 | 361 | /* DATA VALUES: 16-bit resolution */ |
mcm | 0:8d9328d3ff35 | 362 | typedef struct { |
mcm | 1:f0711d344f71 | 363 | double temperature; /*< Temperature value */ |
mcm | 1:f0711d344f71 | 364 | double humidity; /*< Humidity value */ |
mcm | 1:f0711d344f71 | 365 | uint16_t light; /*< Light value */ |
mcm | 1:f0711d344f71 | 366 | uint16_t audio; /*< Audio value */ |
mcm | 1:f0711d344f71 | 367 | double battery_volts; /*< Battery volts value */ |
mcm | 1:f0711d344f71 | 368 | uint16_t eco2; /*< eCO2 value */ |
mcm | 1:f0711d344f71 | 369 | uint16_t voc; /*< VOC value */ |
mcm | 1:f0711d344f71 | 370 | } AMBIMATE_MS4_data_values_t; |
mcm | 1:f0711d344f71 | 371 | |
mcm | 1:f0711d344f71 | 372 | |
mcm | 1:f0711d344f71 | 373 | |
mcm | 0:8d9328d3ff35 | 374 | |
mcm | 1:f0711d344f71 | 375 | /* USER: User's variables */ |
mcm | 0:8d9328d3ff35 | 376 | typedef struct { |
mcm | 1:f0711d344f71 | 377 | uint8_t status; /*< Status register */ |
mcm | 1:f0711d344f71 | 378 | |
mcm | 1:f0711d344f71 | 379 | uint8_t start_scan_byte; /*< StartScanByte register */ |
mcm | 1:f0711d344f71 | 380 | |
mcm | 1:f0711d344f71 | 381 | AMBIMATE_MS4_raw_data_values_t raw_data; /*< Raw data values */ |
mcm | 1:f0711d344f71 | 382 | AMBIMATE_MS4_raw_8bit_data_values_t raw_data8bit; /*< 8-bit Raw data values */ |
mcm | 1:f0711d344f71 | 383 | |
mcm | 1:f0711d344f71 | 384 | AMBIMATE_MS4_data_values_t data; /*< Data values */ |
mcm | 1:f0711d344f71 | 385 | |
mcm | 1:f0711d344f71 | 386 | AMBIMATE_MS4_other_reg_param_t info; /*< Other registers: Info regarding the device */ |
mcm | 1:f0711d344f71 | 387 | } AMBIMATE_MS4_data_t; |
mcm | 0:8d9328d3ff35 | 388 | #endif |
mcm | 0:8d9328d3ff35 | 389 | |
mcm | 0:8d9328d3ff35 | 390 | |
mcm | 0:8d9328d3ff35 | 391 | /** |
mcm | 0:8d9328d3ff35 | 392 | * @brief INTERNAL CONSTANTS |
mcm | 0:8d9328d3ff35 | 393 | */ |
mcm | 0:8d9328d3ff35 | 394 | typedef enum { |
mcm | 1:f0711d344f71 | 395 | AMBIMATE_MS4_SUCCESS = 0, |
mcm | 1:f0711d344f71 | 396 | AMBIMATE_MS4_FAILURE = 1, |
mcm | 1:f0711d344f71 | 397 | AMBIMATE_MS4_DATA_CORRUPTED = 2, |
mcm | 1:f0711d344f71 | 398 | I2C_SUCCESS = 0 /*!< I2C communication was fine */ |
mcm | 0:8d9328d3ff35 | 399 | } AMBIMATE_MS4_status_t; |
mcm | 0:8d9328d3ff35 | 400 | |
mcm | 0:8d9328d3ff35 | 401 | |
mcm | 0:8d9328d3ff35 | 402 | |
mcm | 0:8d9328d3ff35 | 403 | |
mcm | 0:8d9328d3ff35 | 404 | /** Create an AMBIMATE_MS4 object connected to the specified I2C pins. |
mcm | 0:8d9328d3ff35 | 405 | * |
mcm | 0:8d9328d3ff35 | 406 | * @param sda I2C data pin |
mcm | 0:8d9328d3ff35 | 407 | * @param scl I2C clock pin |
mcm | 0:8d9328d3ff35 | 408 | * @param addr I2C slave address |
mcm | 0:8d9328d3ff35 | 409 | * @param freq I2C frequency in Hz. |
mcm | 0:8d9328d3ff35 | 410 | */ |
mcm | 0:8d9328d3ff35 | 411 | AMBIMATE_MS4 ( PinName sda, PinName scl, uint32_t addr, uint32_t freq ); |
mcm | 0:8d9328d3ff35 | 412 | |
mcm | 0:8d9328d3ff35 | 413 | /** Delete AMBIMATE_MS4 object. |
mcm | 0:8d9328d3ff35 | 414 | */ |
mcm | 0:8d9328d3ff35 | 415 | ~AMBIMATE_MS4(); |
mcm | 0:8d9328d3ff35 | 416 | |
mcm | 1:f0711d344f71 | 417 | /** It initiates a new measurements of the chosen sensors. |
mcm | 1:f0711d344f71 | 418 | */ |
mcm | 1:f0711d344f71 | 419 | AMBIMATE_MS4_status_t AMBIMATE_MS4_ScanStartByte ( AMBIMATE_MS4_writeable_reg_gas_t gas, AMBIMATE_MS4_writeable_reg_batt_t batt, AMBIMATE_MS4_writeable_reg_aud_t aud, AMBIMATE_MS4_writeable_reg_light_t light, AMBIMATE_MS4_writeable_reg_hum_t hum, AMBIMATE_MS4_writeable_reg_temp_t temp, AMBIMATE_MS4_writeable_reg_status_t status ); |
mcm | 1:f0711d344f71 | 420 | |
mcm | 1:f0711d344f71 | 421 | /** It gets the scan byte values. |
mcm | 1:f0711d344f71 | 422 | */ |
mcm | 1:f0711d344f71 | 423 | AMBIMATE_MS4_status_t AMBIMATE_MS4_GetScanStartByte ( uint8_t* scan_byte ); |
mcm | 1:f0711d344f71 | 424 | |
mcm | 1:f0711d344f71 | 425 | /** It gets the firmware version. |
mcm | 1:f0711d344f71 | 426 | */ |
mcm | 1:f0711d344f71 | 427 | AMBIMATE_MS4_status_t AMBIMATE_MS4_GetFirmwareVersion ( uint8_t* fw_version ); |
mcm | 1:f0711d344f71 | 428 | |
mcm | 1:f0711d344f71 | 429 | /** It gets the firmware sub-version. |
mcm | 1:f0711d344f71 | 430 | */ |
mcm | 1:f0711d344f71 | 431 | AMBIMATE_MS4_status_t AMBIMATE_MS4_GetFirmwareSubVersion ( uint8_t* fw_subversion ); |
mcm | 1:f0711d344f71 | 432 | |
mcm | 1:f0711d344f71 | 433 | /** It gets the optional sensors on board. |
mcm | 1:f0711d344f71 | 434 | */ |
mcm | 1:f0711d344f71 | 435 | AMBIMATE_MS4_status_t AMBIMATE_MS4_GetOptionalSensorsByte ( AMBIMATE_MS4_op_sensors_byte_t* op_sensors ); |
mcm | 1:f0711d344f71 | 436 | |
mcm | 1:f0711d344f71 | 437 | /** It performs a processor reset. |
mcm | 1:f0711d344f71 | 438 | */ |
mcm | 1:f0711d344f71 | 439 | AMBIMATE_MS4_status_t AMBIMATE_MS4_ProcessorReset ( void ); |
mcm | 0:8d9328d3ff35 | 440 | |
mcm | 1:f0711d344f71 | 441 | /** It gets the Status value. |
mcm | 1:f0711d344f71 | 442 | */ |
mcm | 1:f0711d344f71 | 443 | AMBIMATE_MS4_status_t AMBIMATE_MS4_GetStatus ( uint8_t* status ); |
mcm | 1:f0711d344f71 | 444 | |
mcm | 1:f0711d344f71 | 445 | /** It gets the raw value for temperature. |
mcm | 1:f0711d344f71 | 446 | */ |
mcm | 1:f0711d344f71 | 447 | AMBIMATE_MS4_status_t AMBIMATE_MS4_GetRawTemperature ( uint16_t* raw_temp ); |
mcm | 1:f0711d344f71 | 448 | |
mcm | 1:f0711d344f71 | 449 | /** It gets the raw value for humidity. |
mcm | 1:f0711d344f71 | 450 | */ |
mcm | 1:f0711d344f71 | 451 | AMBIMATE_MS4_status_t AMBIMATE_MS4_GetRawHumidity ( uint16_t* raw_hum ); |
mcm | 0:8d9328d3ff35 | 452 | |
mcm | 1:f0711d344f71 | 453 | /** It gets the raw value for light. |
mcm | 1:f0711d344f71 | 454 | */ |
mcm | 1:f0711d344f71 | 455 | AMBIMATE_MS4_status_t AMBIMATE_MS4_GetRawLight ( uint16_t* raw_light ); |
mcm | 1:f0711d344f71 | 456 | |
mcm | 1:f0711d344f71 | 457 | /** It gets the raw value for audio. |
mcm | 1:f0711d344f71 | 458 | */ |
mcm | 1:f0711d344f71 | 459 | AMBIMATE_MS4_status_t AMBIMATE_MS4_GetRawAudio ( uint16_t* raw_audio ); |
mcm | 1:f0711d344f71 | 460 | |
mcm | 1:f0711d344f71 | 461 | /** It gets the raw value for battery volts. |
mcm | 1:f0711d344f71 | 462 | */ |
mcm | 1:f0711d344f71 | 463 | AMBIMATE_MS4_status_t AMBIMATE_MS4_GetRawBatteryVolts ( uint16_t* raw_batt ); |
mcm | 0:8d9328d3ff35 | 464 | |
mcm | 1:f0711d344f71 | 465 | /** It gets the raw value for eCO2. |
mcm | 1:f0711d344f71 | 466 | */ |
mcm | 1:f0711d344f71 | 467 | AMBIMATE_MS4_status_t AMBIMATE_MS4_GetRawECO2 ( uint16_t* raw_eco2 ); |
mcm | 1:f0711d344f71 | 468 | |
mcm | 1:f0711d344f71 | 469 | /** It gets the raw value for VOC. |
mcm | 1:f0711d344f71 | 470 | */ |
mcm | 1:f0711d344f71 | 471 | AMBIMATE_MS4_status_t AMBIMATE_MS4_GetRawVOC ( uint16_t* raw_voc ); |
mcm | 1:f0711d344f71 | 472 | |
mcm | 1:f0711d344f71 | 473 | /** It gets the raw value for all the sensors. |
mcm | 1:f0711d344f71 | 474 | */ |
mcm | 1:f0711d344f71 | 475 | AMBIMATE_MS4_status_t AMBIMATE_MS4_GetRawAllSensors ( uint8_t* status, AMBIMATE_MS4_raw_data_values_t* raw_all ); |
mcm | 0:8d9328d3ff35 | 476 | |
mcm | 1:f0711d344f71 | 477 | /** It gets the 8bit raw value for temperature. |
mcm | 1:f0711d344f71 | 478 | */ |
mcm | 1:f0711d344f71 | 479 | AMBIMATE_MS4_status_t AMBIMATE_MS4_Get8bitRawTemperature ( uint8_t* raw_8bit_temp ); |
mcm | 1:f0711d344f71 | 480 | |
mcm | 1:f0711d344f71 | 481 | /** It gets the 8bit raw value for humidity. |
mcm | 1:f0711d344f71 | 482 | */ |
mcm | 1:f0711d344f71 | 483 | AMBIMATE_MS4_status_t AMBIMATE_MS4_Get8bitRawHumidity ( uint8_t* raw_8bit_hum ); |
mcm | 1:f0711d344f71 | 484 | |
mcm | 1:f0711d344f71 | 485 | /** It gets the 8bit raw value for light. |
mcm | 1:f0711d344f71 | 486 | */ |
mcm | 1:f0711d344f71 | 487 | AMBIMATE_MS4_status_t AMBIMATE_MS4_Get8bitRawLight ( uint8_t* raw_8bit_light ); |
mcm | 0:8d9328d3ff35 | 488 | |
mcm | 1:f0711d344f71 | 489 | /** It gets the 8bit raw value for audio. |
mcm | 1:f0711d344f71 | 490 | */ |
mcm | 1:f0711d344f71 | 491 | AMBIMATE_MS4_status_t AMBIMATE_MS4_Get8bitRawAudio ( uint8_t* raw_8bit_audio ); |
mcm | 1:f0711d344f71 | 492 | |
mcm | 1:f0711d344f71 | 493 | /** It gets the 8bit raw value for battery volts. |
mcm | 1:f0711d344f71 | 494 | */ |
mcm | 1:f0711d344f71 | 495 | AMBIMATE_MS4_status_t AMBIMATE_MS4_Get8bitRawBatteryVolts ( uint8_t* raw_8bit_batt ); |
mcm | 1:f0711d344f71 | 496 | |
mcm | 1:f0711d344f71 | 497 | /** It gets the 8bit raw value for eCO2. |
mcm | 1:f0711d344f71 | 498 | */ |
mcm | 1:f0711d344f71 | 499 | AMBIMATE_MS4_status_t AMBIMATE_MS4_Get8bitRawECO2 ( uint8_t* raw_8bit_eco2 ); |
mcm | 0:8d9328d3ff35 | 500 | |
mcm | 1:f0711d344f71 | 501 | /** It gets the 8bit raw value for VOC. |
mcm | 1:f0711d344f71 | 502 | */ |
mcm | 1:f0711d344f71 | 503 | AMBIMATE_MS4_status_t AMBIMATE_MS4_Get8bitRawVOC ( uint8_t* raw_8bit_voc ); |
mcm | 1:f0711d344f71 | 504 | |
mcm | 1:f0711d344f71 | 505 | /** It gets the 8bit raw value for all the sensors. |
mcm | 1:f0711d344f71 | 506 | */ |
mcm | 1:f0711d344f71 | 507 | AMBIMATE_MS4_status_t AMBIMATE_MS4_GetRaw8bitAllSensors ( uint8_t* status, AMBIMATE_MS4_raw_8bit_data_values_t* raw_8bit_all ); |
mcm | 1:f0711d344f71 | 508 | |
mcm | 1:f0711d344f71 | 509 | /** It process all the data to human readable values for all the sensors. |
mcm | 1:f0711d344f71 | 510 | */ |
mcm | 1:f0711d344f71 | 511 | AMBIMATE_MS4_data_values_t AMBIMATE_MS4_ProcessAllData ( AMBIMATE_MS4_raw_data_values_t raw_all ); |
mcm | 0:8d9328d3ff35 | 512 | |
mcm | 0:8d9328d3ff35 | 513 | private: |
mcm | 0:8d9328d3ff35 | 514 | I2C _i2c; |
mcm | 0:8d9328d3ff35 | 515 | uint32_t _AMBIMATE_MS4_Addr; |
mcm | 0:8d9328d3ff35 | 516 | }; |
mcm | 0:8d9328d3ff35 | 517 | |
mcm | 2:6c5fac3dfd44 | 518 | #endif |