#serial-port #board #async

nightly no-std cntrlr

Simple, async embedded framework

1 unstable release

0.1.0 Jan 3, 2021

#762 in Asynchronous

AGPL-3.0-or-later

290KB
6.5K SLoC

Cntrlr - Simple, asynchronous embedded

Cntrlr is an all-in-one embedded platform for writing simple asynchronous applications on top of common hobbyist development boards.

Examples

Hello World to a serial port

#![no_std]
#![no_main]

use cntrlr::prelude::*;
use core::future::pending;

#[entry]
async fn main() -> ! {
    serial_1().enable(9600).unwrap();
    writeln!(serial_1(), \"Hello, World\").await.unwrap();

    // Hang forever once we've sent our message
    pending().await
}

Blinking LED

#![no_std]
#![no_main]

use cntrlr::prelude::*;

#[entry]
async fn main() -> ! {
    pin_mode(13, PinMode::Output);
    loop {
        digital_write(13, true);
        sleep(500).await;
        digital_wrrite(13, false);
        sleep(500).await;
    }
}

lib.rs:

A library for simple asynchronous embedded programming

use cntrlr::prelude::*;
use core::futures::pending;

#[entry]
async fn main() -> ! {
   serial_1().enable(9600);
   writeln!(serial_1(), "Hello, World").await.expect("Failed to message");
   pending().await
}

For an API overview, check the prelude module. This is the core set of functionality provided by Cntrlr, and provides functionality for most applications.

For hardware-specific functionality, each supported board and microcontroller has its own module under [hw]. Note that there are currently both safety and ergonomics issues with these lower-level APIs, and they don't provide much more functionality than what is needed to implement the main Cntrlr API. They will be expanded as time goes on, and will be improved for correcntess and usability.

Dependencies

~1.5MB
~37K SLoC