From a44a3bad7c04a31b29e5ccde5e28600c2c464eff Mon Sep 17 00:00:00 2001
From: Astro <astro@spaceboyz.net>
Date: Fri, 23 Aug 2019 11:59:51 +0200
Subject: [PATCH] bhi160: fix buf capacity

---
 l0dable/src/bhi160.rs | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/l0dable/src/bhi160.rs b/l0dable/src/bhi160.rs
index 6e16af21..47be7de6 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,
-- 
GitLab