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
GuineaWheek[m] has joined #rust-embedded
<GuineaWheek[m]> what i've found is that it's often good to have escape hatches even in the high-level drivers
<GuineaWheek[m]> sometimes you can't always imagine what a user is going to do with your driver and suddenly you run into issues
<GuineaWheek[m]> often my first response is to end up vendoring the crate
dirbaio[m] has joined #rust-embedded
<dirbaio[m]> This is why I said "for concrete use cases"
<dirbaio[m]> If that concrete use case doesn't match what you as a user want to do you shouldn't use that driver, just use the low level drivers
<dirbaio[m]> If the high level driver has "escape hatches" that let you modify internals with the pac directly or whatever, if creates two problems:
<dirbaio[m]> 1. You can't make effective use of it without reading the driver source code. You have to see how the driver works internally and what registers it sets and when so you know what to override
<dirbaio[m]> 2. Now making any change to the drivers internals is potentially a breaking change, there's no way to predict what interactions it could have with everyone's low level overrides
Artea has quit [Remote host closed the connection]
Artea has joined #rust-embedded
sroemer has joined #rust-embedded
sroemer has quit [Ping timeout: 276 seconds]
sroemer has joined #rust-embedded
sroemer has quit [Changing host]
sroemer has joined #rust-embedded
PicklePoacher[m] has joined #rust-embedded
<PicklePoacher[m]> Hello there! I am new here. :)
dngrs[m] has joined #rust-embedded
<dngrs[m]> STM32 has this too, they call it DMA continuous conversion mode
diagprov has joined #rust-embedded
EthanGardner[m] has joined #rust-embedded
<EthanGardner[m]> Does probe_rs have a way of flashing over a generic uart similar to st-flash: https://github.com/stlink-org/stlink
JamesMunns[m] has joined #rust-embedded
<JamesMunns[m]> No, probe-rs generally only works over debuggers, not with bootloaders (like the serial DFU one)
<EthanGardner[m]> Happen to know any crates that do have it implemented
<JamesMunns[m]> Not off the top of my head, maybe someone else does.
diondokter[m] has joined #rust-embedded
<diondokter[m]> I created one that worked with STM and RP. But proprietary for a customer.
<diondokter[m]> But the company stopped... I can ask someone who worked there about the IP.
<diondokter[m]> Maybe I can open source it with permissions
<EthanGardner[m]> That would be lovely lol
<diondokter[m]> Though it wasn't uart, but usb
<dirbaio[m]> There's the USB dfu class. Embassy-usb has an impl for the firmware side, and I believe I've seen a rust impl of the host side somewhere as well
<diondokter[m]> Funny thing is that RP does something custom for its usb flashing. But it's so much better than the usb-dfu standard to work with :P
<dirbaio[m]> Yeah! Less customizable tho, for example there's no way to make it check the fw has some header or sig to check it's actually intended for this hardware and not just any random uf2
<dirbaio[m]> (rp235x maybe with secure boot can do it?)
<dirbaio[m]> And no way to change vid/pid/name
<JamesMunns[m]> the rp2350 does let you program otp for white labeling
<JamesMunns[m]> Check out "USB White-Labelling" in the rp2350 docs (section 5.7)
<dirbaio[m]> fancy!
Ralph[m] has joined #rust-embedded
<Ralph[m]> is there a reason why embedded-hal v1 has a set_state for GPIOs to use PinState but no state to get it? that could be added in a non-breaking way based on is_high and is_low, right? or can there be an InputPin which is neither high nor low? (for a digital pin i don't expect a tri-state behaviour?)
marmrt[m] has joined #rust-embedded
<marmrt[m]> you have StatefulOutputPin as a separate trait for pins which can read their output states
<Ralph[m]> i have an input pin in my case. i'm just designing an API where i get a `PinState` and have to check `is_low` / `is_high` to check if it's the desired state - if i'd have a `state` in e-h (which would do that... (full message at <https://catircservices.org/_irc/v1/media/download/AR8O4UMftlDIyRxO0A-J3tdEfUyysTJkZySuKndWA8vVagf8UMtsZ7QjuJNjVi-UtZ2vwnQyCq5U-PteWsYomZi_8AAAAAAAAGNhdGlyY3NlcnZpY2VzLm9yZy90ZnN6QmN4YlBGbXBxRkdqdnp0WElLd3Y>)
<Ralph[m]> how can i use `embedded-hal-bus` to use an (async) I2C bus for two devices where i have both in a `postcard-rpc` `Context` (i.e. a static `struct`)?... (full message at <https://catircservices.org/_irc/v1/media/download/AZ7KYrnp1DPjpL0KXdHGt6nDNsq3lRya3YMkgKCNYkp6cS4-N6g-ClE97VlJJU68hq6g2N9yhfh9X24OsjsXY2y_8AAAAAAAAGNhdGlyY3NlcnZpY2VzLm9yZy9rcnBMTUFqSWZuQXVibXlLZXVYRkJweWE>)
<dirbaio[m]> put the `RefCell<I2c<'static...>>` in a StaticCell
<dirbaio[m]> so you get a `&'static RefCell<I2c<...>>`
<dirbaio[m]> then construct as many I2cRefCellDevices you need from that
<dirbaio[m]> * in a [StaticCell, * StaticCell](https://docs.rs/static_cell/latest/static_cell/struct.StaticCell.html)
<dirbaio[m]> the issue is you need the RefCell to live forever, but you cannot put it in Context together with the I2cRefCellDevice because that would make it self-referential. StaticCell allows you to statically allocate it somewhere else, solving the problem.
sroemer has quit [Quit: WeeChat 4.5.2]
jfsimon has quit [Ping timeout: 276 seconds]
<Ralph[m]> thanks! that feels weird - is there any case where `RefCellDevice` can be used on its own then? i guess in almost all cases you need to pass it to other places where you then run into these lifetime issues? is this something which could/should be added to the examples in `embedded-hal-bus`? (which IMHO feels rather short on examples)
<Ralph[m]> using one of the other `*Device` impls from e-h-b doesn't improve the situation, right?
jfsimon has joined #rust-embedded
jfsimon has quit [Remote host closed the connection]
jfsimon has joined #rust-embedded
zeenix[m] has joined #rust-embedded
<zeenix[m]> Could heapless admins please add https://github.com/sosthene-nitrokey maintainer rights? They have contributed significantly to the crate, have been reviewing PRs and even helping with releases.
<zeenix[m]> s/add/give/
<zeenix[m]> Otherwise, it'll remain almost unmaintained
<zeenix[m]> adamgreig: dirbaio: ^
<zeenix[m]> Of course it could also be someone else that you trust more and think they'll be able to help with the maintenance
diagprov has quit [Quit: Connection closed for inactivity]
adamgreig[m] has joined #rust-embedded
<adamgreig[m]> <zeenix[m]> Could heapless admins please add https://github.com/sosthene-nitrokey maintainer rights? They have contributed significantly to the crate, have been reviewing PRs and even helping with releases.
<adamgreig[m]> If they're interested the usual process would be to volunteer to join the libs team to help maintain it
<zeenix[m]> Sosthène Guédon: ^