- Many functions are asynchronous
- To create an
async
main function you can use the attribute#[libtock::main]
- To retrieve the value of an asynchronous
value
, usevalue.await
- This is only possible within an
async fn
, so either- Make the caller
fn
of.await
anasync fn
- Not recommended: Use
libtock::executor::block_on(value)
to retrieve thevalue
- Make the caller
- To create an
- Most API functions, including
main()
, return aResult<T, TockError>
- All drivers can exclusively be retrieved by
retrieve_drivers
which returns aDrivers
singleton. Drivers can be shared between different tasks only if it is safe to do so. - The low-level functions have been moved to a new crate called
libtock-core
. This crate is intended to be less experimental and more stable.
- The basic APIs have been made consistent. They are initialized via driver factories and no longer require a
WithCallback
object, s.t. the callback subscription is more intuitive. The affected APIs are:- LEDs
- Buttons
- GPIO
- Temperature
- ADC (partially)
- The timer API now supports concurrent sleep operations
syscalls::subscribe
is actually usablesyscalls::yieldk_for
is no longer available- Yielding manually is discouraged as it conflicts with Rust's safety guarantees. If you need to wait for a condition, use
futures::wait_until
and.await
.
- Yielding manually is discouraged as it conflicts with Rust's safety guarantees. If you need to wait for a condition, use
syscalls::yieldk
has becomeunsafe
for the same reasonsyscalls::command
is no longerunsafe
- The low-level syscalls have been moved to
syscalls::raw
syscalls::subscribe_ptr
becomessyscalls::raw::subscribe
syscalls::allow_ptr
becomessyscalls::raw::allow
- Flashing examples is no longer restricted to the nRF52 DK board
./run_example.sh
has been deleted- Instead, use
PLATFORM=<platform> cargo r<arch> <your_app>
. This will build the app for your CPU architecture and platform-specific memory layout and flash it via J-Link to your board
- Targets without support for atomics can be built
- The
TockAllocator
is no longer included by default and needs to to be opted-in via--features=alloc
hardware_test.rs
is now calledlibtock_test.rs
to make clear that the intent is to test the correctness oflibtock-rs
, not the hardware or the kernel- The panic handler can now be customized using the
custom_panic_handler
feature - The error alloc handler can now be customized using the
custom_alloc_error_handler
feature
- First and highly experimental
libtock-rs
API