Re-export main macro
diff --git a/examples/adc.rs b/examples/adc.rs
index 14d4277..c4aafb2 100644
--- a/examples/adc.rs
+++ b/examples/adc.rs
@@ -6,9 +6,8 @@
use libtock::result::TockResult;
use libtock::timer;
use libtock::timer::Duration;
-use libtock_support_macros::libtock_main;
-#[libtock_main]
+#[libtock::main]
async fn main() -> TockResult<()> {
let mut console = Console::new();
let mut with_callback = adc::with_callback(|channel: usize, value: usize| {
diff --git a/examples/adc_buffer.rs b/examples/adc_buffer.rs
index 697a7cd..b1d8fe0 100644
--- a/examples/adc_buffer.rs
+++ b/examples/adc_buffer.rs
@@ -6,9 +6,8 @@
use libtock::console::Console;
use libtock::result::TockResult;
use libtock::syscalls;
-use libtock_support_macros::libtock_main;
-#[libtock_main]
+#[libtock::main]
/// Reads a 128 byte sample into a buffer and prints the first value to the console.
async fn main() -> TockResult<()> {
let mut console = Console::new();
diff --git a/examples/async.rs b/examples/async.rs
index fcd0c04..fa661dd 100644
--- a/examples/async.rs
+++ b/examples/async.rs
@@ -8,9 +8,8 @@
use libtock::result::TockResult;
use libtock::timer;
use libtock::timer::Duration;
-use libtock_support_macros::libtock_main;
-#[libtock_main]
+#[libtock::main]
async fn main() -> TockResult<()> {
future::try_join(blink_periodically(), blink_on_button_press()).await?;
Ok(())
diff --git a/examples/ble_scanning.rs b/examples/ble_scanning.rs
index 75d7808..78de325 100644
--- a/examples/ble_scanning.rs
+++ b/examples/ble_scanning.rs
@@ -7,7 +7,6 @@
use libtock::simple_ble;
use libtock::simple_ble::BleCallback;
use libtock::simple_ble::BleDriver;
-use libtock_support_macros::libtock_main;
use serde::Deserialize;
#[derive(Deserialize)]
@@ -16,7 +15,7 @@
pub st: bool,
}
-#[libtock_main]
+#[libtock::main]
async fn main() -> TockResult<()> {
let mut shared_buffer = BleDriver::create_scan_buffer();
let mut my_buffer = BleDriver::create_scan_buffer();
diff --git a/examples/blink.rs b/examples/blink.rs
index ed987ce..aa75f36 100644
--- a/examples/blink.rs
+++ b/examples/blink.rs
@@ -4,9 +4,8 @@
use libtock::result::TockResult;
use libtock::timer;
use libtock::timer::Duration;
-use libtock_support_macros::libtock_main;
-#[libtock_main]
+#[libtock::main]
async fn main() -> TockResult<()> {
let num_leds = led::count()?;
diff --git a/examples/blink_random.rs b/examples/blink_random.rs
index a3bf38f..2298958 100644
--- a/examples/blink_random.rs
+++ b/examples/blink_random.rs
@@ -5,9 +5,8 @@
use libtock::rng;
use libtock::timer;
use libtock::timer::Duration;
-use libtock_support_macros::libtock_main;
-#[libtock_main]
+#[libtock::main]
async fn main() -> TockResult<()> {
let num_leds = led::count().ok().unwrap();
// blink_nibble assumes 4 leds.
diff --git a/examples/button_leds.rs b/examples/button_leds.rs
index 43b5929..294d45a 100644
--- a/examples/button_leds.rs
+++ b/examples/button_leds.rs
@@ -5,9 +5,8 @@
use libtock::buttons::ButtonState;
use libtock::led;
use libtock::result::TockResult;
-use libtock_support_macros::libtock_main;
-#[libtock_main]
+#[libtock::main]
async fn main() -> TockResult<()> {
let mut with_callback = buttons::with_callback(|button_num: usize, state| {
match state {
diff --git a/examples/button_read.rs b/examples/button_read.rs
index 0c074f9..12648c1 100644
--- a/examples/button_read.rs
+++ b/examples/button_read.rs
@@ -7,9 +7,8 @@
use libtock::result::TockResult;
use libtock::timer;
use libtock::timer::Duration;
-use libtock_support_macros::libtock_main;
-#[libtock_main]
+#[libtock::main]
async fn main() -> TockResult<()> {
let mut console = Console::new();
let mut with_callback = buttons::with_callback(|_, _| {});
diff --git a/examples/button_subscribe.rs b/examples/button_subscribe.rs
index 4c020c6..8ea4fac 100644
--- a/examples/button_subscribe.rs
+++ b/examples/button_subscribe.rs
@@ -6,10 +6,9 @@
use libtock::buttons::ButtonState;
use libtock::console::Console;
use libtock::result::TockResult;
-use libtock_support_macros::libtock_main;
// FIXME: Hangs up when buttons are pressed rapidly. Yielding in callback leads to stack overflow.
-#[libtock_main]
+#[libtock::main]
async fn main() -> TockResult<()> {
let mut console = Console::new();
diff --git a/examples/gpio.rs b/examples/gpio.rs
index 17428aa..c0169e5 100644
--- a/examples/gpio.rs
+++ b/examples/gpio.rs
@@ -4,10 +4,9 @@
use libtock::result::TockResult;
use libtock::timer;
use libtock::timer::Duration;
-use libtock_support_macros::libtock_main;
// Example works on P0.03
-#[libtock_main]
+#[libtock::main]
async fn main() -> TockResult<()> {
let pin = GpioPinUnitialized::new(0);
let pin = pin.open_for_write()?;
diff --git a/examples/gpio_read.rs b/examples/gpio_read.rs
index 97413a8..5125042 100644
--- a/examples/gpio_read.rs
+++ b/examples/gpio_read.rs
@@ -7,10 +7,9 @@
use libtock::result::TockResult;
use libtock::timer;
use libtock::timer::Duration;
-use libtock_support_macros::libtock_main;
// example works on p0.03
-#[libtock_main]
+#[libtock::main]
async fn main() -> TockResult<()> {
let mut console = Console::new();
let pin = GpioPinUnitialized::new(0);
diff --git a/examples/hardware_test.rs b/examples/hardware_test.rs
index 89ff91e..87a6081 100644
--- a/examples/hardware_test.rs
+++ b/examples/hardware_test.rs
@@ -12,7 +12,6 @@
use libtock::result::TockResult;
use libtock::timer;
use libtock::timer::Duration;
-use libtock_support_macros::libtock_main;
static mut STATIC: usize = 0;
@@ -32,7 +31,7 @@
}
}
-#[libtock_main]
+#[libtock::main]
async fn main() -> TockResult<()> {
let mut console = Console::new();
write!(console, "[test-results]\n").unwrap();
diff --git a/examples/hello.rs b/examples/hello.rs
index 89d70c6..fe42f6e 100644
--- a/examples/hello.rs
+++ b/examples/hello.rs
@@ -5,9 +5,8 @@
use libtock::result::TockResult;
use libtock::timer;
use libtock::timer::Duration;
-use libtock_support_macros::libtock_main;
-#[libtock_main]
+#[libtock::main]
async fn main() -> TockResult<()> {
let mut console = Console::new();
diff --git a/examples/panic.rs b/examples/panic.rs
index 83a58bc..6b476e3 100644
--- a/examples/panic.rs
+++ b/examples/panic.rs
@@ -1,9 +1,8 @@
#![no_std]
use libtock::result::TockResult;
-use libtock_support_macros::libtock_main;
-#[libtock_main]
+#[libtock::main]
async fn main() -> TockResult<()> {
let _ = libtock::LibTock {};
panic!("Bye world!");
diff --git a/examples/sensors.rs b/examples/sensors.rs
index 5cb457d..4e1748a 100644
--- a/examples/sensors.rs
+++ b/examples/sensors.rs
@@ -6,9 +6,8 @@
use libtock::sensors::*;
use libtock::timer;
use libtock::timer::Duration;
-use libtock_support_macros::libtock_main;
-#[libtock_main]
+#[libtock::main]
async fn main() -> TockResult<()> {
let mut console = Console::new();
let mut humidity = HumiditySensor;
diff --git a/examples/seven_segment.rs b/examples/seven_segment.rs
index c01f566..9e73a80 100644
--- a/examples/seven_segment.rs
+++ b/examples/seven_segment.rs
@@ -5,7 +5,6 @@
use libtock::result::TockResult;
use libtock::timer;
use libtock::timer::Duration;
-use libtock_support_macros::libtock_main;
fn number_to_bits(n: u8) -> [bool; 8] {
match n {
@@ -24,7 +23,7 @@
}
// Example works on a shift register on P0.03, P0.04, P0.28
-#[libtock_main]
+#[libtock::main]
async fn main() -> TockResult<()> {
let shift_register = ShiftRegister::new(
GpioPinUnitialized::new(0).open_for_write()?,
diff --git a/examples/simple_ble.rs b/examples/simple_ble.rs
index 3e7e996..b3dce9b 100644
--- a/examples/simple_ble.rs
+++ b/examples/simple_ble.rs
@@ -7,7 +7,6 @@
use libtock::simple_ble::BleAdvertisingDriver;
use libtock::timer;
use libtock::timer::Duration;
-use libtock_support_macros::libtock_main;
use serde::Serialize;
#[derive(Serialize)]
@@ -16,7 +15,7 @@
pub st: bool,
}
-#[libtock_main]
+#[libtock::main]
async fn main() -> TockResult<()> {
let led = led::get(0).unwrap();
diff --git a/examples/temperature.rs b/examples/temperature.rs
index 81816a6..8bce671 100644
--- a/examples/temperature.rs
+++ b/examples/temperature.rs
@@ -4,9 +4,8 @@
use libtock::console::Console;
use libtock::result::TockResult;
use libtock::temperature;
-use libtock_support_macros::libtock_main;
-#[libtock_main]
+#[libtock::main]
async fn main() -> TockResult<()> {
let mut console = Console::new();
let temperature = temperature::measure_temperature().await?;
diff --git a/examples/timer_subscribe.rs b/examples/timer_subscribe.rs
index f4b4f3e..35b3bd9 100644
--- a/examples/timer_subscribe.rs
+++ b/examples/timer_subscribe.rs
@@ -5,9 +5,8 @@
use libtock::console::Console;
use libtock::timer;
use libtock::timer::Duration;
-use libtock_support_macros::libtock_main;
-#[libtock_main]
+#[libtock::main]
async fn main() -> libtock::result::TockResult<()> {
let mut console = Console::new();