diff --git a/l0dable/src/bhi160.rs b/l0dable/src/bhi160.rs index 6e16af2193d86048de8ee72dd5a5470bfda64fa9..47be7de65a1244c24413e0f52446c273a40c2c22 100644 --- a/l0dable/src/bhi160.rs +++ b/l0dable/src/bhi160.rs @@ -40,6 +40,7 @@ impl SensorType for Orientation { } } +const DATA_MAX: usize = 10; pub struct Sensor<S: SensorType> { stream_id: i32, @@ -64,7 +65,7 @@ impl<S: SensorType> Sensor<S> { } pub fn read(&self) -> SensorData<S> { - let mut buf: [bhi160_data_vector; 100] = unsafe { + let mut buf: [bhi160_data_vector; DATA_MAX] = unsafe { uninitialized() }; let n = unsafe { @@ -87,8 +88,6 @@ impl<S: SensorType> Drop for Sensor<S> { } } -const DATA_MAX: usize = 10; - pub struct SensorData<S> { buf: [bhi160_data_vector; DATA_MAX], n: usize,