Git Product home page Git Product logo

embedded-rs's People

Contributors

f-bro avatar mbr avatar oli-obk avatar phil-opp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

phil-opp f-bro

embedded-rs's Issues

Add reg! macro?

As mentioned by @oli-obk , a convenient register macro may be a good thing to spare users from having to write inline-assembly:

reg!(r0) = 42;
*(reg!(r0) + 3 as *const i32) = 42;
x = reg!(r0);

interrupt design

We definitely want to start using interrupts at some point. It's trivial to simply put a function into the interrupt table, but that function then has neither state nor a way to communicate with anything. I say we first figure out the way we want to use interrupts, and then solve how that can be done. So this issue is just here for the API.

Obviously closures come into mind when thinking about code that should be run when an interrupt triggers. There's several ways we could use them:

add a handler for the entire program lifetime

let a = some_owned_register;
interrupt_table.insert(id, move || a.update(|a| a.set_some_flag()));
// can never get `some_owned_register` back
// but could overwrite interrupt `id` with a new handler

add a handler that borrows parts of the surroundings

let a = &mut some_owned_register;
interrupt_table.with_interrupt(
    id,
    || a.update(|a| a.set_some_flag()),
    |interrupt_table| {
        // code that needs that interrupt to be set
    }
);
// interrupt is not set anymore, `some_owned_register` is available again

add a handler and a state object that you'll get back afterwards

interrupt_table.insert(id, some_owned_register, some_function_that_takes_a_ref_mut_register);
// code that needs that interrupt to be set
let some_owned_register = interrupt_table.remove(id).unwrap();
// got `some_owned_register` back

I don't think we need to decide on either of the three, they can work simultaneously.

Anything else in the possible design space?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.