Skip to content

Make timer more ergonomic #15

@eivindbergem

Description

@eivindbergem

The timer has a lot of parts making it clunky to use. Ideally it should be more like:

static TIMER: AtomicOnceCell<Timer> = AtomicOnceCell::new();

#[task(priority = 1)]
async fn task() {
    let timer = TIMER.get().unwrap().clone();

    loop {
         // [...]
    }
}

fn main() {
    let countdown = impl_countdown_of_choice();
    let task1 = task1_fn();
    let executor = static_executor!(countdown, task1);

    TIMER.set(executor.get_timer()).unwrap();

    // [...]
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions