FAQ - 21:53 : Is `RefCell` really needed with `Mutex`? Doesn't `Mutex` already provide interior mutability? - The `critical_section::Mutex` is a bit different from the `std::sync::Mutex` in that the former does not provide interior mutability, for reasons described here: docs.rs/critical-section/1.1.3/critical_section/struct.Mutex.html#design
@danjadave3 күн бұрын
I've been programming for decades, but I'm quite new to Rust. Having watched about half of your videos so far, I really like how you don't just jump right to the end-state offloading all the inner workings to a library. Instead, you start from first principals and work-up a basic implementation that clearly demonstrates the concept before showing the library short-cut. This kind of teaching really helps developers grow from committers to _contributors_! ☺ Look forward to seeing more!
@Kaptime3 ай бұрын
This is the exact kind of top to bottom project breakdown that can onboard people very quickly 10/10 video.
@jackkendall64203 ай бұрын
Now this is *content*.
@FernandoMumbach3 ай бұрын
After developing for years C/C++ in anger for embedded, I can see now why people talk good about rust. A lot of verbosity, but things make sense. And it seems like it won't give you nightmares at night while you wonder if your medical unit will kill somebody some day because you had a dangling pointer!
@thegrandnil7643 ай бұрын
Arena allocators.
@FernandoMumbach3 ай бұрын
@@thegrandnil764 ha, if only
@НиколаевВасилий-н3б3 ай бұрын
Ha. Like complete novice in embedded that seems to me like endless pulsing pain. I can say I'll take that pointer and heck I'll take the road. Metal oxidation forms let me begin.
@Eekhoornz28 күн бұрын
You made me sit down and think how concurrent tasks are usually implemented using state machines, thanks for this amazing work!
@FedynaPavlo3 ай бұрын
I’m now half way through the genius „Zero2Prod in Rust“ book. You should *absolutely* write one but for embedded in Rust.
@therustybits3 ай бұрын
Zero to Production is a fantastic book; I don't think I have it in me to write one though 😅 In my case, the video series is the book/course...
@vikaspoddar0012 ай бұрын
@@therustybits you can write it, can you create a crate for extending cargo for managing embedded development. like we have platformIO
@anandmoon57013 ай бұрын
This comprehensive guide delves deeply into Rust programming, covering all the techniques used in this program. Great job!, I’ll try out this code on my end.
@JordanRobinson-w6w3 ай бұрын
I just recently watched your other videos and when I discovered that they were from 5+ months ago and you only had 3 others I was so sad. So imagine my surprise and absolute joy to find that there is a new video now. I'm so glad you're still continuing with these videos I find them imeasurably helpful and I am captivated by the way you present and discuss topics. Please never stop, your content is amazing!
@indierusty3 ай бұрын
Loved that it is Project based explanation. I now understand how concurrent programming work. I was struggling with the concept for months really. Im a in high school student so this is very useful video. Thank you.
@jan_the_man3 ай бұрын
Damn this is some quality explanation! Answered a lot of questions I had related to embedded. Keep it up man!
@farukhalilagic20702 ай бұрын
Thanks!
@J-Kimble3 ай бұрын
Great video! Low level async and embedded, two of my high interest topics at the moment!
@namr20002 ай бұрын
Very nice video, I am thinking about using Embassy for some new embedded projects at work but was a little queasy on using something (async/await) that I did not fully understand. This video gave me a lot of insight and (slightly) more confidence. Thank you for taking the time to make such a great resource!
@Sillyvan3 ай бұрын
Best Embedded Rust out there so far. For me a tick fast in some places due to not being to familiar with the embedded eco system in general but its probably smarter to pick up those skills with C first
@mehmethekimolu3 ай бұрын
Amazing work, was waiting your next video, perfect as always
@Jon4as3 ай бұрын
Waiting for a 1 hour Video was so worth it!
@jvcrules3 ай бұрын
This is awesome! Ive recently been working on an async executor using C++ coroutines for embedded systems at work, so it was really neat to see some of the parallels.
@MaxWeninger3 ай бұрын
Picking embassy going forward is a very good choice.
@indierusty3 ай бұрын
This is a really good tutorial. Thank you so much for making quality education video.
@topper2kuk2 ай бұрын
Dude! loving the execution and format of videos. Looking forward to the next rusty bit
@MrMassaraksh3 ай бұрын
Ahhhh, I just finally manage to make it using rtic and interrupts and here we go new pattern 😂😂 As always thank you! Thrilling to try it
@irlshrek3 ай бұрын
Duuuuuude so sick!! Thanks for this!
@thaejsooriya33133 ай бұрын
Wooo new video! Love the content and super useful topic!🎉🎉
@IvanDeMarino3 ай бұрын
Yeah, new video! Just yesterday I was leaving a message asking for one, and here we go!!!
@JeroenL1113 ай бұрын
Excellent! Very well explained!
@teuluPaul3 ай бұрын
fabulous video (again!) - many thanks for sharing!
@marcopaolovaleriovezzoli57763 ай бұрын
Excellent video as usual. I definitely need to find some time and do my homework.
@descriptionsuchandsuch47093 ай бұрын
Oooooo NICE! A new video from my new favourite Rust channel! Can't wait to watch it this evening!
@HybridRobotix18 күн бұрын
I watched the whole video. PLEASE consider doing a complete tutorial for Rust. I like the way you explain things.
@thelethalmoo3 ай бұрын
Awesome! the world needs rust content like this 11/10
@lorenzorossi20003 ай бұрын
At 38:37 you may be able to use the mutex directly without the refcell since mutexes already implements mutually exclusive access so you already get a mutable reference. RefCell should ne used when you want to have mutability from an immutable setting (ex. Immutable ref to mutable ref) EDIT: Sorry, after some research this is the mutex of the critical section crate that confusingly does not provide interior mutability for better performance 0_o. Embedded rust is quite weird. Thanks for the great video! I'll surely recommend it to teach advanced embedded rust!
@evertonoriente71503 ай бұрын
Thanks very much about this video, I haven't seen yet but I know is going to be a lot of good information, all your videos it is really helpfull, thanks for this channel.
@unaimillian3 ай бұрын
Very great video and visuals during the discussion! 🎉
@ThomasLockney3 ай бұрын
I'm just here to appreciate the copy of Linux Programming Interface sitting on your table in the back. 😂 Seriously, though, love this content and happy to see you're back to it. Just ordered a Micro:bit finally to follow along.
@trejohnson76773 ай бұрын
some of your points map to react incredibly well, interestingly
@maexlich3 ай бұрын
Amazing video, great job! It is very very helpful!
@auggiebuerkle66603 ай бұрын
i'm glad you're back
@oof-software3 ай бұрын
I remember when first learning about futures and async, I somehow completely missed the concept of wakers and was really confused until I finally learned about them and it all clicked into place :D
@therustybits3 ай бұрын
I think the approach to teaching async is often top-down, but I much prefer bottom-up: us low-level folks like to know what's going on at the lowest layers, and if you're coming from C then you're likely already familiar with state-machines, so this seems natural.
@driedurchin3 ай бұрын
Instant sub. So good!
@jorgegomezreus70193 ай бұрын
The video I was waiting for
@nathanbanks23543 ай бұрын
I'm looking forward to the next videos where Embassy is assumed! It's somewhat interesting seeing the journey through different ways to do this, and I can see why someone would learn things this way. However it seems to be a video about why async is useful by showing how everything else is worse. The video builds A, replaces it with B, replaces it with C, where A, B, & C do the same thing. An alternative is building A, then go on to A' and A'' where each step adds new functionality using the same system (eg. start with 1 button & 1 LED, add movement, then add blinking, all with async). On the other hand, I've come across async in other languages and in rust web server libraries, and I never tried running or even fully grokking the code, so I thought "Oh cool, async for embedded" rather than "What's async? Why would I need it?" Embassy sounds great! I hope the five minute outro is a sign of things to come.
@PlayerOne19993 ай бұрын
Lets GOoooo. love your soft voice😊😊.
@daniellarson62793 ай бұрын
Fantastic video! Async and embedded rust are something I've been meaning to get more comfortable with, and this is about as concise as the combination of those two things can be! One thing I noticed though while watching was that you used a Mutex, and I'm pretty sure Mutex has interior mutability on its own, so the RefCell isn't necessary. I could be mistaken, like I said, this isn't really my wheelhouse, but it just popped out to me.
@therustybits3 ай бұрын
Thanks! The `critical-section` crate's `Mutex` doesn't provide interior mutability, for reasons described here: docs.rs/critical-section/1.1.3/critical_section/struct.Mutex.html#design
@daniellarson62793 ай бұрын
@@therustybits D'oh, that's on me for not noticing it wasn't the std Mutex. That makes sense.
@Iswimandrun3 ай бұрын
Thank you for the great tutorials.
@danielprimostuart3 ай бұрын
Looking forward to the atomic ordering video!
@matpala23 ай бұрын
Great video!
@cunningham.s_law3 ай бұрын
you should probably test each change on the hardware to make the video more interesting by showing the effect of the change
@therustybits3 ай бұрын
Ah yep, good call... did that in blinky but forgot in this one. Next time!
@evertonoriente71502 ай бұрын
When is coming your video of embassy? :) Thanks for this amazing video explain everything inside of the logic of the embassy framework.
@borkomne3 ай бұрын
Great video, thanks! Btw, what software do you use to create text animations?
@therustybits3 ай бұрын
Keyframes in Final Cut Pro, just changing position. The default behavior seems to have a nice acceleration/deceleration ramp at the beginning and end, which is nice..
@borkomne3 ай бұрын
Thanks@@therustybits, the quality of your videos is excellent! Please keep up the great work!
@driedurchin3 ай бұрын
What still blows my mind about Rust's async is that, in essence, it's identical to the original code, just smarter.
@therustybits3 ай бұрын
Automatically generated state-machines FTW
@driedurchin3 ай бұрын
@@therustybits The even more fun part is I got to do this transition for real from state machines in a super loop to asynchronous rust at my work!
@commissariomontanaro29313 ай бұрын
babe wake up, an hour long got posted
@johnwu59083 ай бұрын
So babe can be polled?
@vikaspoddar0013 ай бұрын
He is back from the hiatus
@krauterbaguette36453 ай бұрын
Love this so much ❤
@NotherPleb3 ай бұрын
I was really confused by the Mutex pattern until I looked at the docs. The critical_section::Mutex does not offer interior mutability like the std::sync::Mutex.
@10e9993 ай бұрын
I'm not sure I understand why you use an ISR in the timer. Why not configure the RTC's prescaler of 32 (1000 Hz) ? Doing so, you get millisecond accuracy and an overflow only every 50 days. Thanks for the video!
@therustybits3 ай бұрын
The RTC's low power oscillator frequency is 32,768 Hz, so a prescaler of 32 would get you 1,024 Hz, which might be OK for tracking system time if you can tolerate the error. But even then, the counter register is only 24-bits (counting up to 16,777,216), which is an overflow every 4.66 hours, so you still need somewhere to keep track of overflows. Alternatively, you could keep the native frequency and use one of the CC registers to count up to ~1ms (32 ticks, so still some error) and just increment a single 64-bit tick counter value in memory.
@10e9993 ай бұрын
@@therustybits Thanks for your answer. What I don't understand is why you need more than a few seconds before overflow. With the unsigned integer overflow rule, the following code is garantee to work: u32 elapsed = now() - start; if elapsed >= 100 { do_something(); } Anyway, thanks for sharing !
@justinliu77883 ай бұрын
Walker getters is stabilized now!
@justinliu77883 ай бұрын
Rust pull 129919 btw
@therustybits3 ай бұрын
Sweet!
@The_Nova_Glow3 ай бұрын
Jackpot!
@thearrow46243 ай бұрын
Could I ask what a tool/plugin do you use to make your vscode's integrated terminal so powerful?
@therustybits3 ай бұрын
I'm using "Oh My Zsh" to manage my zsh config, and have added `zsh-autosuggestions` (github.com/zsh-users/zsh-autosuggestions) and `zsh-syntax-highlighting` (github.com/zsh-users/zsh-syntax-highlighting). Basically just followed @typecraft_dev's video kzbin.info/www/bejne/rX-0oXeNgdhnitE
@takeiteasyehАй бұрын
My favorite part about Rust .. rewritting something you just wrote lol
@therustybits29 күн бұрын
This is the way 😅
@JulianBolivarGaleno742 ай бұрын
It is a RTOS implemented on RUST? I only can find some old (dead) projects and some FreeRTOS wrappers... 🤔because the Embassy framework is most an event oriented framework.
@therustybits2 ай бұрын
An RTOS is a bit of a different animal than what we build in this video, which is more like a stripped down version of embassy. And you’re right, AFAIK there aren’t many RTOS efforts in Rust at the moment. For real-time stuff there’s RTIC, but that works much differently than something like FreeRTOS.
@christopherpetersen3422 ай бұрын
in english, it's usually pronounced few-jit which doesn't quite match the original latin "tempus fugit" - generally translated as "time flies"
@orrenjenkins2892 ай бұрын
Is the RefCell needed inside the mutex??
@therustybits2 ай бұрын
The `critical_section::Mutex` is a bit different from the `std::sync::Mutex` in that it does not provide interior mutability, for reasons described here: docs.rs/critical-section/1.1.3/critical_section/struct.Mutex.html#design
@markocvejic641611 күн бұрын
Im curious, is async aproach good for lets say real time audio. For guitar amps or pedals.. When you have audio thread that is highest priority, and must not be blocked ever. Is classical RTOS aproach better than?
@therustybits11 күн бұрын
In `embassy`, you can run multiple executors even in a single-core system, with lower priority tasks running on the default thread-mode executor, and higher-priority tasks running in interrupt executor(s) (running in ISRs). For extremely time-sensitive stuff, you can always run your own ISR logic in tandem with the normal async executor, or use a framework like RTIC that is usually better-suited for that type of thing. A long way of saying.. it depends 😀
@skydandelion25602 ай бұрын
Sir... Can you make another dedicated Video Tutorial for STM32 discovery development with RUST? A Complete guideline will be also ok. And This video was really helpful for beginners. Thank you!
@erentas73913 ай бұрын
What is the name of the book on the table?
@therustybits3 ай бұрын
"The Linux Programming Interface" by Michael Kerrisk
@timvw013 ай бұрын
This is great 👍
@roiborromeo79213 ай бұрын
I'm a 4th year IT student of course I know so little about all these, but the async and concurrent code in esp32 sucks that it can't escape a loop and just blocks all these, I don't know how to do that, so I might be excited with these.
@tommasoclini99023 ай бұрын
Will there be an stm32 version of this video?
@therustybits3 ай бұрын
No: while the code is specific to the nRF series of controllers, the concepts are applicable to any microcontroller.
@elijahpo38003 ай бұрын
What code editor do you use?
@therustybits3 ай бұрын
VS Code; check out this video for full setup: kzbin.info/www/bejne/ioCkqqGamc6oa68
@samuelhomberg90753 ай бұрын
Here a comment for the algorithm, because you are still criminally low on subscribers!
@therustybits3 ай бұрын
For the algorithm! 🙌
@chris-duncan-arauz29 күн бұрын
I see that you convert a Result type to an Option type in several lines of code using the the .ok function but not using the resulting value. Why convert the Result into an Option without using the value?
@therustybits29 күн бұрын
I believe this is in reference to the calls to drive the LED: the `embedded-hal`'s `OutputPin` trait methods `set_low()`/`set_high()`/`toggle()` are specified to return a `Result`, but because this is effectively just a write to memory, the implementation in the HAL always returns `Ok(())`. This is the case for the `nrf52833-hal` used by the `microbit-v2` BSP, but I suppose maybe its possible in some other hardware that has to do something more complicated than an MMIO write might fail, so having that flexibility of returning a `Result` in the trait definition is probably a good thing, although having to deal with it in the vast majority of use-cases is a bit unfortunate..
@orhundev3 ай бұрын
big W
@AdarshKumar3703 ай бұрын
Thanks
@UsatiyNyan3 ай бұрын
Actually 🔥
@billytalentrocks3453 ай бұрын
A bit fast, but very good.
@mateusztocha92603 ай бұрын
wow
@urmok6iv26 күн бұрын
I aprreciate the work put into this video. But when I tried following it myself I found the explanations to be too advanced to the point where I couldn't make sense of anything and I got really discoureaged by the experience.
@JeffHanke3 ай бұрын
I assume it was a joke, but "fugit" is likely from "tempus fugit" (latin for "time flies") and would probably be pronounced "foojit".
@ederbarrero55853 ай бұрын
This looks like an awesome video, sadly I'm too stupid for it 😔
@therustybits3 ай бұрын
I doubt that! I knew literally nothing about async a few months ago, and now I know.. slightly more! Seriously though, learning anything new is a process, you just need to stick with it 🙂
@ederbarrero55853 ай бұрын
@@therustybits Heh, I think I needed to hear that, thanks! I'll try my best to absorb more about the basic concepts and come back to this :)
@pierreyao72212 ай бұрын
Please turn off the editor suggestions when typing the code. It's difficult to follow the code with the rust analyzer suggestions popping up. Especially at the accelerated render of the video
@therustybits2 ай бұрын
Thanks for the feedback! In future videos I’ll be more selective about when RA is enabled.
@jad.k.haddad3 ай бұрын
My dude rewrote embassy in one hour
@clivedsouza621322 күн бұрын
Pieces of this video went right over my head due to inexperience, but this talk [kzbin.info/www/bejne/fmixpa2vhZ6kbqcsi=eeVPFC9iHGsHWivR] by the Embassy creator helped clear things a lot more.
@thegrandnil7643 ай бұрын
Hiding things under abstractions can get you in trouble in the type of code I write so C is preferred, however I see this being very useful as a embedded C++ replacement. I might incorporate futures into my own systems in C/asm.
@imanidioli3 ай бұрын
Do you really explain for "from zero" sort of learners?
@therustybits3 ай бұрын
There is an extremely popular (and excellent) book “Zero to Production in Rust” by Luca Palmieri, and so this title is a play on that, though the “learn by doing” style is similar. Like Luca, my assumption is that you’ve read the Rust Book (link in description) and so have some familiarity with the concepts and now want to seem them in action. But yeah, if I also had to teach all the underlying concepts this video would be 10x longer.
@imanidioli3 ай бұрын
@@therustybits Thanks, I felt like a homo erectus around the middle of the tutorial 😂.