File tree 8 files changed +31
-3
lines changed
8 files changed +31
-3
lines changed Original file line number Diff line number Diff line change 24
24
source $HOME/.cargo/env
25
25
# Test with and without std
26
26
cargo test
27
- cargo test --no-default-features
27
+ cargo test --no-default-features --features libm
28
28
# TODO: Add clippy and rustfmt lints. When doing that, make sure to add those
29
29
# components to the rustup task above.
30
30
- test-docs : |
Original file line number Diff line number Diff line change @@ -28,8 +28,9 @@ linux-embedded-hal = "0.3"
28
28
29
29
[features ]
30
30
default = [" std" ]
31
- std = [" arrayvec/std" ]
32
31
examples = [" anyhow" , " linux-embedded-hal" , " std" ]
32
+ libm = [" num-traits/libm" ]
33
+ std = [" arrayvec/std" , " num-traits/std" ]
33
34
34
35
[[example ]]
35
36
name = " true-frame-rate"
Original file line number Diff line number Diff line change @@ -54,6 +54,11 @@ use core::convert::TryInto;
54
54
55
55
use embedded_hal:: blocking:: i2c;
56
56
57
+ // Various floating point operations are not implemented in core, so we use libm to provide them as
58
+ // needed.
59
+ #[ cfg_attr( feature = "std" , allow( unused_imports) ) ]
60
+ use num_traits:: Float ;
61
+
57
62
use crate :: common:: { Address , CalibrationData , MelexisCamera } ;
58
63
use crate :: register:: Subpage ;
59
64
Original file line number Diff line number Diff line change 110
110
111
111
#![ no_std]
112
112
113
+ #[ cfg( not( any( feature = "std" , feature = "libm" ) ) ) ]
114
+ compile_error ! ( "Either the 'std' or 'libm' feature must be enabled." ) ;
115
+
113
116
pub mod calculations;
114
117
pub mod common;
115
118
pub mod driver;
Original file line number Diff line number Diff line change @@ -5,6 +5,11 @@ use core::slice;
5
5
use arrayvec:: ArrayVec ;
6
6
use embedded_hal:: blocking:: i2c;
7
7
8
+ // Various floating point operations are not implemented in core, so we use libm to provide them as
9
+ // needed.
10
+ #[ cfg_attr( feature = "std" , allow( unused_imports) ) ]
11
+ use num_traits:: Float ;
12
+
8
13
use crate :: common:: * ;
9
14
use crate :: error:: { Error , LibraryError } ;
10
15
use crate :: expose_member;
Original file line number Diff line number Diff line change 3
3
mod address;
4
4
mod eeprom;
5
5
6
- pub use eeprom:: Mlx90640Calibration ;
6
+ // Various floating point operations are not implemented in core, so we use libm to provide them as
7
+ // needed.
8
+ #[ cfg_attr( feature = "std" , allow( unused_imports) ) ]
9
+ use num_traits:: Float ;
7
10
8
11
use crate :: common:: { Address , MelexisCamera , PixelAddressRange } ;
9
12
use crate :: register:: { AccessPattern , Subpage } ;
10
13
11
14
pub use address:: RamAddress ;
15
+ pub use eeprom:: Mlx90640Calibration ;
12
16
13
17
/// The height of the image captured by sensor in pixels.
14
18
pub const HEIGHT : usize = 24 ;
Original file line number Diff line number Diff line change @@ -8,6 +8,11 @@ use core::slice;
8
8
use arrayvec:: ArrayVec ;
9
9
use embedded_hal:: blocking:: i2c;
10
10
11
+ // Various floating point operations are not implemented in core, so we use libm to provide them as
12
+ // needed.
13
+ #[ cfg_attr( feature = "std" , allow( unused_imports) ) ]
14
+ use num_traits:: Float ;
15
+
11
16
use crate :: common:: * ;
12
17
use crate :: error:: { Error , LibraryError } ;
13
18
use crate :: expose_member;
Original file line number Diff line number Diff line change @@ -4,6 +4,11 @@ mod address;
4
4
mod eeprom;
5
5
pub mod hamming;
6
6
7
+ // Various floating point operations are not implemented in core, so we use libm to provide them as
8
+ // needed.
9
+ #[ cfg_attr( feature = "std" , allow( unused_imports) ) ]
10
+ use num_traits:: Float ;
11
+
7
12
use core:: cmp:: Ordering ;
8
13
use core:: iter;
9
14
You can’t perform that action at this time.
0 commit comments