ChanServ changed the topic of #rust-embedded to: Welcome to the Rust Embedded IRC channel! Bridged to #rust-embedded:matrix.org and logged at https://libera.irclog.whitequark.org/rust-embedded, code of conduct at https://www.rust-lang.org/conduct.html
sajattack[m]1 has joined #rust-embedded
<sajattack[m]1> Is there a better way to share data between interrupts than static mut or not really?
<sajattack[m]1> Rtic probably has something fancy I guess
<adamgreig[m]> RTIC is the something fancy, really
<sajattack[m]1> Ok thx
<adamgreig[m]> if you just want to share little data, Atomics are really nice
<adamgreig[m]> like, up to a u32
<sajattack[m]1> It's funny I've done a lot on the hal side but not a lot on the applications side and I finally have a good excuse to learn all this stuff
<adamgreig[m]> you can use a critical_section::Mutex<RefCell<T>> in a `static` to avoid needing a literal `static mut`, too https://docs.rs/critical-section/latest/critical_section/struct.Mutex.html
<sajattack[m]1> And suppose I have a driver struct that defines the structs, data, and methods it needs, how do I work that into rtic? Like I vaguely recal rtic apps have resources or something. How does it work for a generic driver to define what it wants from rtic? Or is it just a matter of making the resource a parameter of the ISR?
<adamgreig[m]> if you have a driver struct and the user wants to interact with it from both an interrupt and some other interrupt or the main thread, the user can put that driver struct into a resource and rtic will allow them to access it from those different places
<adamgreig[m]> so the driver just has one struct and maybe it has a method like "call me from this interrupt" and "call me in your main loop" or whatever
<sajattack[m]1> yeah that's kinda what I was thinking too - but what I'm thinking about is how to define the shared mutable state. Maybe it can just be part of the struct. But usually static mut's can't be part of a struct.
<adamgreig[m]> can't you just put it directly inside the struct?
<sajattack[m]1> probably that's what I'm asking
<adamgreig[m]> you can't put a static mut inside the struct, but you can just put data inside the struct
<sajattack[m]1> yeah nevermind I'm dumb
<adamgreig[m]> there's potentially some downsides if it's like 1kB+ of data, because it might end up moved around on the stack a bit to get to its final place
<adamgreig[m]> if you don't want to store the data inside the driver struct, take a `&'static mut Data` in your constructor, and let the user worry about providing it somehow (rtic can help)
<sajattack[m]1> thanks
<JamesMunns[m]> <adamgreig[m]> "if you don't want to store the..." <- Or the singleton macro in cmrt, or StaricCell
<JamesMunns[m]> s/StaricCell/StaticCell/
starblue has quit [Ping timeout: 245 seconds]
starblue has joined #rust-embedded
Guest7221 has quit [Ping timeout: 268 seconds]
emerent has quit [Ping timeout: 276 seconds]
emerent_ has joined #rust-embedded
emerent_ is now known as emerent
bpye has quit [Ping timeout: 256 seconds]
bpye has joined #rust-embedded
Dr_Viper[m] has joined #rust-embedded
<Dr_Viper[m]> I want to learn rust
crabbedhaloablut has joined #rust-embedded
<JamesMunns[m]> Any Tools team members around? Could I poke anyone into doing a release of cargo-binutils when they get a chance? Just got a ping on https://github.com/rust-embedded/cargo-binutils/issues/139#issuecomment-1818519665 which seems to be fixed but not released
jamwaffles[m] has joined #rust-embedded
<jamwaffles[m]> Hey all, is there an `async` equivalent of [embedded-io](https://docs.rs/embedded-io/latest/embedded_io/)? Maybe something in Embassy? I'd like to provide an async reader trait bound to something so I can abstract over a real device or a mock in my unit tests. Nightly is ok.
<dirbaio[m]> embedded-io-async
<diondokter[m]> It's in the same repo: https://github.com/rust-embedded/embedded-hal
<jamwaffles[m]> Ah I knew I'd seen it somewhere. Thank you!
starblue has quit [Ping timeout: 256 seconds]
starblue has joined #rust-embedded
<rukai[m]> <M9names[m]> "https://github.com/dlkj/usbd-..."; <- This was exactly what I needed, thanks! I swapped out keyberons USB keyboard parts with this crate and then was able to add a mouse device and got it all working together.
IlPalazzo-ojiisa has joined #rust-embedded
ducks2788[m] has joined #rust-embedded
<ducks2788[m]> Hi. I have a question: If I try to deserialize invalid json with serde and use `unwrap`, my app panics and prints a message. Instead of panic'ing, I want print this error message:... (full message at <https://catircservices.org/_matrix/media/v3/download/catircservices.org/VNpoaqUjXMykUsGtuysSlGcM>)
<JamesMunns[m]> https://defmt.ferrous-systems.com/format discusses this
<ducks2788[m]> I'll have a look on this. Thank you.
barnaby has quit [Ping timeout: 255 seconds]
barnaby has joined #rust-embedded
crabbedhaloablut has quit []
crabbedhaloablut has joined #rust-embedded
rob5225 has joined #rust-embedded
crabbedhaloablut has quit []
dutchkin has joined #rust-embedded
IlPalazzo-ojiisa has quit [Quit: Leaving.]
AlexandervanSaas has quit [Quit: Idle timeout reached: 172800s]