<AlexandrosLiarok>
There is also a chance that the Uninit will read the magic value on startup. This could happen for example on soft reset if someone used backup memory for the shared data.
<diondokter[m]>
Yeah I know... I don't really know how to solve that
<diondokter[m]>
Yeah, but then you're assuming the second core will always run
<diondokter[m]>
Might not be the case
<AlexandrosLiarok>
yea true in which case we may just want a variant that won't lock for the primary core. I don't really have a solution here just brainstorming.
cr1901_ has joined #rust-embedded
cr1901 has quit [Read error: Connection reset by peer]
<diondokter[m]>
<AlexandrosLiarok> "diondokter: I was thinking..." <- I don't think this works because with this each core would initialize the shared data
<diondokter[m]>
Hmmm I see. It might work. But only if both cores are booting at the same time.
<diondokter[m]>
And also, both cores initialize the shared data. But this is done none-atomically, so not sure if that's allowed.
<ryan-summers[m]>
The tl;dr is don't do any sharing yourself. There are external crates that rust-embedded manages (embedded-hal-bus specifically does this for you)
<djdisodo[m]>
<ryan-summers[m]> "The docs on the embedded-hal I2C..." <- this is not for async
<ryan-summers[m]>
I believe the same principles apply to the embedded-hal-async
<ryan-summers[m]>
Sounds like bus sharing on async is hard because the mutex type is nonstandard. Probably best to look at what embassy does
<ryan-summers[m]>
But I would imagine the same principles applie as I referenced, where sharing is handled entirely externally to the driver implementation
<ryan-summers[m]>
s/applie/apply/
<djdisodo[m]>
<ryan-summers[m]> "But I would imagine the same..." <- so it seems like i don't have to care when implementing driver
<djdisodo[m]>
but it seems like i should use embassy-embedded-hal when i need shared i2c bus since embedded-hal-bus doesn't support it
<ryan-summers[m]>
Yeah, you'd use embassy-embedded-hal once you've implemented the driver. But don't implement the driver with dependencies on embassy, or you'll block anyone that wants to use it outside of embassy as well
<djdisodo[m]>
btw embassy one doesn't seem to implement embedded-hal-async traits either, only has some bounds on them
<ryan-summers[m]>
For anyone interested, I did some interesting stuff with C/Rust/bindgen stuff and embedded sensors and it ended up making life pretty easy for me, even though the firmware was in C. Wrote up a quick blog about it: https://blog.forged.dev/rust-for-c-projects/
<ryan-summers[m]>
s/stuff//
<ryan-summers[m]>
100% open to constructive feedback on the post by the way, would like to do more interesting embedded blogging in the future :)
takkaryx[m] has quit [Quit: Idle timeout reached: 172800s]
YuhanLin[m] has quit [Quit: Idle timeout reached: 172800s]
Amit[m] has quit [Quit: Idle timeout reached: 172800s]
JamesSizeland[m] has quit [Quit: Idle timeout reached: 172800s]
sourcebox[m] has quit [Quit: Idle timeout reached: 172800s]
freakingpenguin has joined #rust-embedded
ejpcmac[m] has quit [Quit: Idle timeout reached: 172800s]
vollbrecht[m] has quit [Quit: Idle timeout reached: 172800s]
bartmassey[m] has quit [Quit: Idle timeout reached: 172800s]
Henk[m] has quit [Quit: Idle timeout reached: 172800s]
rmsyn[m] has quit [Quit: Idle timeout reached: 172800s]
jannic[m] has quit [Quit: Idle timeout reached: 172800s]
adamgreig[m] has quit [Quit: Idle timeout reached: 172800s]
braincode[m] has quit [Quit: Idle timeout reached: 172800s]
cr1901_ is now known as cr1901
dirbaio[m] has quit [Quit: Idle timeout reached: 172800s]