@@ -8,6 +8,8 @@ use alloc::fmt::Write;
88use tock:: console:: Console ;
99use tock:: ipc:: ble_ess:: { self , ReadingType } ;
1010use tock:: sensors:: * ;
11+ use tock:: timer;
12+ use tock:: timer:: Duration ;
1113
1214fn main ( ) {
1315 let mut console = Console :: new ( ) ;
@@ -17,7 +19,7 @@ fn main() {
1719 Ok ( ess) => ess,
1820 _ => {
1921 write ! ( & mut console, "BLE IPC Service not installed\n " ) . unwrap ( ) ;
20- return
22+ return ;
2123 }
2224 } ;
2325 write ! ( & mut console, "Found BLE IPC Service\n " ) . unwrap ( ) ;
@@ -26,14 +28,13 @@ fn main() {
2628 let mut temperature = TemperatureSensor ;
2729 let mut light = AmbientLightSensor ;
2830 loop {
29-
3031 // Temperature
3132 let temp = temperature. read ( ) ;
3233 write ! ( & mut console, "Temperature: {}\n " , temp) . unwrap ( ) ;
3334 if let Err ( _) = ess. set_reading ( ReadingType :: Temperature , temp) {
3435 write ! ( & mut console, "Failed to set temperature\n " ) . unwrap_or ( ( ) ) ;
3536 }
36-
37+
3738 // Light
3839 let lx = light. read ( ) ;
3940 write ! ( & mut console, "Light: {}\n " , lx) . unwrap ( ) ;
@@ -48,7 +49,6 @@ fn main() {
4849 write ! ( & mut console, "Failed to set temperature\n " ) . unwrap_or ( ( ) ) ;
4950 }
5051
51- tock :: timer :: delay_ms ( 5000 ) ;
52+ timer :: sleep ( Duration :: from_ms ( 5000 ) )
5253 }
5354}
54-
0 commit comments