bmp280_core/
registers.rs

1pub const ID: u8 = 0x58;
2
3pub const RESET: u8 = 0xb6;
4
5#[derive(Copy, Clone)]
6pub enum Register {
7    Calib0 = 0x88,
8    Id = 0xd0,
9    Reset = 0xe0,
10    Status = 0xf3,
11    ControlMeasurement = 0xf4,
12    Config = 0xf5,
13    PressureMsb = 0xf7,
14    PressureLsb = 0xf8,
15    PressureXLsb = 0xf9,
16    TemperatureMsb = 0xfa,
17    TemperatureLsb = 0xfb,
18    TemperatureXLsb = 0xfc,
19}
20
21pub enum TemperatureOversampling {
22    Skipped = 0x0,
23    UltraLowPower = 0x1,
24    LowPower = 0x2,
25    StandardResolution = 0x3,
26    HighResolution = 0x4,
27    UltraHighResolution = 0x5,
28}
29
30#[macro_export]
31macro_rules! temperature_resolution {
32    (16bit/0.0050dC) => {
33        TemperatureOversampling::UltraLowPower
34    };
35    (17bit/0.0025dC) => {
36        TemperatureOversampling::LowPower
37    };
38    (18bit/0.0012dC) => {
39        TemperatureOversampling::StandardResolution
40    };
41    (19bit/0.0006dC) => {
42        TemperatureOversampling::HighResolution
43    };
44    (20bit/0.0003dC) => {
45        TemperatureOversampling::UltraHighResolution
46    };
47}
48
49pub enum PressureOversampling {
50    Skipped = 0x0,
51    UltraLowPower = 0x1,
52    LowPower = 0x2,
53    StandardResolution = 0x3,
54    HighResolution = 0x4,
55    UltraHighResolution = 0x5,
56}
57
58#[macro_export]
59macro_rules! pressure_resolution {
60    (16bit/2.62Pa) => {
61        PressureOversampling::UltraLowPower
62    };
63    (17bit/1.31Pa) => {
64        PressureOversampling::LowPower
65    };
66    (18bit/0.66Pa) => {
67        PressureOversampling::StandardResolution
68    };
69    (19bit/0.33Pa) => {
70        PressureOversampling::HighResolution
71    };
72    (20bit/0.16Pa) => {
73        PressureOversampling::UltraHighResolution
74    };
75}
76
77pub enum StandbyTime {
78    Hertz2000 = 0,
79    Hertz16,
80    Hertz8,
81    Hertz4,
82    Hertz2,
83    Second,
84    Second2,
85    Second4,
86}