1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//use core::fmt::Formatter;
//use embedded_hal::i2c::{I2c, SevenBitAddress};
/// All possible errors
/// Display not implemented for no_std support
/***********
impl<I2C> core::fmt::Debug for Sths34pf80Error<I2C>
where
I2C: I2c<SevenBitAddress>
{
fn fmt(&self, f: &mut Formatter<'_>) -> core::result::Result<(), core::fmt::Error> {
match self {
Sths34pf80Error::WriteReadError(e) => f.debug_tuple("WriteReadError").field(e).finish(),
Sths34pf80Error::WriteError(e) => f.debug_tuple("WriteError").field(e).finish(),
Sths34pf80Error::UnexpectedChipId(chip_id) => f
.debug_tuple("Expected part id 0xd3, got : ") // ToDo: fix this one
.field(chip_id)
.finish(),
Sths34pf80Error::OpModeNotCorrect(expected) => f
.debug_tuple("Incorrect STHS34PF80 operation, got :")
.field(expected)
.finish(),
Sths34pf80Error::NotConnected => f
.debug_tuple("STH34PF80 is not connected to microcontroller")
.finish(),
Sths34pf80Error::OdrNewTooBig(value) => f
.debug_tuple("ODR new value is too big for current AVG Trim TMOS, max = ")
.field(value)
.finish(),
Sths34pf80Error::ThresholdTooBig(value) => f
.debug_tuple("Threshold set value too big, must to less than 0x8000")
.field(value)
.finish(),
Sths34pf80Error::OutOfRange() => f
.debug_tuple("Set value out of range, check STHS34PF80 datasheet")
.finish(),
Sths34pf80Error::MeasurementTimeout() => f
.debug_tuple("timeout waiting for new measurement data ready")
.finish(),
}
}
}
******/