Nexus Embedded Platform 0.1.0
Statically assembled reusable embedded mechanisms
Loading...
Searching...
No Matches
bmp280.h
Go to the documentation of this file.
1
6#ifndef NEXUS_COMPONENTS_BMP280_H
7#define NEXUS_COMPONENTS_BMP280_H
8#include "nexus/core/time.h"
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
22typedef struct {
23 void* context;
24 nx_result_t (*exchange)(void*, const uint8_t*, uint8_t*, size_t,
25 nx_time_us_t deadline);
28
30typedef struct {
31 uint16_t t1;
32 int16_t t2;
33 int16_t t3;
34 uint16_t p1;
35 int16_t p2;
36 int16_t p3;
37 int16_t p4;
38 int16_t p5;
39 int16_t p6;
40 int16_t p7;
41 int16_t p8;
42 int16_t p9;
44
46typedef struct {
48 uint32_t pressure_pa;
50
60
68nx_result_t nx_bmp280_parse_calibration(const uint8_t* bytes, size_t length,
69 nx_bmp280_calibration_t* calibration);
81 uint32_t raw_temperature,
82 uint32_t raw_pressure,
83 nx_bmp280_sample_t* sample);
96 nx_time_us_t deadline);
124
125#ifdef __cplusplus
126}
127#endif
128
129#endif /* NEXUS_COMPONENTS_BMP280_H */
nx_result_t nx_bmp280_compensate(const nx_bmp280_calibration_t *calibration, uint32_t raw_temperature, uint32_t raw_pressure, nx_bmp280_sample_t *sample)
Compensate one raw sample using checked integer arithmetic.
void nx_bmp280_stop(nx_bmp280_t *device)
Stop software use after all synchronous calls have exited.
nx_result_t nx_bmp280_poll(nx_bmp280_t *device, nx_bmp280_sample_t *sample)
Poll conversion without an implicit worker or blocking delay.
nx_result_t nx_bmp280_init(nx_bmp280_t *device, nx_bmp280_transport_port_t transport, nx_time_us_t deadline)
Validate chip ID and load calibration, without scanning.
nx_result_t nx_bmp280_begin(nx_bmp280_t *device, nx_time_us_t deadline)
Start one forced temperature/pressure conversion.
nx_result_t nx_bmp280_parse_calibration(const uint8_t *bytes, size_t length, nx_bmp280_calibration_t *calibration)
Parse the exact 24-byte little-endian calibration block.
nx_result_t
Operation result; success at submission means admission only.
Definition status.h:21
Register calibration, owned by one device instance.
Definition bmp280.h:30
Output is valid only on successful conversion/compensation.
Definition bmp280.h:46
uint32_t pressure_pa
Definition bmp280.h:48
int32_t centi_celsius
Definition bmp280.h:47
Explicit device context, no Board pins or automatic sampling task.
Definition bmp280.h:52
bool initialized
Definition bmp280.h:57
nx_time_us_t deadline
Definition bmp280.h:55
nx_bmp280_calibration_t calibration
Definition bmp280.h:54
nx_time_us_t earliest_ready
Definition bmp280.h:56
bool measuring
Definition bmp280.h:58
nx_bmp280_transport_port_t transport
Definition bmp280.h:53
Synchronous settled SPI transaction port.
Definition bmp280.h:22
nx_result_t(* exchange)(void *, const uint8_t *, uint8_t *, size_t, nx_time_us_t deadline)
Definition bmp280.h:24
An explicitly injected clock; its context outlives all borrowers.
Definition time.h:26
Absolute monotonic microsecond deadlines and wrap extension.
uint64_t nx_time_us_t
Microseconds in one boot/clock domain; no wall-clock semantics.
Definition time.h:20