<cr1901>
Ahhh, it requires the critical-section feature
starblue has quit [Ping timeout: 252 seconds]
starblue has joined #rust-embedded
dc740 has quit [Remote host closed the connection]
<re_irc>
<ignormies> burrbull: I'm probably going to just be reimplementing the logic of the crate myself (with "blocking::spi::Write") for my own use-case specific purposes (there's not much in there after all).
<re_irc>
<ignormies> I guess it's because it _always_ ".read()"s after ".send()"ing? But that still doesn't explain why I get "Overrun" errors whenever I use the example...
emerent has joined #rust-embedded
dc740 has joined #rust-embedded
causal has quit [Quit: WeeChat 3.6]
neceve has joined #rust-embedded
crabbedhaloablut has quit [Remote host closed the connection]
crabbedhaloablut has joined #rust-embedded
crabbedhaloablut has quit [Ping timeout: 258 seconds]
<re_irc>
<alvela> Anyone have any suggestions for how to manage ownership of a variable which needs use by both application and driver code?
<re_irc>
There's a delay variable used by this LCD driver I'm hacking on and it takes ownership of it, preventing me from using it directly in application code
<re_irc>
<alvela> I considered passing it as a mut reference to all the functions which need it (not the most elegant) but am prevented from doing so due to a function which uses the delay adhering to a trait
<re_irc>
<newam> if your delay variable can be expressed as an integer and you're on a platform with atomic that can work
<re_irc>
<newam> * atomics
<re_irc>
<alvela> Mind elaborating on what you mean by atomics? For more context, the delay I'm using is "cortex_m::delay::Delay" and the library uses "embedded_hal::blocking::delay::DelayMs"
<re_irc>
<newam> Are you trying to pass around a mutable struct that implements delay ("cortex_m::delay::Delay") or the duration the delay consumes ("embedded_hal::blocking::delay::DelayMs")?
<re_irc>
<alvela> The struct itself
<re_irc>
<alvela> My initial question is on good software patterns. Can change on either side of app/library if there's a better approach
<re_irc>
<newam> Ahhh, yeah that's more difficult :S
<re_irc>
Generally I rely on the RTOS to provide a delay function.
<re_irc>
<alvela> Maybe it's time I finally work on some RTIC stuff haha
<re_irc>
<alvela> I was just mostly annoyed that I can't use the delay after initializing the driver
<re_irc>
<GrantM11235> Can you just create a new delay struct?
<re_irc>
<alvela> I don't believe so, the delay takes ownership of the system timer
<re_irc>
Wouldn't work for concurrent delays without extra logic though
<re_irc>
<newam> since it modifies the systick registers each time it gets called
<re_irc>
<alvela> Will consider these approaches, thanks! I think I may hold off on changing anything until I get a better picture of what's most "ergonomic" when working with an RTOS
<re_irc>
<GrantM11235> This would be super easy with embassy btw
<re_irc>
<alvela> I've been off and on following James' MnemOS dev on twitter. Cool to see all the work different folks are doing in this space
<re_irc>
<GrantM11235> Does your display driver _need_ to take ownership of a delay struct? The display driver that I used only needed to borrow the delay struct during initialization. You could try patching your display driver to do the same
<re_irc>
<alvela> Fair point. I hadn't considered that. Only one way to find out 🤷
<re_irc>
I know it does for init for sure, but there's some delays after data transfers (to I2C backpack) sprinkled in
<re_irc>
<alvela> Only my third or so foray into reading datasheets, so it's been pretty easy to get lost....esp w/ the extra i2c backpack in the mix
<re_irc>
<adamgreig> newam: man, the "issues" badge goes green if there's 0 open? that's the first time i've seen it :D
starblue has quit [Ping timeout: 244 seconds]
starblue has joined #rust-embedded
dc740 has quit [Remote host closed the connection]
dc740 has joined #rust-embedded
dc740 has quit [Remote host closed the connection]