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
<JamesMunns[m]> For unsafe code, I do a LOT more "one step at a time" stuff
<JamesMunns[m]> like, I do this out of paranoia of accidentally double casting wrong:... (full message at <https://catircservices.org/_matrix/media/v3/download/catircservices.org/RGRCzzgQIiUWeLLlmAiXUAIZ>)
<JamesMunns[m]> <dirbaio[m]> "fun footgun..." <- `[T: Copy; N]` is `Copy`
<JamesMunns[m]> unsafe code and T: Copy is for sure a dangerous combo. I definitely suggest taking references/ptrs explicitly
<dirbaio[m]> Yea. If you think about it it makes sense
<dirbaio[m]> But still
<dirbaio[m]> You write `FOO.get_mut()`
<dirbaio[m]> Then get the error that accessing FOO is unsafe
<dirbaio[m]> So you wrap it with `unsafe{}`
<dirbaio[m]> And bang
<dirbaio[m]> Broken code :S
<JamesMunns[m]> yep
<JamesMunns[m]> I had something similar in some unsafe FFI code before
<JamesMunns[m]> I definitely know what you mean
<JamesMunns[m]> honestly might be worth opening a diagnostics issue for that
<JamesMunns[m]> "unsafe block performs copy of static mut" or something
<dirbaio[m]> My Mental model for unsafe{} is it let's you do more stuff, but it doesn't change the meaning of the code
<dirbaio[m]> But in this case it does :D
<JamesMunns[m]> would { foo }.get_mut() do the same if it was a local var?
<dirbaio[m]> I think so yes
<JamesMunns[m]> its more clear that a temporary is being made in this code
<JamesMunns[m]> ahh I see you're not binding it
<dirbaio[m]> Yea. With "if let" the temporary lives for the entire if block.
<dirbaio[m]> So you don't "notice" it heh
<JamesMunns[m]> I still think it's worth a diagnostic issue :)
<JamesMunns[m]> All the help we can get with unsafe, y'know?
<dirbaio[m]> Yea.. With static mut it's easy to fall into the trap because you have a reason to wrap it with {}
<JamesMunns[m]> Hey ithinuel, lemme know if you have some time to chat. I've been working on a next gen version of bbqueue :)
ilya-epifanov[m] has joined #rust-embedded
<ilya-epifanov[m]> guys, how do you use floating point functions on a compatible target (thumbv7em-none-eabihf)? Stuff like .powi(), .sqrt(), trigs?
<ilya-epifanov[m]> I'm now using libm but there's gotta be a better way
cinemaSundays has joined #rust-embedded
IlPalazzo-ojiisa has joined #rust-embedded
sourcebox[m] has joined #rust-embedded
<sourcebox[m]> <ilya-epifanov[m]> "I'm now using libm but there's..." <- You can use `micromath` if precision is not that important: https://crates.io/crates/micromath
vollbrecht[m] has quit [Quit: Idle timeout reached: 172800s]
reitermarkus[m] has joined #rust-embedded
<reitermarkus[m]> Hi, does anyone know if there is a crate for controlling GPIOs via DMA on a Raspberry Pi? Or any other way of getting reliable timings for sending RF signals.
richardeoin has quit [Ping timeout: 252 seconds]
richardeoin has joined #rust-embedded
rmja[m] has quit [Quit: Idle timeout reached: 172800s]
embassy-learner[ has quit [Quit: Idle timeout reached: 172800s]
thejpster[m] has quit [Quit: Idle timeout reached: 172800s]
AlexandrosLiarok has joined #rust-embedded
<AlexandrosLiarok> what is my best bet on getting an async ssd1309 driver compatible with embedded_graphics ?
<AlexandrosLiarok> the ssd1309 crate is on an old hal, there is a PR for bumping it to v1 but that is still blocking and doesn't play well with my embassy superloop.
<JamesMunns[m]> tbh, it's complicated because embedded_graphics isn't async
<JamesMunns[m]> one option is to use interrupt executors, and do display stuff at the lowest priority, and just do it blocking
<AlexandrosLiarok> the driver uses a framebuffer and only transmits on flush call.
<AlexandrosLiarok> I am /mostly/ okay as long as just that is async because I can yield between draw calls.
<JamesMunns[m]> so, do JUST your graphics rendering at low prio, and do basically everything else at one or more higher prio levels.
<JamesMunns[m]> you can also make a "fake" display framebuffer, render to that, then do your own manual "flush" command
<JamesMunns[m]> (i'm not familiar to the ssd1309 specifically tho, but I don't think theres a specific awesome way to do it)
<AlexandrosLiarok> fair enough, it seems it uses display_interface's WriteOnlyDataCommand to implement the functionality and then has a light layer for the embedded_graphics part.
<AlexandrosLiarok> I guess I could port it to use AsyncWriteOnlyDataCommand
<AlexandrosLiarok> then it can be async for all methods including flush and also implement DrawableTarget with a framebuffer.
IlPalazzo-ojiisa has quit [Quit: Leaving.]
IlPalazzo-ojiisa has joined #rust-embedded
IlPalazzo-ojiisa has quit [Client Quit]
IlPalazzo-ojiisa has joined #rust-embedded
cinemaSundays has left #rust-embedded [#rust-embedded]
hmw has quit [Quit: Bye.]
hmw has joined #rust-embedded
psukys has quit [Quit: bye]
shookees has joined #rust-embedded
shookees is now known as psukys
psukys has quit [Changing host]
psukys has joined #rust-embedded
M9names[m] has quit [Quit: Idle timeout reached: 172800s]
IlPalazzo-ojiisa has quit [Quit: Leaving.]
SosthneGudon[m] has quit [Quit: Idle timeout reached: 172800s]