38 #include "drv_digital_out.h" 39 #include "drv_digital_in.h" 40 #include "drv_i2c_master.h" 53 #define C13DOF_MAP_MIKROBUS( cfg, mikrobus ) \ 54 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \ 55 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ) 62 #define C13DOF_RETVAL uint8_t 64 #define C13DOF_OK 0x00 65 #define C13DOF_INIT_ERROR 0xFF 68 #define C13DOF_POLL_PERIOD_MS 10 74 #define C13DOF_BME680_DEVICE_SLAVE_ADDR_0 0x76 75 #define C13DOF_BME680_DEVICE_SLAVE_ADDR_1 0x77 76 #define C13DOF_BME680_CHIP_ID 0x61 77 #define C13DOF_BME680_COEFF_SIZE 41 78 #define C13DOF_BME680_COEFF_ADDR1_LEN 25 79 #define C13DOF_BME680_COEFF_ADDR2_LEN 16 80 #define C13DOF_BME680_FIELD_LENGTH 15 81 #define C13DOF_BME680_FIELD_ADDR_OFFSET 17 82 #define C13DOF_BME680_SOFT_RESET_CMD 0xB6 83 #define C13DOF_BME680_DEVICE_OK 0 84 #define C13DOF_BME680_DEVICE_ERROR 1 85 #define C13DOF_BME680_E_NULL_PTR -1 86 #define C13DOF_BME680_E_COM_FAIL -2 87 #define C13DOF_BME680_E_DEV_NOT_FOUND -3 88 #define C13DOF_BME680_E_INVALID_LENGTH -4 89 #define C13DOF_BME680_W_DEFINE_PWR_MODE 1 90 #define C13DOF_BME680_W_NO_NEW_DATA 2 91 #define C13DOF_BME680_I_MIN_CORRECTION 1 92 #define C13DOF_BME680_I_MAX_CORRECTION 2 93 #define C13DOF_BME680_ADDR_RES_HEAT_VAL_ADDR 0x00 94 #define C13DOF_BME680_ADDR_RES_HEAT_RANGE_ADDR 0x02 95 #define C13DOF_BME680_ADDR_RANGE_SW_ERR_ADDR 0x04 96 #define C13DOF_BME680_ADDR_SENS_CONF_START 0x5A 97 #define C13DOF_BME680_ADDR_GAS_CONF_START 0x64 98 #define C13DOF_BME680_FIELD0_ADDR 0x1D 99 #define C13DOF_BME680_RES_HEAT0_ADDR 0x5A 100 #define C13DOF_BME680_GAS_WAIT0_ADDR 0x64 101 #define C13DOF_BME680_CONF_HEAT_CTRL_ADDR 0x70 102 #define C13DOF_BME680_CONF_ODR_RUN_GAS_NBC_ADDR 0x71 103 #define C13DOF_BME680_CONF_OS_H_ADDR 0x72 104 #define C13DOF_BME680_MEM_PAGE_ADDR 0xf3 105 #define C13DOF_BME680_CONF_T_P_MODE_ADDR 0x74 106 #define C13DOF_BME680_CONF_ODR_FILT_ADDR 0x75 107 #define C13DOF_BME680_COEFF_ADDR1 0x89 108 #define C13DOF_BME680_COEFF_ADDR2 0xe1 109 #define C13DOF_BME680_CHIP_ID_ADDR 0xD0 110 #define C13DOF_BME680_SOFT_RESET_ADDR 0xE0 111 #define C13DOF_BME680_ENABLE_HEATER 0x00 112 #define C13DOF_BME680_DISABLE_HEATER 0x08 113 #define C13DOF_BME680_DISABLE_GAS_MEAS 0x00 114 #define C13DOF_BME680_ENABLE_GAS_MEAS 0x01 115 #define C13DOF_BME680_OS_NONE 0 116 #define C13DOF_BME680_OS_1X 1 117 #define C13DOF_BME680_OS_2X 2 118 #define C13DOF_BME680_OS_4X 3 119 #define C13DOF_BME680_OS_8X 4 120 #define C13DOF_BME680_OS_16X 5 121 #define C13DOF_BME680_FILTER_SIZE_0 0 122 #define C13DOF_BME680_FILTER_SIZE_1 1 123 #define C13DOF_BME680_FILTER_SIZE_3 2 124 #define C13DOF_BME680_FILTER_SIZE_7 3 125 #define C13DOF_BME680_FILTER_SIZE_15 4 126 #define C13DOF_BME680_FILTER_SIZE_31 5 127 #define C13DOF_BME680_FILTER_SIZE_63 6 128 #define C13DOF_BME680_FILTER_SIZE_127 7 129 #define C13DOF_BME680_SLEEP_MODE 0 130 #define C13DOF_BME680_FORCED_MODE 1 131 #define C13DOF_BME680_RESET_PERIOD 10 132 #define C13DOF_BME680_MEM_PAGE0 0x10 133 #define C13DOF_BME680_MEM_PAGE1 0x00 134 #define C13DOF_BME680_HUM_REG_SHIFT_VAL 4 135 #define C13DOF_BME680_RUN_GAS_DISABLE 0 136 #define C13DOF_BME680_RUN_GAS_ENABLE 1 137 #define C13DOF_BME680_TMP_BUFFER_LENGTH 40 138 #define C13DOF_BME680_REG_BUFFER_LENGTH 6 139 #define C13DOF_BME680_FIELD_DATA_LENGTH 3 140 #define C13DOF_BME680_GAS_REG_BUF_LENGTH 20 141 #define C13DOF_BME680_OST_SEL 1 142 #define C13DOF_BME680_OSP_SEL 2 143 #define C13DOF_BME680_OSH_SEL 4 144 #define C13DOF_BME680_GAS_MEAS_SEL 8 145 #define C13DOF_BME680_FILTER_SEL 16 146 #define C13DOF_BME680_HCNTRL_SEL 32 147 #define C13DOF_BME680_RUN_GAS_SEL 64 148 #define C13DOF_BME680_NBCONV_SEL 128 149 #define C13DOF_BME680_GAS_SENSOR_SEL ( C13DOF_BME680_GAS_MEAS_SEL | \ 150 C13DOF_BME680_RUN_GAS_SEL | \ 151 C13DOF_BME680_NBCONV_SEL ) 152 #define C13DOF_BME680_NBCONV_MIN 0 153 #define C13DOF_BME680_NBCONV_MAX 10 154 #define C13DOF_BME680_GAS_MEAS_MSK 0x30 155 #define C13DOF_BME680_NBCONV_MSK 0X0F 156 #define C13DOF_BME680_FILTER_MSK 0X1C 157 #define C13DOF_BME680_OST_MSK 0XE0 158 #define C13DOF_BME680_OSP_MSK 0X1C 159 #define C13DOF_BME680_OSH_MSK 0X07 160 #define C13DOF_BME680_HCTRL_MSK 0x08 161 #define C13DOF_BME680_RUN_GAS_MSK 0x10 162 #define C13DOF_BME680_MODE_MSK 0x03 163 #define C13DOF_BME680_RHRANGE_MSK 0x30 164 #define C13DOF_BME680_RSERROR_MSK 0xf0 165 #define C13DOF_BME680_NEW_DATA_MSK 0x80 166 #define C13DOF_BME680_GAS_INDEX_MSK 0x0f 167 #define C13DOF_BME680_GAS_RANGE_MSK 0x0f 168 #define C13DOF_BME680_GASM_VALID_MSK 0x20 169 #define C13DOF_BME680_HEAT_STAB_MSK 0x10 170 #define C13DOF_BME680_MEM_PAGE_MSK 0x10 171 #define C13DOF_BME680_SPI_RD_MSK 0x80 172 #define C13DOF_BME680_SPI_WR_MSK 0x7f 173 #define C13DOF_BME680_BIT_H1_DATA_MSK 0x0F 174 #define C13DOF_BME680_GAS_MEAS_POS 4 175 #define C13DOF_BME680_FILTER_POS 2 176 #define C13DOF_BME680_OST_POS 5 177 #define C13DOF_BME680_OSP_POS 2 178 #define C13DOF_BME680_RUN_GAS_POS 4 179 #define C13DOF_BME680_T2_LSB_REG 1 180 #define C13DOF_BME680_T2_MSB_REG 2 181 #define C13DOF_BME680_T3_REG 3 182 #define C13DOF_BME680_P1_LSB_REG 5 183 #define C13DOF_BME680_P1_MSB_REG 6 184 #define C13DOF_BME680_P2_LSB_REG 7 185 #define C13DOF_BME680_P2_MSB_REG 8 186 #define C13DOF_BME680_P3_REG 9 187 #define C13DOF_BME680_P4_LSB_REG 11 188 #define C13DOF_BME680_P4_MSB_REG 12 189 #define C13DOF_BME680_P5_LSB_REG 13 190 #define C13DOF_BME680_P5_MSB_REG 14 191 #define C13DOF_BME680_P7_REG 15 192 #define C13DOF_BME680_P6_REG 16 193 #define C13DOF_BME680_P8_LSB_REG 19 194 #define C13DOF_BME680_P8_MSB_REG 20 195 #define C13DOF_BME680_P9_LSB_REG 21 196 #define C13DOF_BME680_P9_MSB_REG 22 197 #define C13DOF_BME680_P10_REG 23 198 #define C13DOF_BME680_H2_MSB_REG 25 199 #define C13DOF_BME680_H2_LSB_REG 26 200 #define C13DOF_BME680_H1_LSB_REG 26 201 #define C13DOF_BME680_H1_MSB_REG 27 202 #define C13DOF_BME680_H3_REG 28 203 #define C13DOF_BME680_H4_REG 29 204 #define C13DOF_BME680_H5_REG 30 205 #define C13DOF_BME680_H6_REG 31 206 #define C13DOF_BME680_H7_REG 32 207 #define C13DOF_BME680_T1_LSB_REG 33 208 #define C13DOF_BME680_T1_MSB_REG 34 209 #define C13DOF_BME680_GH2_LSB_REG 35 210 #define C13DOF_BME680_GH2_MSB_REG 36 211 #define C13DOF_BME680_GH1_REG 37 212 #define C13DOF_BME680_GH3_REG 38 213 #define C13DOF_BME680_REG_FILTER_INDEX 5 214 #define C13DOF_BME680_REG_TEMP_INDEX 4 215 #define C13DOF_BME680_REG_PRES_INDEX 4 216 #define C13DOF_BME680_REG_HUM_INDEX 2 217 #define C13DOF_BME680_REG_NBCONV_INDEX 1 218 #define C13DOF_BME680_REG_RUN_GAS_INDEX 1 219 #define C13DOF_BME680_REG_HCTRL_INDEX 0 220 #define C13DOF_BME680_MAX_OVERFLOW_VAL 0x40000000 221 #define C13DOF_BME680_DATA_TEMPERATURE 0x01 222 #define C13DOF_BME680_DATA_PRESSURE 0x02 223 #define C13DOF_BME680_DATA_HUMIDITY 0x03 224 #define C13DOF_BME680_OK 0x01 225 #define C13DOF_BME680_ERROR 0x00 232 #define C13DOF_BMM150_DEVICE_SLAVE_ADDR 0x10 233 #define C13DOF_BMM150_DUMMY 0x00 234 #define C13DOF_BMM150_ID_REG 0x40 235 #define C13DOF_BMM150_RESERVED1_REG 0x41 236 #define C13DOF_BMM150_DATAX_LSB_REG 0x42 237 #define C13DOF_BMM150_DATAX_MSB_REG 0x43 238 #define C13DOF_BMM150_DATAY_LSB_REG 0x44 239 #define C13DOF_BMM150_DATAY_MSB_REG 0x45 240 #define C13DOF_BMM150_DATAZ_LSB_REG 0x46 241 #define C13DOF_BMM150_DATAZ_MSB_REG 0x47 242 #define C13DOF_BMM150_RHALL_LSB_REG 0x48 243 #define C13DOF_BMM150_RHALL_MSB_REG 0x49 244 #define C13DOF_BMM150_INTERRUPT_STATUS_REG 0x4A 245 #define C13DOF_BMM150_POWER_AND_RESET_CON_REG 0x4B 246 #define C13DOF_BMM150_DATARATE_AND_OPMODE_CON_REG 0x4C 247 #define C13DOF_BMM150_INTERR_AND_AXIS_EN_REG 0x4D 248 #define C13DOF_BMM150_INTERR_AND_CHANNEL_EN_REG 0x4E 249 #define C13DOF_BMM150_LOW_THRESHOLD_REG 0x4F 250 #define C13DOF_BMM150_HIGH_THRESHOLD_REG 0x50 251 #define C13DOF_BMM150_REPETITION_XY_CON_REG 0x51 252 #define C13DOF_BMM150_REPETITION_Z_CON_REG 0x52 253 #define C13DOF_BMM150_RESERVED2_REG 0x53 254 #define C13DOF_BMM150_RESERVED3_REG 0x54 255 #define C13DOF_BMM150_RESERVED4_REG 0x55 256 #define C13DOF_BMM150_RESERVED5_REG 0x56 257 #define C13DOF_BMM150_RESERVED6_REG 0x57 258 #define C13DOF_BMM150_RESERVED7_REG 0x58 259 #define C13DOF_BMM150_RESERVED8_REG 0x59 260 #define C13DOF_BMM150_RESERVED9_REG 0x5A 261 #define C13DOF_BMM150_RESERVED10_REG 0x5B 262 #define C13DOF_BMM150_RESERVED11_REG 0x5C 263 #define C13DOF_BMM150_RESERVED12_REG 0x5D 264 #define C13DOF_BMM150_RESERVED13_REG 0x5E 265 #define C13DOF_BMM150_RESERVED14_REG 0x5F 266 #define C13DOF_BMM150_RESERVED15_REG 0x60 267 #define C13DOF_BMM150_RESERVED16_REG 0x61 268 #define C13DOF_BMM150_RESERVED17_REG 0x62 269 #define C13DOF_BMM150_RESERVED18_REG 0x63 270 #define C13DOF_BMM150_RESERVED19_REG 0x64 271 #define C13DOF_BMM150_RESERVED20_REG 0x65 272 #define C13DOF_BMM150_RESERVED21_REG 0x66 273 #define C13DOF_BMM150_RESERVED22_REG 0x67 274 #define C13DOF_BMM150_RESERVED23_REG 0x68 275 #define C13DOF_BMM150_RESERVED24_REG 0x69 276 #define C13DOF_BMM150_RESERVED25_REG 0x6A 277 #define C13DOF_BMM150_RESERVED26_REG 0x6B 278 #define C13DOF_BMM150_RESERVED27_REG 0x6C 279 #define C13DOF_BMM150_RESERVED28_REG 0x6D 280 #define C13DOF_BMM150_RESERVED29_REG 0x6E 281 #define C13DOF_BMM150_RESERVED30_REG 0x6F 282 #define C13DOF_BMM150_RESERVED31_REG 0x70 283 #define C13DOF_BMM150_RESERVED32_REG 0x71 284 #define C13DOF_BMM150_OK 0x00 285 #define C13DOF_BMM150_ADDR_ERR 0x01 286 #define C13DOF_BMM150_INTERRUPT_OCCURED 0x02 287 #define C13DOF_BMM150_NBYTES_ERR 0x03 288 #define C13DOF_BMM150_DATA_READY 0x01 289 #define C13DOF_BMM150_DATA_NOT_READY 0x00 290 #define C13DOF_BMM150_SUSPEND_MODE_SPI4_EN 0x00 291 #define C13DOF_BMM150_SLEEP_MODE 0x01 292 #define C13DOF_BMM150_SOFT_RESET_EN 0x82 293 #define C13DOF_BMM150_SPI3_EN 0x04 294 #define C13DOF_BMM150_NORMAL_OPMODE_DR_10HZ 0x00 295 #define C13DOF_BMM150_FORCED_OPMODE 0x02 296 #define C13DOF_BMM150_SLEEP_OPMODE 0x06 297 #define C13DOF_BMM150_DR_2HZ 0x08 298 #define C13DOF_BMM150_DR_6HZ 0x10 299 #define C13DOF_BMM150_DR_8HZ 0x18 300 #define C13DOF_BMM150_DR_15HZ 0x20 301 #define C13DOF_BMM150_DR_20HZ 0x28 302 #define C13DOF_BMM150_DR_25HZ 0x30 303 #define C13DOF_BMM150_DR_30HZ 0x38 304 #define C13DOF_BMM150_INTERR_DISABLED_THRESHOLDS_ENABLED 0x00 305 #define C13DOF_BMM150_LOWTHRESHOLD_X_DISABLED 0x01 306 #define C13DOF_BMM150_LOWTHRESHOLD_Y_DISABLED 0x02 307 #define C13DOF_BMM150_LOWTHRESHOLD_Z_DISABLED 0x04 308 #define C13DOF_BMM150_HIGHTHRESHOLD_X_DISABLED 0x08 309 #define C13DOF_BMM150_HIGHTHRESHOLD_Y_DISABLED 0x10 310 #define C13DOF_BMM150_HIGHTHRESHOLD_Z_DISABLED 0x20 311 #define C13DOF_BMM150_OVERFLOW_PIN_IND_EN 0x40 312 #define C13DOF_BMM150_DATAOVERRUN_IND_EN 0x80 313 #define C13DOF_BMM150_CHANNELS_ENABLED_INTERR_DATAREADY_ACTIVE_LOW 0x00 314 #define C13DOF_BMM150_INTERR_PIN_ACTIVE_HIGH 0x01 315 #define C13DOF_BMM150_INTERR_LATCHED 0x02 316 #define C13DOF_BMM150_DATAREADY_ACTIVE_HIGH 0x04 317 #define C13DOF_BMM150_CHANNEL_X_DISABLED 0x08 318 #define C13DOF_BMM150_CHANNEL_Y_DISABLED 0x10 319 #define C13DOF_BMM150_CHANNEL_Z_DISABLED 0x20 320 #define C13DOF_BMM150_INTERR_PIN_EN 0x40 321 #define C13DOF_BMM150_DATAREADY_PIN_EN 0x80 328 #define C13DOF_BMI088_ACCEL_SLAVE_ADDR 0x18 329 #define C13DOF_BMI088_GYRO_SLAVE_ADDR 0x68 330 #define C13DOF_BMI088_ACCEL_CHIP_ID_REG 0x00 331 #define C13DOF_BMI088_ACCEL_ERR_REG 0x02 332 #define C13DOF_BMI088_ACCEL_STATUS_REG 0x03 333 #define C13DOF_BMI088_ACCEL_X_LSB_REG 0x12 334 #define C13DOF_BMI088_ACCEL_X_MSB_REG 0x13 335 #define C13DOF_BMI088_ACCEL_Y_LSB_REG 0x14 336 #define C13DOF_BMI088_ACCEL_Y_MSB_REG 0x15 337 #define C13DOF_BMI088_ACCEL_Z_LSB_REG 0x16 338 #define C13DOF_BMI088_ACCEL_Z_MSB_REG 0x17 339 #define C13DOF_BMI088_ACCEL_SENSORTIME_0_REG 0x18 340 #define C13DOF_BMI088_ACCEL_SENSORTIME_1_REG 0x19 341 #define C13DOF_BMI088_ACCEL_SENSORTIME_2_REG 0x1A 342 #define C13DOF_BMI088_ACCEL_INT_STAT_0_REG 0x1C 343 #define C13DOF_BMI088_ACCEL_INT_STAT_1_REG 0x1D 344 #define C13DOF_BMI088_ACCEL_GP_0_REG 0x1E 345 #define C13DOF_BMI088_TEMP_MSB_REG 0x22 346 #define C13DOF_BMI088_TEMP_LSB_REG 0x23 347 #define C13DOF_BMI088_ACCEL_GP_4_REG 0x27 348 #define C13DOF_BMI088_ACCEL_INTERNAL_STAT_REG 0x2A 349 #define C13DOF_BMI088_ACCEL_CONF_REG 0x40 350 #define C13DOF_BMI088_ACCEL_RANGE_REG 0x41 351 #define C13DOF_BMI088_ACCEL_INT1_IO_CONF_REG 0x53 352 #define C13DOF_BMI088_ACCEL_INT2_IO_CONF_REG 0x54 353 #define C13DOF_BMI088_ACCEL_INT_LATCH_CONF_REG 0x55 354 #define C13DOF_BMI088_ACCEL_INT1_MAP_REG 0x56 355 #define C13DOF_BMI088_ACCEL_INT2_MAP_REG 0x57 356 #define C13DOF_BMI088_ACCEL_INT1_INT2_MAP_DATA_REG 0x58 357 #define C13DOF_BMI088_ACCEL_INIT_CTRL_REG 0x59 358 #define C13DOF_BMI088_ACCEL_SELF_TEST_REG 0x6D 359 #define C13DOF_BMI088_ACCEL_PWR_CONF_REG 0x7C 360 #define C13DOF_BMI088_ACCEL_PWR_CTRL_REG 0x7D 361 #define C13DOF_BMI088_ACCEL_SOFTRESET_REG 0x7E 362 #define C13DOF_BMI088_ACCEL_CHIP_ID 0x1E 363 #define C13DOF_BMI088_ACCEL_I2C_ADDR_PRIMARY 0x18 364 #define C13DOF_BMI088_ACCEL_I2C_ADDR_SECONDARY 0x19 365 #define C13DOF_BMI088_ACCEL_RESERVED_5B_REG 0x5B 366 #define C13DOF_BMI088_ACCEL_RESERVED_5C_REG 0x5C 367 #define C13DOF_BMI088_ACCEL_FEATURE_CFG_REG 0x5E 368 #define C13DOF_BMI088_ACCEL_DATA_READY_INT 0x80 369 #define C13DOF_BMI088_ACCEL_BW_OSR4 0x00 370 #define C13DOF_BMI088_ACCEL_BW_OSR2 0x01 371 #define C13DOF_BMI088_ACCEL_BW_NORMAL 0x02 372 #define C13DOF_BMI088_ACCEL_ODR_12_5_HZ 0x05 373 #define C13DOF_BMI088_ACCEL_ODR_25_HZ 0x06 374 #define C13DOF_BMI088_ACCEL_ODR_50_HZ 0x07 375 #define C13DOF_BMI088_ACCEL_ODR_100_HZ 0x08 376 #define C13DOF_BMI088_ACCEL_ODR_200_HZ 0x09 377 #define C13DOF_BMI088_ACCEL_ODR_400_HZ 0x0A 378 #define C13DOF_BMI088_ACCEL_ODR_800_HZ 0x0B 379 #define C13DOF_BMI088_ACCEL_ODR_1600_HZ 0x0C 380 #define C13DOF_BMI088_ACCEL_SWITCH_OFF_SELF_TEST 0x00 381 #define C13DOF_BMI088_ACCEL_POSITIVE_SELF_TEST 0x0D 382 #define C13DOF_BMI088_ACCEL_NEGATIVE_SELF_TEST 0x09 383 #define C13DOF_BMI088_ACCEL_PM_ACTIVE 0x00 384 #define C13DOF_BMI088_ACCEL_PM_SUSPEND 0x03 385 #define C13DOF_BMI088_ACCEL_POWER_DISABLE 0x00 386 #define C13DOF_BMI088_ACCEL_POWER_ENABLE 0x04 387 #define C13DOF_BMI088_ACCEL_INTA_DISABLE 0x00 388 #define C13DOF_BMI088_ACCEL_INTA_ENABLE 0x01 389 #define C13DOF_BMI088_ACCEL_INTB_DISABLE 0x00 390 #define C13DOF_BMI088_ACCEL_INTB_ENABLE 0x02 391 #define C13DOF_BMI088_ACCEL_SOFTRESET_DELAY_MS 1 392 #define C13DOF_BMI088_FATAL_ERR_MASK 0x01 393 #define C13DOF_BMI088_ERR_CODE_MASK 0x1C 394 #define C13DOF_BMI088_CMD_ERR_POS 1 395 #define C13DOF_BMI088_ERR_CODE_POS 2 396 #define C13DOF_BMI088_ACCEL_STATUS_MASK 0x80 397 #define C13DOF_BMI088_ACCEL_STATUS_POS 7 398 #define C13DOF_BMI088_ACCEL_ODR_MASK 0x0F 399 #define C13DOF_BMI088_ACCEL_BW_MASK 0x70 400 #define C13DOF_BMI088_ACCEL_RANGE_MASK 0x03 401 #define C13DOF_BMI088_ACCEL_BW_POS 4 402 #define C13DOF_BMI088_ACCEL_INT_EDGE_MASK 0x01 403 #define C13DOF_BMI088_ACCEL_INT_LVL_MASK 0x02 404 #define C13DOF_BMI088_ACCEL_INT_OD_MASK 0x04 405 #define C13DOF_BMI088_ACCEL_INT_IO_MASK 0x08 406 #define C13DOF_BMI088_ACCEL_INT_IN_MASK 0x10 407 #define C13DOF_BMI088_ACCEL_INT_EDGE_POS 0 408 #define C13DOF_BMI088_ACCEL_INT_LVL_POS 1 409 #define C13DOF_BMI088_ACCEL_INT_OD_POS 2 410 #define C13DOF_BMI088_ACCEL_INT_IO_POS 3 411 #define C13DOF_BMI088_ACCEL_INT_IN_POS 4 412 #define C13DOF_BMI088_ACCEL_MAP_INTA_MASK 0x01 413 #define C13DOF_BMI088_ACCEL_MAP_INTA_POS 0x00 414 #define C13DOF_BMI088_ACCEL_INT1_DRDY_MASK 0x04 415 #define C13DOF_BMI088_ACCEL_INT2_DRDY_MASK 0x40 416 #define C13DOF_BMI088_ACCEL_INT1_DRDY_POS 2 417 #define C13DOF_BMI088_ACCEL_INT2_DRDY_POS 6 418 #define C13DOF_BMI088_ASIC_INITIALIZED 0x01 419 #define C13DOF_BMI088_GYRO_CHIP_ID_REG 0x00 420 #define C13DOF_BMI088_GYRO_X_LSB_REG 0x02 421 #define C13DOF_BMI088_GYRO_X_MSB_REG 0x03 422 #define C13DOF_BMI088_GYRO_Y_LSB_REG 0x04 423 #define C13DOF_BMI088_GYRO_Y_MSB_REG 0x05 424 #define C13DOF_BMI088_GYRO_Z_LSB_REG 0x06 425 #define C13DOF_BMI088_GYRO_Z_MSB_REG 0x07 426 #define C13DOF_BMI088_GYRO_INT_STAT_1_REG 0x0A 427 #define C13DOF_BMI088_GYRO_RANGE_REG 0x0F 428 #define C13DOF_BMI088_GYRO_BANDWIDTH_REG 0x10 429 #define C13DOF_BMI088_GYRO_LPM1_REG 0x11 430 #define C13DOF_BMI088_GYRO_SOFTRESET_REG 0x14 431 #define C13DOF_BMI088_GYRO_INT_CTRL_REG 0x15 432 #define C13DOF_BMI088_GYRO_INT3_INT4_IO_CONF_REG 0x16 433 #define C13DOF_BMI088_GYRO_INT3_INT4_IO_MAP_REG 0x18 434 #define C13DOF_BMI088_GYRO_SELF_TEST_REG 0x3C 435 #define C13DOF_BMI088_GYRO_CHIP_ID 0x0F 436 #define C13DOF_BMI088_GYRO_I2C_ADDR_PRIMARY 0x68 437 #define C13DOF_BMI088_GYRO_I2C_ADDR_SECONDARY 0x69 438 #define C13DOF_BMI088_GYRO_RANGE_2000_DPS 0x00 439 #define C13DOF_BMI088_GYRO_RANGE_1000_DPS 0x01 440 #define C13DOF_BMI088_GYRO_RANGE_500_DPS 0x02 441 #define C13DOF_BMI088_GYRO_RANGE_250_DPS 0x03 442 #define C13DOF_BMI088_GYRO_RANGE_125_DPS 0x04 443 #define C13DOF_BMI088_GYRO_BW_532_ODR_2000_HZ 0x00 444 #define C13DOF_BMI088_GYRO_BW_230_ODR_2000_HZ 0x01 445 #define C13DOF_BMI088_GYRO_BW_116_ODR_1000_HZ 0x02 446 #define C13DOF_BMI088_GYRO_BW_47_ODR_400_HZ 0x03 447 #define C13DOF_BMI088_GYRO_BW_23_ODR_200_HZ 0x04 448 #define C13DOF_BMI088_GYRO_BW_12_ODR_100_HZ 0x05 449 #define C13DOF_BMI088_GYRO_BW_64_ODR_200_HZ 0x06 450 #define C13DOF_BMI088_GYRO_BW_32_ODR_100_HZ 0x07 451 #define C13DOF_BMI088_GYRO_ODR_RESET_VAL 0x80 452 #define C13DOF_BMI088_GYRO_PM_NORMAL 0x00 453 #define C13DOF_BMI088_GYRO_PM_DEEP_SUSPEND 0x20 454 #define C13DOF_BMI088_GYRO_PM_SUSPEND 0x80 455 #define C13DOF_BMI088_GYRO_DRDY_INT_DISABLE_VAL 0x00 456 #define C13DOF_BMI088_GYRO_DRDY_INT_ENABLE_VAL 0x80 457 #define C13DOF_BMI088_GYRO_MAP_DRDY_TO_INT3 0x01 458 #define C13DOF_BMI088_GYRO_MAP_DRDY_TO_INT4 0x80 459 #define C13DOF_BMI088_GYRO_MAP_DRDY_TO_BOTH_INT3_INT4 0x81 460 #define C13DOF_BMI088_GYRO_SOFTRESET_DELAY 30 461 #define C13DOF_BMI088_GYRO_POWER_MODE_CONFIG_DELAY 30 462 #define C13DOF_BMI088_GYRO_RANGE_MASK 0x07 463 #define C13DOF_BMI088_GYRO_BW_MASK 0x0F 464 #define C13DOF_BMI088_GYRO_POWER_MASK 0xA0 465 #define C13DOF_BMI088_GYRO_POWER_POS 5 466 #define C13DOF_BMI088_GYRO_DATA_EN_MASK 0x80 467 #define C13DOF_BMI088_GYRO_DATA_EN_POS 7 468 #define C13DOF_BMI088_GYRO_INT3_LVL_MASK 0x01 469 #define C13DOF_BMI088_GYRO_INT3_OD_MASK 0x02 470 #define C13DOF_BMI088_GYRO_INT4_LVL_MASK 0x04 471 #define C13DOF_BMI088_GYRO_INT4_OD_MASK 0x08 472 #define C13DOF_BMI088_GYRO_INT3_OD_POS 1 473 #define C13DOF_BMI088_GYRO_INT4_LVL_POS 2 474 #define C13DOF_BMI088_GYRO_INT4_OD_POS 3 475 #define C13DOF_BMI088_GYRO_INT_EN_MASK 0x80 476 #define C13DOF_BMI088_GYRO_INT_EN_POS 7 477 #define C13DOF_BMI088_GYRO_INT3_MAP_MASK 0x01 478 #define C13DOF_BMI088_GYRO_INT4_MAP_MASK 0x80 479 #define C13DOF_BMI088_GYRO_INT3_MAP_POS 0 480 #define C13DOF_BMI088_GYRO_INT4_MAP_POS 7 481 #define C13DOF_BMI088_OK 0x00 482 #define C13DOF_BMI088_ERROR 0x01 483 #define T_C13DOF_P const uint8_t* 484 #define C13DOF_BME680_RETVAL_T uint8_t 485 #define C13DOF_BMM150_RETVAL_T uint8_t 486 #define C13DOF_BMI088_RETVAL_T uint8_t 1374 #endif // _C13DOF_H_ C13DOF_BMI088_RETVAL_T c13dof_bmi088_gyro_read_bytes(c13dof_t *ctx, uint8_t *data_out, uint8_t reg_address, uint8_t n_bytes)
Generic BMI088 Gyro sequential data read function.
uint8_t run_gas
Definition: c13dof.h:569
T_C13DOF_BME680_FIELD_DATA d_data
Definition: c13dof.h:590
int16_t mag_x
Definition: main.c:48
uint16_t heatr_temp
Definition: c13dof.h:571
int16_t mag_z
Definition: main.c:50
void c13dof_bmi088_gyro_write_byte(c13dof_t *ctx, uint8_t reg_address, uint8_t write_data)
Generic BMI088 Gyro write data function.
uint16_t par_p1
Definition: c13dof.h:531
uint8_t c13dof_bmi088_get_gyro_id(c13dof_t *ctx)
Get BMI088 Gyro ID function.
uint16_t par_h1
Definition: c13dof.h:515
uint8_t c13dof_bme680_read_byte(c13dof_t *ctx, uint8_t reg_address)
Generic BME680 read byte of data function.
Click ctx object definition.
Definition: c13dof.h:500
C13DOF_BMI088_RETVAL_T c13dof_bmi088_disable_accel(c13dof_t *ctx)
Disable BMI088 Accel function.
uint8_t c13dof_bmm150_read_byte(c13dof_t *ctx, uint8_t reg_address)
Generic BMM150 read byte of data function.
uint16_t heatr_dur
Definition: c13dof.h:573
uint32_t humidity
Definition: c13dof.h:507
int16_t accel_y
Definition: main.c:43
uint8_t par_h6
Definition: c13dof.h:520
int16_t par_p2
Definition: c13dof.h:532
void c13dof_default_cfg(c13dof_t *ctx)
Click Default Configuration function.
void c13dof_bme680_soft_reset(c13dof_t *ctx)
Software BME680 reset function.
uint8_t c13dof_bmi088_accel_read_byte(c13dof_t *ctx, uint8_t reg_address)
Generic BMI088 Accel read data function.
int8_t par_gh3
Definition: c13dof.h:525
int8_t par_h3
Definition: c13dof.h:517
#define C13DOF_BME680_RETVAL_T
Definition: c13dof.h:484
uint8_t c13dof_bmi088_get_accel_id(c13dof_t *ctx)
Get BMI088 Accel ID function.
void c13dof_bmm150_soft_reset(c13dof_t *ctx)
Software BMM150 reset function.
uint8_t bmi088Accel_slave_address
Definition: c13dof.h:588
float c13dof_bme680_get_pressure(c13dof_t *ctx)
Gets BME680 pressure in degrees Celsius function.
int8_t par_p6
Definition: c13dof.h:536
uint8_t par_p10
Definition: c13dof.h:540
int8_t par_h7
Definition: c13dof.h:521
#define C13DOF_BMM150_RETVAL_T
Definition: c13dof.h:485
C13DOF_BMI088_RETVAL_T c13dof_bmi088_set_gyro_range(c13dof_t *ctx, uint8_t gyro_range)
Set BMI088 Gyro range function.
uint8_t bmi088Accel_slave_address
Definition: c13dof.h:618
uint8_t bmm150_slave_address
Definition: c13dof.h:616
uint16_t par_t1
Definition: c13dof.h:527
float c13dof_bme680_get_temperature(c13dof_t *ctx)
Gets BME680 temperature in degrees Celsius function.
#define C13DOF_RETVAL
Definition: c13dof.h:62
void c13dof_bme680_write_byte(c13dof_t *ctx, uint8_t reg_address, uint8_t write_data)
Generic BME680 write the byte of data function.
int8_t par_p7
Definition: c13dof.h:537
uint32_t c13dof_bme680_get_gas_resistance(c13dof_t *ctx)
Gets BME680 gas resistance data function.
C13DOF_BME680_RETVAL_T c13dof_bme680_check_id(c13dof_t *ctx)
Check BME680 device ID function.
uint8_t os_temp
Definition: c13dof.h:554
uint8_t status
Definition: c13dof.h:502
float pressure
Definition: c13dof.h:506
int16_t par_t2
Definition: c13dof.h:528
uint8_t bmi088Gyro_slave_address
Definition: c13dof.h:617
int16_t par_p5
Definition: c13dof.h:535
int16_t gyro_z
Definition: main.c:47
uint8_t c13dof_bme680_get_device_id(c13dof_t *ctx)
Get BME680 device ID function.
C13DOF_RETVAL c13dof_init(c13dof_t *ctx, c13dof_cfg_t *cfg)
Initialization function.
C13DOF_BMM150_RETVAL_T c13dof_bmm150_write_byte(c13dof_t *ctx, uint8_t reg_address, uint8_t write_data)
Generic BMM150 write the byte of data function.
int16_t accel_x
Definition: main.c:42
C13DOF_BMI088_RETVAL_T c13dof_bmi088_enable_accel(c13dof_t *ctx)
Enable BMI088 Accel function.
int16_t c13dof_bmi088_get_accel_axis(c13dof_t *ctx, uint8_t adr_reg_LSB, uint8_t adr_reg_MSB)
Get BMI088 Accel axis data function.
uint8_t os_hum
Definition: c13dof.h:552
i2c_master_t i2c
Definition: c13dof.h:581
void c13dof_bmi088_set_accel_mode(c13dof_t *ctx, uint8_t active_mode)
Set BMI088 Accel mode function.
int16_t c13dof_bmi088_get_gyro_axis(c13dof_t *ctx, uint8_t adr_reg_LSB, uint8_t adr_reg_MSB)
Get BMI088 Gyro axis data function.
uint8_t os_pres
Definition: c13dof.h:556
uint8_t bmi088Gyro_slave_address
Definition: c13dof.h:587
C13DOF_BMI088_RETVAL_T c13dof_bmi088_set_accel_range(c13dof_t *ctx, uint8_t accel_range)
Set BMI088 Accel range function.
uint8_t device_power_mode
Definition: c13dof.h:596
uint8_t heatr_ctrl
Definition: c13dof.h:567
int8_t range_sw_err
Definition: c13dof.h:546
void c13dof_bmm150_read_geo_mag_data(c13dof_t *ctx, int16_t *mag_x, int16_t *mag_y, int16_t *mag_z, uint16_t *res_hall)
Get BMM150 Geomagnetic sensors data function.
void c13dof_bmi088_accel_write_bytes(c13dof_t *ctx, uint8_t reg_address, uint8_t *write_data, uint8_t n_bytes)
Generic sequential BMI088 Accel write data function.
void c13dof_bmi088_accel_write_byte(c13dof_t *ctx, uint8_t reg_address, uint8_t write_data)
Generic BMI088 Accel write data function.
int16_t par_p9
Definition: c13dof.h:539
uint16_t par_h2
Definition: c13dof.h:516
float c13dof_bme680_get_ambient_data(c13dof_t *ctx, uint8_t data_in)
Get BME680 ambient data function.
uint8_t device_mem_page
Definition: c13dof.h:595
uint8_t gas_index
Definition: c13dof.h:503
float c13dof_bme680_get_humidity(c13dof_t *ctx)
Gets BME680 humidity in percentage [ % ] function.
void c13dof_bmi088_soft_reset_giro(c13dof_t *ctx)
Software BMI088 Gyro reset function.
uint8_t nb_conv
Definition: c13dof.h:565
int8_t par_t3
Definition: c13dof.h:529
void c13dof_bmm150_power_on_reset(c13dof_t *ctx)
BMM150 power ON reset function.
int8_t par_p3
Definition: c13dof.h:533
void c13dof_bmi088_gyro_write_bytes(c13dof_t *ctx, uint8_t reg_address, uint8_t *write_data, uint8_t n_bytes)
Generic sequential BMI088 Gyro write data function.
int16_t temperature
Definition: c13dof.h:505
uint8_t res_heat_range
Definition: c13dof.h:544
uint8_t filter
Definition: c13dof.h:558
uint8_t c13dof_bmi088_check_accel_data_ready(c13dof_t *ctx)
Get BMI088 Accel error function.
int8_t res_heat_val
Definition: c13dof.h:545
int8_t par_h5
Definition: c13dof.h:519
#define C13DOF_BMI088_RETVAL_T
Definition: c13dof.h:486
pin_name_t sda
Definition: c13dof.h:610
Click configuration structure definition.
Definition: c13dof.h:605
void c13dof_bmi088_default_config(c13dof_t *ctx)
Set BMI088 Accel & Gyro default configuration fuction.
T_C13DOF_BME680_CALIB_DATA calib
Definition: c13dof.h:591
int16_t par_gh2
Definition: c13dof.h:524
void c13dof_bme680_get_calibration_data(c13dof_t *ctx)
Get BME680 factory calibration parameters function.
int8_t par_h4
Definition: c13dof.h:518
uint8_t bmm150_slave_address
Definition: c13dof.h:586
int32_t t_fine
Definition: c13dof.h:542
void c13dof_bmi088_soft_reset_accel(c13dof_t *ctx)
Set BMI088 Accel soft reset function.
C13DOF_BMI088_RETVAL_T c13dof_bmi088_accel_read_bytes(c13dof_t *ctx, uint8_t *data_out, uint8_t reg_address, uint8_t n_bytes)
Generic BMI088 Accel sequential data read function.
void c13dof_cfg_setup(c13dof_cfg_t *cfg)
Config Object Initialization function.
int16_t gyro_x
Definition: main.c:45
C13DOF_BMM150_RETVAL_T c13dof_bmm150_check_ready(c13dof_t *ctx)
Check BMM150 data ready status function.
int16_t accel_z
Definition: main.c:44
hal_i2c_speed_t i2c_speed
Definition: c13dof.h:614
int16_t par_p4
Definition: c13dof.h:534
pin_name_t scl
Definition: c13dof.h:609
C13DOF_BMM150_RETVAL_T c13dof_bmm150_read_bytes(c13dof_t *ctx, uint8_t *data_out, uint8_t reg_address, uint8_t n_bytes)
Generic BMM150 sequential data read function.
uint8_t bme680_slave_address
Definition: c13dof.h:585
C13DOF_BMI088_RETVAL_T c13dof_bmi088_set_gyro_bandwidth(c13dof_t *ctx, uint8_t gyro_bandwidth)
Set BMI088 Gyro bandwidth function.
uint8_t meas_index
Definition: c13dof.h:504
uint32_t gas_resistance
Definition: c13dof.h:508
int8_t par_gh1
Definition: c13dof.h:523
void c13dof_bmi088_read_gyro(c13dof_t *ctx, int16_t *gyro_x, int16_t *gyro_y, int16_t *gyro_z)
Get BMI088 Gyro X-axis, Y-axis and Z-axis function.
uint8_t bme680_slave_address
Definition: c13dof.h:615
T_C13DOF_BME680_TPH_SETTINGS tph_sett
Definition: c13dof.h:592
void c13dof_bmi088_set_accel_config(c13dof_t *ctx, uint8_t accel_config)
Set BMI088 Accel configuration function.
int16_t mag_y
Definition: main.c:49
T_C13DOF_BME680_GAS_SETTINGS gas_sett
Definition: c13dof.h:593
uint8_t c13dof_bmi088_gyro_read_byte(c13dof_t *ctx, uint8_t reg_address)
Generic BMI088 Gyro read data function.
void c13dof_bmi088_read_accel(c13dof_t *ctx, int16_t *accel_x, int16_t *accel_y, int16_t *accel_z)
Get BMI088 Accel X-axis, Y-axis and Z-axis function.
int16_t gyro_y
Definition: main.c:46
int16_t par_p8
Definition: c13dof.h:538