Remove duplicated alarm syscall. (#636)

The alarm syscall is implemented in libtock-rs, but was duplicated here.
This removes the duplicated code and changes the references to point to
libtock-rs directly.

Co-authored-by: kaczmarczyck <43844792+kaczmarczyck@users.noreply.github.com>
This commit is contained in:
Zach Halvorsen
2023-07-11 08:42:50 -07:00
committed by GitHub
parent a274a512f7
commit 8868752e37
7 changed files with 31 additions and 121 deletions

View File

@@ -18,6 +18,7 @@ libtock_drivers = { path = "../libtock-drivers" }
libtock_platform = { path = "../../third_party/libtock-rs/platform" }
libtock_low_level_debug = { path = "../../third_party/libtock-rs/apis/low_level_debug" }
libtock_leds = { path = "../../third_party/libtock-rs/apis/leds" }
libtock_alarm = { path = "../../third_party/libtock-rs/apis/alarm" }
libtock_console = { path = "../../third_party/libtock-rs/apis/console" }
[dependencies.linked_list_allocator]

View File

@@ -1,4 +1,4 @@
use libtock_drivers::timer;
use libtock_alarm::{Alarm, Milliseconds};
use libtock_leds::Leds;
use libtock_low_level_debug::{AlertCode, LowLevelDebug};
use libtock_platform as platform;
@@ -28,13 +28,13 @@ impl<S: Syscalls, C: platform::subscribe::Config> Util<S, C> {
let _ = Leds::<S>::on(led);
}
}
let _ = timer::Alarm::<S, C>::sleep_for(timer::Milliseconds(100));
let _ = Alarm::<S, C>::sleep_for(Milliseconds(100));
if let Ok(led_count) = Leds::<S>::count() {
for led in 0..led_count {
let _ = Leds::<S>::off(led);
}
}
let _ = timer::Alarm::<S, C>::sleep_for(timer::Milliseconds(100));
let _ = Alarm::<S, C>::sleep_for(Milliseconds(100));
}
}
@@ -47,7 +47,7 @@ impl<S: Syscalls, C: platform::subscribe::Config> Util<S, C> {
if let Ok(leds) = Leds::<S>::count() {
for led in 0..leds {
let _ = Leds::<S>::on(led);
let _ = timer::Alarm::<S, C>::sleep_for(timer::Milliseconds(100));
let _ = Alarm::<S, C>::sleep_for(Milliseconds(100));
let _ = Leds::<S>::off(led);
}
}