rardiol has quit [Read error: Connection reset by peer]
rardiol has joined #rust-embedded
rardiol has quit [Ping timeout: 252 seconds]
markov_twain has quit [Ping timeout: 250 seconds]
<re_irc>
<@rmja:matrix.org> Hi all, are there any good examples of using the "menu" crate with async handlers?
<re_irc>
<@thejpster:matrix.org> It’ll probably be rewriting to support async. Until we get keyword generics.
<re_irc>
<@rmja:matrix.org> I was thinking something along having some kind of: starting an active future which could run until it was aborted. Maybe with a Ctrl+X abort.
<re_irc>
<@rmja:matrix.org> The problem is the "context: &mut T" for the handler callbacks which does not really live long enough.
<re_irc>
<@paologentili:matrix.org> Hi everyone, I'm having a problem with monomorphization bloat but I'm struggling to understand where is the problem. I have a trait with many default functions and I have 4 implementors of such trait. I can see that there are three copies of those default functions and, a couple of commits ago where one of the implementor was a little bit smaller, only two copies. So, my first question is: why do I have only 2/3 copies...
<re_irc>
... of those default trait functions instead of 4 like the implementors? Is there any way to avoid it in my case? Those are not generic functions.
<re_irc>
<@elpiel:matrix.org> I want to raise awareness of an issue with the latest "probe-run", maybe you can take a quick look at the PR?
<re_irc>
<@jamesmunns:beeper.com> That list is pretty out of date, cc could y'all update that?
<re_irc>
<@thejpster:matrix.org> I can take you off, but the picker is broken in Safari and it turns out the only device with my 2FA codes on it is flat so I can't log into Chrome
<re_irc>
<@thejpster:matrix.org> It works better in Chrome 🙄
<re_irc>
<@codec_abc:matrix.org> Hi again, I want to split my microcontroller initialization code into several functions for clarity. I use some features of the STM32F3 (Rcc, Flash, GPIO). The problem is that there are many functions (constraint, split, etc..) that take a field of the Peripherals struct by value which result in partial moves. As such, I struggle to refactor my code and split it into different functions. Do you happen to know a Rust...
<re_irc>
... pattern to do this?
<re_irc>
<@codec_abc:matrix.org> Hi again, I want to split my microcontroller initialization code into several functions for clarity. I use some features of the STM32F3 (Rcc, Flash, GPIO).
<re_irc>
The problem is that there are many functions (constraint, split, etc..) that take a field of the Peripherals struct by value which result in partial moves.
<re_irc>
As such, I struggle to refactor my code and split it into different functions. Do you happen to know a Rust pattern to do this?
<re_irc>
<@firefrommoonlight:matrix.org> : I usually do this too
<re_irc>
<@firefrommoonlight:matrix.org> I'll have a "setup" module as well that handles most of the MCU peripheral initialization. It can be short or long depending on how many periphs a given project uses
<re_irc>
<@firefrommoonlight:matrix.org> It might be split into "setup_pins", "setup_buses", "setup_can", "setup_dma" etc depending on how complicated it is
<re_irc>
<@firefrommoonlight:matrix.org> Then will have individual modules for offboard hardware in a "drivers" folder, which contain the reg writes or payload handling code for a given peripheral. These are usually a single-file each
<re_irc>
<@firefrommoonlight:matrix.org> The main initialization function will call the setup_busses etc to get the HAL peripheral structs, then pass then pass them mutably to the "drivers" modules in init, and ultimately store in some global state
<re_irc>
<@firefrommoonlight:matrix.org> +locked
<re_irc>
<@firefrommoonlight:matrix.org> It might be split into "setup_pins", "setup_buses", "setup_can", "setup_dma" functions etc depending on how complicated it is (or if very complicated, could use sep modules)
<re_irc>
<@peter9477:matrix.org> codec_abc: I have a board.rs that returns a custom struct of structs, containing all the required peripherals/pins/etc grouped according to my required functionality/design. That is retrieved in my main(), and then handed out one struct at a time to various init methods defined in other places, e.g. "accel::init(board.accel); display::init(board.display);", more or less. Ends up being quite clean really. As long as the...
<re_irc>
... partial moves all occur in the same function it doesn't seem there's any issue, but this way you don't have to actually do all the initialization in one long function... that would be awful.
rardiol has quit [Remote host closed the connection]