-
Notifications
You must be signed in to change notification settings - Fork 882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[avr] create initial example #3696
base: main
Are you sure you want to change the base?
Conversation
d8ab606
to
4f4fb7e
Compare
4f4fb7e
to
0578870
Compare
@@ -0,0 +1,8 @@ | |||
[build] | |||
target = "avr-unknown-gnu-atmega328" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the example directory name more closely match the rustc target (avr -> atmega328)?
Currently nightly only supports this target, but avr-hal maintains some additional spec files. I'm unsure if these will all end up being their own rustc platforms, if they can drop the gnu dependency, or if they can be consolidated under a more generic name.
I'm assuming any AVR support here would only use rustc supported targets, otherwise this repo would likely need to duplicate the spec files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've learned of some progress regarding rustc avr target support.
rust-lang/rust#131651
The proposal consolidates the avr processors into one avr-unknown-unknown
or avr-unknown-none
target.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i put "avr-unknown-gnu-atmega328" just because it was there, i think most of the times, you'll be using target jsons from avr-hal
#[embassy_executor::main] | ||
async fn main(_spawner: Spawner) { | ||
loop { | ||
// TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Toggling a pin using avr-device
is easy enough, but the big hang up here is lack of an AVR time driver.
Is there interest in implementing/supporting an embassy-specific AVR hal, or should the examples make use of avr-hal
? Does embassy attempt to have a consistent feel across its HALs?
One challenge is that none of the AVR HAL crates have been published, so git dependencies are needed. I'm also unsure how well it's design aligns with the HALs here.
i wrote time driver https://github.com/djdisodo/avr_embassy_time/tree/master it works well enough that i could drive stepper motors with it but there's also lot of features with questionable benefits for example wake scheduled in goofy linked list to keep it sorted but since i later found that embassy never drops a timer, if you have a code that may cancel timer, the queue will be always full and it has to check all the timers when inserting new (also it uses a bit more ram) (i think embassy should allow the driver to drop timer that has been dropped by user) (also MARGIN_TICKS is random number that i found it working) |
This commit adds a minimal example demonstrating how to create an embassy executor. This gets the infrastructure in place for future work to add missing pieces like a timer driver.