We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ebadc3e commit aae9798Copy full SHA for aae9798
examples/hello.rs
examples/timer_subscribe.rs
@@ -0,0 +1,29 @@
1
+#![no_std]
2
+
3
+use core::fmt::Write;
4
+use futures::future;
5
+use libtock::result::TockResult;
6
+use libtock::timer::Duration;
7
+use libtock::Drivers;
8
9
+#[libtock::main]
10
+async fn main() -> TockResult<()> {
11
+ let Drivers {
12
+ console_driver,
13
+ mut timer_context,
14
+ ..
15
+ } = libtock::retrieve_drivers()?;
16
+ let mut console = console_driver.create_console();
17
+ let mut with_callback = timer_context.with_callback(|_, _| {
18
+ writeln!(
19
+ console,
20
+ "This line is printed 2 seconds after the start of the program.",
21
+ )
22
+ .unwrap();
23
+ });
24
25
+ let mut timer = with_callback.init()?;
26
+ timer.set_alarm(Duration::from_ms(2000))?;
27
28
+ future::pending().await
29
+}
0 commit comments