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
rardiol has joined #rust-embedded
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> I'm not involved with knurling at all
<re_irc> <@9names:matrix.org> It's already been talked about a bit hasn't it? I think the ferrous systems folks will be on top of it shortly.
<re_irc> In the meantime, you can
<re_irc> cargo install probe-run --version 0.3.6 --locked
<re_irc> <@jamesmunns:beeper.com> So it probably wouldn't help if I looked :)
<re_irc> <@elpiel:matrix.org> Ohh, I didn't know that, sorry
<re_irc> <@elpiel:matrix.org> : thanks, I already installed it from the fix I made so I don't have any issues
IlPalazzo-ojiisa has joined #rust-embedded
<re_irc> <@dirbaio:matrix.org> : fyi you're still listed in https://github.com/sponsors/knurling-rs
rardiol has joined #rust-embedded
<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> <@ryan-summers:matrix.org> codec_abc: One pattern I like to do is move all the init code into a single module to have it self contained. Take a look at Stabilizer's hardware setup routines for an example: https://github.com/quartiq/stabilizer/blob/main/src/hardware/setup.rs#L204
<re_irc> <@ryan-summers:matrix.org> That way you can abstract the hardware setup away from the core app logic
<re_irc> <@ryan-summers:matrix.org> Makes the RTIC init function _much_ cleaner and more understandable IMO: https://github.com/quartiq/stabilizer/blob/main/src/bin/dual-iir.rs#L207
dc740 has joined #rust-embedded
rardiol has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
rardiol has joined #rust-embedded
emerent has quit [Ping timeout: 265 seconds]
emerent has joined #rust-embedded
<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)
rardiol has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
rardiol has joined #rust-embedded
<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]
rardiol has joined #rust-embedded
rardiol has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
rardiol has joined #rust-embedded
<re_irc> <@codec_abc:matrix.org> : do you have some code to share? I get the idea but I am sure I could learn quite a lote by reading some code
markov_twain has joined #rust-embedded
<re_irc> <@konkers:matrix.org> Is the WG meeting today? I've finally made time to attend/observe. How does one join it?
<re_irc> <@newam:matrix.org> : it just happens here, in text, but I think it might be on pause for this week since Adam is away (?)
<re_irc> <@konkers:matrix.org> Gotcha, thanks!
<re_irc> <@datdenkikniet:matrix.org> Here are the meeting notes at least: https://hackmd.io/OfUnVXfxQhORdKMtHo8Emw
lehmrob has joined #rust-embedded
starblue has joined #rust-embedded
lehmrob has quit [Quit: Konversation terminated!]
rardiol has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
rardiol has joined #rust-embedded
rardiol has quit [Read error: Connection reset by peer]
rardiol has joined #rust-embedded
rardiol has quit [Read error: Connection reset by peer]
rardiol has joined #rust-embedded
rardiol has quit [Ping timeout: 260 seconds]
rardiol has joined #rust-embedded
rardiol has quit [Read error: Connection reset by peer]
rardiol has joined #rust-embedded
<re_irc> <@peter9477:matrix.org> codec_abc: Actually I do. I made this a while back just to share here. https://gist.github.com/peter9477/1c8e6496a99df173ed8aaee6aad9e9a9
<re_irc> <@peter9477:matrix.org> Let me know if that's helpful, or if you have feedback to improve it. Not sure yet if it will help others.
Lumpio- has quit [Ping timeout: 260 seconds]
cr1901 has quit [Read error: Connection reset by peer]
cr1901 has joined #rust-embedded
Lumpio- has joined #rust-embedded
dc740 has quit [Remote host closed the connection]
<re_irc> <@andrewgazelka:matrix.org> https://sharegpt.com/c/TNuafJZ :)