LibDriver SCD4X
Loading...
Searching...
No Matches
driver_scd4x_register_test.c
Go to the documentation of this file.
1
36
38#include <stdlib.h>
39
40static scd4x_handle_t gs_handle;
41
51{
52 uint8_t res;
53 uint16_t reg;
54 uint16_t reg_check;
55 uint16_t number[3];
56 float f;
57 float f_check;
58 scd4x_bool_t enable;
59 scd4x_t type_check;
60 scd4x_info_t info;
61
62 /* link functions */
70
71 /* scd4x info */
72 res = scd4x_info(&info);
73 if (res != 0)
74 {
75 scd4x_interface_debug_print("scd4x: get info failed.\n");
76
77 return 1;
78 }
79 else
80 {
81 /* print chip information */
82 scd4x_interface_debug_print("scd4x: chip is %s.\n", info.chip_name);
83 scd4x_interface_debug_print("scd4x: manufacturer is %s.\n", info.manufacturer_name);
84 scd4x_interface_debug_print("scd4x: interface is %s.\n", info.interface);
85 scd4x_interface_debug_print("scd4x: driver version is %d.%d.\n", info.driver_version / 1000, (info.driver_version % 1000) / 100);
86 scd4x_interface_debug_print("scd4x: min supply voltage is %0.1fV.\n", info.supply_voltage_min_v);
87 scd4x_interface_debug_print("scd4x: max supply voltage is %0.1fV.\n", info.supply_voltage_max_v);
88 scd4x_interface_debug_print("scd4x: max current is %0.2fmA.\n", info.max_current_ma);
89 scd4x_interface_debug_print("scd4x: max temperature is %0.1fC.\n", info.temperature_max);
90 scd4x_interface_debug_print("scd4x: min temperature is %0.1fC.\n", info.temperature_min);
91 }
92
93 /* start register test */
94 scd4x_interface_debug_print("scd4x: start register test.\n");
95
96 /* scd4x_set_type/scd4x_get_type test */
97 scd4x_interface_debug_print("scd4x: scd4x_set_type/scd4x_get_type test.\n");
98
99 /* scd40 */
100 res = scd4x_set_type(&gs_handle, SCD40);
101 if (res != 0)
102 {
103 scd4x_interface_debug_print("scd4x: set type failed.\n");
104
105 return 1;
106 }
107 scd4x_interface_debug_print("scd4x: set type scd40.\n");
108 res = scd4x_get_type(&gs_handle, &type_check);
109 if (res != 0)
110 {
111 scd4x_interface_debug_print("scd4x: get type failed.\n");
112
113 return 1;
114 }
115 scd4x_interface_debug_print("scd4x: check type %s.\n", SCD40 == type_check ? "ok" : "error");
116
117 /* scd41 */
118 res = scd4x_set_type(&gs_handle, SCD41);
119 if (res != 0)
120 {
121 scd4x_interface_debug_print("scd4x: set type failed.\n");
122
123 return 1;
124 }
125 scd4x_interface_debug_print("scd4x: set type scd41.\n");
126 res = scd4x_get_type(&gs_handle, &type_check);
127 if (res != 0)
128 {
129 scd4x_interface_debug_print("scd4x: get type failed.\n");
130
131 return 1;
132 }
133 scd4x_interface_debug_print("scd4x: check type %s.\n", SCD41 == type_check ? "ok" : "error");
134
135 /* set chip type */
136 res = scd4x_set_type(&gs_handle, type);
137 if (res != 0)
138 {
139 scd4x_interface_debug_print("scd4x: set type failed.\n");
140
141 return 1;
142 }
143
144 /* scd4x init */
145 res = scd4x_init(&gs_handle);
146 if (res != 0)
147 {
148 scd4x_interface_debug_print("scd4x: init failed.\n");
149
150 return 1;
151 }
152
153 /* scd4x_set_temperature_offset/scd4x_get_temperature_offset test */
154 scd4x_interface_debug_print("scd4x: scd4x_set_temperature_offset/scd4x_get_temperature_offset test.\n");
155
156 reg = rand() % 0xFFFFU;
157 res = scd4x_set_temperature_offset(&gs_handle, reg);
158 if (res != 0)
159 {
160 scd4x_interface_debug_print("scd4x: set temperature offset failed.\n");
161 (void)scd4x_deinit(&gs_handle);
162
163 return 1;
164 }
165 scd4x_interface_debug_print("scd4x: set temperature offset %d.\n", reg);
166 res = scd4x_get_temperature_offset(&gs_handle, &reg_check);
167 if (res != 0)
168 {
169 scd4x_interface_debug_print("scd4x: get temperature offset failed.\n");
170 (void)scd4x_deinit(&gs_handle);
171
172 return 1;
173 }
174 scd4x_interface_debug_print("scd4x: check temperature offset %s.\n", reg == reg_check ? "ok" : "error");
175
176 /* scd4x_temperature_offset_convert_to_register/scd4x_temperature_offset_convert_to_data test */
177 scd4x_interface_debug_print("scd4x: scd4x_temperature_offset_convert_to_register/scd4x_temperature_offset_convert_to_data test.\n");
178
179 f = (float)(rand() % 10) + 25.0f;
180 res = scd4x_temperature_offset_convert_to_register(&gs_handle, f, &reg);
181 if (res != 0)
182 {
183 scd4x_interface_debug_print("scd4x: temperature offset convert to register failed.\n");
184 (void)scd4x_deinit(&gs_handle);
185
186 return 1;
187 }
188 scd4x_interface_debug_print("scd4x: set temperature %0.2f.\n", f);
189 res = scd4x_temperature_offset_convert_to_data(&gs_handle, reg, &f_check);
190 if (res != 0)
191 {
192 scd4x_interface_debug_print("scd4x: temperature offset convert to data failed.\n");
193 (void)scd4x_deinit(&gs_handle);
194
195 return 1;
196 }
197 scd4x_interface_debug_print("scd4x: check temperature %0.2f.\n", f_check);
198
199 /* scd4x_set_sensor_altitude/scd4x_get_sensor_altitude test */
200 scd4x_interface_debug_print("scd4x: scd4x_set_sensor_altitude/scd4x_get_sensor_altitude test.\n");
201
202 reg = rand() % 0xFFFFU;
203 res = scd4x_set_sensor_altitude(&gs_handle, reg);
204 if (res != 0)
205 {
206 scd4x_interface_debug_print("scd4x: set sensor altitude failed.\n");
207 (void)scd4x_deinit(&gs_handle);
208
209 return 1;
210 }
211 scd4x_interface_debug_print("scd4x: set sensor altitude %d.\n", reg);
212 res = scd4x_get_sensor_altitude(&gs_handle, &reg_check);
213 if (res != 0)
214 {
215 scd4x_interface_debug_print("scd4x: get sensor altitude failed.\n");
216 (void)scd4x_deinit(&gs_handle);
217
218 return 1;
219 }
220 scd4x_interface_debug_print("scd4x: check sensor altitude %s.\n", reg == reg_check ? "ok" : "error");
221
222 /* scd4x_sensor_altitude_convert_to_register/scd4x_sensor_altitude_convert_to_data test */
223 scd4x_interface_debug_print("scd4x: scd4x_sensor_altitude_convert_to_register/scd4x_sensor_altitude_convert_to_data test.\n");
224
225 f = (float)(rand() % 10) + 100.0f;
226 res = scd4x_sensor_altitude_convert_to_register(&gs_handle, f, &reg);
227 if (res != 0)
228 {
229 scd4x_interface_debug_print("scd4x: sensor altitude convert to register failed.\n");
230 (void)scd4x_deinit(&gs_handle);
231
232 return 1;
233 }
234 scd4x_interface_debug_print("scd4x: set altitude %0.2f.\n", f);
235 res = scd4x_sensor_altitude_convert_to_data(&gs_handle, reg, &f_check);
236 if (res != 0)
237 {
238 scd4x_interface_debug_print("scd4x: sensor altitude convert to data failed.\n");
239 (void)scd4x_deinit(&gs_handle);
240
241 return 1;
242 }
243 scd4x_interface_debug_print("scd4x: check altitude %0.2f.\n", f_check);
244
245 /* scd4x_set_ambient_pressure/scd4x_get_ambient_pressure test */
246 scd4x_interface_debug_print("scd4x: scd4x_set_ambient_pressure/scd4x_get_ambient_pressure test.\n");
247
248 reg = rand() % 0xFFFFU;
249 res = scd4x_set_ambient_pressure(&gs_handle, reg);
250 if (res != 0)
251 {
252 scd4x_interface_debug_print("scd4x: set ambient pressure failed.\n");
253 (void)scd4x_deinit(&gs_handle);
254
255 return 1;
256 }
257 scd4x_interface_debug_print("scd4x: set ambient pressure %d.\n", reg);
258 res = scd4x_get_ambient_pressure(&gs_handle, &reg_check);
259 if (res != 0)
260 {
261 scd4x_interface_debug_print("scd4x: get ambient pressure failed.\n");
262 (void)scd4x_deinit(&gs_handle);
263
264 return 1;
265 }
266 scd4x_interface_debug_print("scd4x: check ambient pressure %s.\n", reg == reg_check ? "ok" : "error");
267
268 /* scd4x_ambient_pressure_convert_to_register/scd4x_ambient_pressure_convert_to_data test */
269 scd4x_interface_debug_print("scd4x: scd4x_ambient_pressure_convert_to_register/scd4x_ambient_pressure_convert_to_data test.\n");
270
271 f = (float)(rand() % 1000) + 100000.0f;
272 res = scd4x_ambient_pressure_convert_to_register(&gs_handle, f, &reg);
273 if (res != 0)
274 {
275 scd4x_interface_debug_print("scd4x: ambient pressure convert to register failed.\n");
276 (void)scd4x_deinit(&gs_handle);
277
278 return 1;
279 }
280 scd4x_interface_debug_print("scd4x: set ambient pressure %0.2f.\n", f);
281 res = scd4x_ambient_pressure_convert_to_data(&gs_handle, reg, &f_check);
282 if (res != 0)
283 {
284 scd4x_interface_debug_print("scd4x: ambient pressure convert to data failed.\n");
285 (void)scd4x_deinit(&gs_handle);
286
287 return 1;
288 }
289 scd4x_interface_debug_print("scd4x: check ambient pressure %0.2f.\n", f_check);
290
291 /* scd4x_co2_convert_to_register/scd4x_co2_convert_to_data test */
292 scd4x_interface_debug_print("scd4x: scd4x_co2_convert_to_register/scd4x_co2_convert_to_data test.\n");
293
294 f = (float)(rand() % 100);
295 res = scd4x_co2_convert_to_register(&gs_handle, f, &reg);
296 if (res != 0)
297 {
298 scd4x_interface_debug_print("scd4x: co2 convert to register failed.\n");
299 (void)scd4x_deinit(&gs_handle);
300
301 return 1;
302 }
303 scd4x_interface_debug_print("scd4x: set co2 %0.2f.\n", f);
304 res = scd4x_co2_convert_to_data(&gs_handle, reg, &f_check);
305 if (res != 0)
306 {
307 scd4x_interface_debug_print("scd4x: co2 convert to data failed.\n");
308 (void)scd4x_deinit(&gs_handle);
309
310 return 1;
311 }
312 scd4x_interface_debug_print("scd4x: check co2 %0.2f.\n", f_check);
313
314 /* scd4x_set_automatic_self_calibration/scd4x_get_automatic_self_calibration test */
315 scd4x_interface_debug_print("scd4x: scd4x_set_automatic_self_calibration/scd4x_get_automatic_self_calibration test.\n");
316
317 /* disable */
319 if (res != 0)
320 {
321 scd4x_interface_debug_print("scd4x: set automatic self calibration failed.\n");
322 (void)scd4x_deinit(&gs_handle);
323
324 return 1;
325 }
326 scd4x_interface_debug_print("scd4x: disable automatic self calibration.\n");
327 res = scd4x_get_automatic_self_calibration(&gs_handle, &enable);
328 if (res != 0)
329 {
330 scd4x_interface_debug_print("scd4x: get automatic self calibration failed.\n");
331 (void)scd4x_deinit(&gs_handle);
332
333 return 1;
334 }
335 scd4x_interface_debug_print("scd4x: check automatic self calibration %s.\n", enable == SCD4X_BOOL_FALSE ? "ok" : "error");
336
337 /* enable */
339 if (res != 0)
340 {
341 scd4x_interface_debug_print("scd4x: set automatic self calibration failed.\n");
342 (void)scd4x_deinit(&gs_handle);
343
344 return 1;
345 }
346 scd4x_interface_debug_print("scd4x: enable automatic self calibration.\n");
347 res = scd4x_get_automatic_self_calibration(&gs_handle, &enable);
348 if (res != 0)
349 {
350 scd4x_interface_debug_print("scd4x: get automatic self calibration failed.\n");
351 (void)scd4x_deinit(&gs_handle);
352
353 return 1;
354 }
355 scd4x_interface_debug_print("scd4x: check automatic self calibration %s.\n", enable == SCD4X_BOOL_TRUE ? "ok" : "error");
356
357 /* scd4x_get_data_ready_status test */
358 scd4x_interface_debug_print("scd4x: scd4x_get_data_ready_status test.\n");
359
360 /* get data ready status */
361 res = scd4x_get_data_ready_status(&gs_handle, &enable);
362 if (res != 0)
363 {
364 scd4x_interface_debug_print("scd4x: get data ready status failed.\n");
365 (void)scd4x_deinit(&gs_handle);
366
367 return 1;
368 }
369 scd4x_interface_debug_print("scd4x: check data ready status %s.\n", enable == SCD4X_BOOL_TRUE ? "ready" : "not ready");
370
371 /* scd4x_get_serial_number test */
372 scd4x_interface_debug_print("scd4x: scd4x_get_serial_number test.\n");
373
374 /* get serial number */
375 res = scd4x_get_serial_number(&gs_handle, number);
376 if (res != 0)
377 {
378 scd4x_interface_debug_print("scd4x: get serial number failed.\n");
379 (void)scd4x_deinit(&gs_handle);
380
381 return 1;
382 }
383 scd4x_interface_debug_print("scd4x: serial number is 0x%04X%04X%04X.\n", number[0], number[1], number[2]);
384
385 /* scd4x_perform_self_test test */
386 scd4x_interface_debug_print("scd4x: scd4x_perform_self_test test.\n");
387
388 /* perform self test */
389 res = scd4x_perform_self_test(&gs_handle, &enable);
390 if (res != 0)
391 {
392 scd4x_interface_debug_print("scd4x: perform self test failed.\n");
393 (void)scd4x_deinit(&gs_handle);
394
395 return 1;
396 }
397 scd4x_interface_debug_print("scd4x: check perform self test %s.\n", enable == SCD4X_BOOL_FALSE ? "ok" : "error");
398
399 /* scd4x_perform_factory_reset test */
400 scd4x_interface_debug_print("scd4x: scd4x_perform_factory_reset test.\n");
401
402 /* perform factory reset */
403 res = scd4x_perform_factory_reset(&gs_handle);
404 if (res != 0)
405 {
406 scd4x_interface_debug_print("scd4x: perform factory reset failed.\n");
407 (void)scd4x_deinit(&gs_handle);
408
409 return 1;
410 }
411 scd4x_interface_debug_print("scd4x: check perform factory reset %s.\n", res == 0 ? "ok" : "error");
412
413 /* scd4x_reinit test */
414 scd4x_interface_debug_print("scd4x: scd4x_reinit test.\n");
415
416 /* reinit */
417 res = scd4x_reinit(&gs_handle);
418 if (res != 0)
419 {
420 scd4x_interface_debug_print("scd4x: reinit failed.\n");
421 (void)scd4x_deinit(&gs_handle);
422
423 return 1;
424 }
425 scd4x_interface_debug_print("scd4x: check reinit %s.\n", res == 0 ? "ok" : "error");
426
427 /* scd4x_persist_settings test */
428 scd4x_interface_debug_print("scd4x: scd4x_persist_settings test.\n");
429
430 /* persist settings */
431 res = scd4x_persist_settings(&gs_handle);
432 if (res != 0)
433 {
434 scd4x_interface_debug_print("scd4x: persist settings failed.\n");
435 (void)scd4x_deinit(&gs_handle);
436
437 return 1;
438 }
439 scd4x_interface_debug_print("scd4x: check persist settings %s.\n", res == 0 ? "ok" : "error");
440
441 /* scd4x_perform_forced_recalibration test */
442 scd4x_interface_debug_print("scd4x: scd4x_perform_forced_recalibration test.\n");
443
444 res = scd4x_stop_periodic_measurement(&gs_handle);
445 if (res != 0)
446 {
447 scd4x_interface_debug_print("scd4x: stop periodic measurement failed.\n");
448 (void)scd4x_deinit(&gs_handle);
449
450 return 1;
451 }
452 reg = rand() % 5;
453 res = scd4x_perform_forced_recalibration(&gs_handle, reg, &reg_check);
454 if (res != 0)
455 {
456 scd4x_interface_debug_print("scd4x: perform forced recalibration failed.\n");
457 (void)scd4x_deinit(&gs_handle);
458
459 return 1;
460 }
461 scd4x_interface_debug_print("scd4x: check perform forced recalibration 0x%04X.\n", reg_check);
462
463 /* scd41 && scd43 test */
464 if (type != SCD40)
465 {
466 /* scd4x_power_down/scd4x_wake_up test */
467 scd4x_interface_debug_print("scd4x: scd4x_power_down/scd4x_wake_up test.\n");
468
469 /* power down */
470 res = scd4x_power_down(&gs_handle);
471 if (res != 0)
472 {
473 scd4x_interface_debug_print("scd4x: power down failed.\n");
474 (void)scd4x_deinit(&gs_handle);
475
476 return 1;
477 }
478 scd4x_interface_debug_print("scd4x: power down.\n");
479
480 /* wake up */
481 res = scd4x_wake_up(&gs_handle);
482 if (res != 0)
483 {
484 scd4x_interface_debug_print("scd4x: wake up failed.\n");
485 (void)scd4x_deinit(&gs_handle);
486
487 return 1;
488 }
489 scd4x_interface_debug_print("scd4x: wake up.\n");
490
491 /* scd4x_set_automatic_self_calibration_initial_period/scd4x_get_automatic_self_calibration_initial_period test */
492 scd4x_interface_debug_print("scd4x: scd4x_set_automatic_self_calibration_initial_period/scd4x_get_automatic_self_calibration_initial_period test.\n");
493
494 reg = (rand() % 0xFF) * 4;
496 if (res != 0)
497 {
498 scd4x_interface_debug_print("scd4x: set automatic self calibration initial period failed.\n");
499 (void)scd4x_deinit(&gs_handle);
500
501 return 1;
502 }
503 scd4x_interface_debug_print("scd4x: set automatic self calibration initial period %d.\n", reg);
504 res = scd4x_get_automatic_self_calibration_initial_period(&gs_handle, &reg_check);
505 if (res != 0)
506 {
507 scd4x_interface_debug_print("scd4x: get automatic self calibration initial period failed.\n");
508 (void)scd4x_deinit(&gs_handle);
509
510 return 1;
511 }
512 scd4x_interface_debug_print("scd4x: check automatic self calibration initial period %s.\n", reg == reg_check ? "ok" : "error");
513
514 /* scd4x_set_automatic_self_calibration_standard_period/scd4x_get_automatic_self_calibration_standard_period test */
515 scd4x_interface_debug_print("scd4x: scd4x_set_automatic_self_calibration_standard_period/scd4x_get_automatic_self_calibration_standard_period test.\n");
516
517 reg = (rand() % 0xFF) * 4;
519 if (res != 0)
520 {
521 scd4x_interface_debug_print("scd4x: set automatic self calibration standard period failed.\n");
522 (void)scd4x_deinit(&gs_handle);
523
524 return 1;
525 }
526 scd4x_interface_debug_print("scd4x: set automatic self calibration standard period %d.\n", reg);
527 res = scd4x_get_automatic_self_calibration_standard_period(&gs_handle, &reg_check);
528 if (res != 0)
529 {
530 scd4x_interface_debug_print("scd4x: get automatic self calibration standard period failed.\n");
531 (void)scd4x_deinit(&gs_handle);
532
533 return 1;
534 }
535 scd4x_interface_debug_print("scd4x: check automatic self calibration standard period %s.\n", reg == reg_check ? "ok" : "error");
536 }
537
538 /* finish register test */
539 scd4x_interface_debug_print("scd4x: finish register test.\n");
540 (void)scd4x_deinit(&gs_handle);
541
542 return 0;
543}
driver scd4x register test header file
uint8_t scd4x_wake_up(scd4x_handle_t *handle)
wake up
uint8_t scd4x_set_automatic_self_calibration_standard_period(scd4x_handle_t *handle, uint16_t hour)
set automatic self calibration standard period
uint8_t scd4x_set_automatic_self_calibration_initial_period(scd4x_handle_t *handle, uint16_t hour)
set automatic self calibration initial period
uint8_t scd4x_power_down(scd4x_handle_t *handle)
power down
uint8_t scd4x_get_automatic_self_calibration_standard_period(scd4x_handle_t *handle, uint16_t *hour)
get automatic self calibration standard period
uint8_t scd4x_get_automatic_self_calibration_initial_period(scd4x_handle_t *handle, uint16_t *hour)
get automatic self calibration initial period
struct scd4x_info_s scd4x_info_t
scd4x information structure definition
uint8_t scd4x_get_type(scd4x_handle_t *handle, scd4x_t *type)
get type
uint8_t scd4x_get_data_ready_status(scd4x_handle_t *handle, scd4x_bool_t *enable)
get data ready status
uint8_t scd4x_stop_periodic_measurement(scd4x_handle_t *handle)
stop periodic measurement
uint8_t scd4x_get_sensor_altitude(scd4x_handle_t *handle, uint16_t *altitude)
get sensor altitude
uint8_t scd4x_sensor_altitude_convert_to_data(scd4x_handle_t *handle, uint16_t reg, float *m)
convert the register raw data to the sensor altitude
uint8_t scd4x_set_temperature_offset(scd4x_handle_t *handle, uint16_t offset)
set temperature offset
uint8_t scd4x_get_serial_number(scd4x_handle_t *handle, uint16_t number[3])
get serial number
uint8_t scd4x_deinit(scd4x_handle_t *handle)
close the chip
uint8_t scd4x_get_automatic_self_calibration(scd4x_handle_t *handle, scd4x_bool_t *enable)
get automatic self calibration status
uint8_t scd4x_set_ambient_pressure(scd4x_handle_t *handle, uint16_t pressure)
set ambient pressure
uint8_t scd4x_co2_convert_to_register(scd4x_handle_t *handle, float ppm, uint16_t *reg)
convert the co2 to the register raw data
uint8_t scd4x_set_type(scd4x_handle_t *handle, scd4x_t type)
set type
uint8_t scd4x_get_temperature_offset(scd4x_handle_t *handle, uint16_t *offset)
get temperature offset
uint8_t scd4x_temperature_offset_convert_to_register(scd4x_handle_t *handle, float degrees, uint16_t *reg)
convert the temperature offset to the register raw data
uint8_t scd4x_reinit(scd4x_handle_t *handle)
reinit
uint8_t scd4x_ambient_pressure_convert_to_register(scd4x_handle_t *handle, float pa, uint16_t *reg)
convert the ambient pressure to the register raw data
uint8_t scd4x_co2_convert_to_data(scd4x_handle_t *handle, uint16_t reg, float *ppm)
convert the register raw data to the co2
uint8_t scd4x_set_automatic_self_calibration(scd4x_handle_t *handle, scd4x_bool_t enable)
enable or disable automatic self calibration
uint8_t scd4x_init(scd4x_handle_t *handle)
initialize the chip
uint8_t scd4x_perform_forced_recalibration(scd4x_handle_t *handle, uint16_t co2_raw, uint16_t *frc)
perform forced recalibration
uint8_t scd4x_perform_factory_reset(scd4x_handle_t *handle)
perform factory reset
uint8_t scd4x_persist_settings(scd4x_handle_t *handle)
persist settings
struct scd4x_handle_s scd4x_handle_t
scd4x handle structure definition
uint8_t scd4x_perform_self_test(scd4x_handle_t *handle, scd4x_bool_t *malfunction_detected)
perform self test
uint8_t scd4x_info(scd4x_info_t *info)
get chip information
uint8_t scd4x_ambient_pressure_convert_to_data(scd4x_handle_t *handle, uint16_t reg, float *pa)
convert the register raw data to the ambient pressure
uint8_t scd4x_set_sensor_altitude(scd4x_handle_t *handle, uint16_t altitude)
set sensor altitude
uint8_t scd4x_sensor_altitude_convert_to_register(scd4x_handle_t *handle, float m, uint16_t *reg)
convert the sensor altitude to the register raw data
uint8_t scd4x_temperature_offset_convert_to_data(scd4x_handle_t *handle, uint16_t reg, float *degrees)
convert the register raw data to the temperature offset
scd4x_t
scd4x type enumeration definition
scd4x_bool_t
scd4x bool enumeration definition
uint8_t scd4x_get_ambient_pressure(scd4x_handle_t *handle, uint16_t *pressure)
get ambient pressure
@ SCD41
@ SCD40
@ SCD4X_BOOL_TRUE
@ SCD4X_BOOL_FALSE
uint8_t scd4x_interface_iic_init(void)
interface iic bus init
void scd4x_interface_delay_ms(uint32_t ms)
interface delay ms
uint8_t scd4x_interface_iic_deinit(void)
interface iic bus deinit
uint8_t scd4x_interface_iic_read_cmd(uint8_t addr, uint8_t *buf, uint16_t len)
interface iic bus read command
void scd4x_interface_debug_print(const char *const fmt,...)
interface print format data
uint8_t scd4x_interface_iic_write_cmd(uint8_t addr, uint8_t *buf, uint16_t len)
interface iic bus write command
uint8_t scd4x_register_test(scd4x_t type)
register test
float temperature_max
float supply_voltage_max_v
uint32_t driver_version
float temperature_min
float max_current_ma
char manufacturer_name[32]
float supply_voltage_min_v
char interface[8]
char chip_name[32]