<re_irc> <@firefrommoonlight:matrix.org> I treat RMs as the source of truth for STM32, eg in how I suggest PAC changes, and how I write and document HAL functions
<re_irc> <@firefrommoonlight:matrix.org> adamgreig: Yea, like the H7 DMA indexing. It's outstanding!
<re_irc> <@firefrommoonlight:matrix.org> And re the Stream/Channel thing... This is one case where I deliberately deviated from the RM in API design... I chose consistency with the other STM32s
fabic has joined #rust-embedded
<re_irc> <@dirbaio:matrix.org> same, embassy calls them all "channels". Why the hell did they change that??? 🤣
<re_irc> <@firefrommoonlight:matrix.org> It's designed to trigger emotions (like frustration), which increases product engagement
starblue has quit [Ping timeout: 252 seconds]
starblue has joined #rust-embedded
<re_irc> <@oddstr13:matrix.org> dirbaio: welp, I think this means I'm stuck for now 😒
<re_irc> <@dirbaio:matrix.org> ah yeah you need nonblocking receive
* re_irc @oddstr13:matrix.org looks over at his code that just throws a Packet at DMA and prays nothing else touches it
<re_irc> <@dirbaio:matrix.org> I guess you need to be "receiving in the background" all the time somehow
<re_irc> <@dirbaio:matrix.org> and only when you need to send, stop the receive, send, restart the receive
<re_irc> <@oddstr13:matrix.org> pretty much, yea
<re_irc> <@oddstr13:matrix.org> potentially with an interrupt stashing packets in a buffer & re-starting rx
<re_irc> <@oddstr13:matrix.org> async I can work around with my very ugly unsafe unsound hack, but I don't know to deal with the `self.lower.clone()` stuff (copying around a reference to `ieee802154::Radio`?)
<re_irc> <@dirbaio:matrix.org> you can probably just put a &Radio
<re_irc> <@oddstr13:matrix.org> I assume I'm supposed to stash the radio in some other object rather than directly into the struct like this?
<re_irc> <@oddstr13:matrix.org> ```rust
<re_irc> <@oddstr13:matrix.org> pub struct IEEE802154Socket {
<re_irc> <@oddstr13:matrix.org> lower: ieee802154::Radio<'static>,
<re_irc> <@dirbaio:matrix.org> that should work
<re_irc> <@dirbaio:matrix.org> on `receive` you can do the receive, then return a RxToken with the received packet and a TxToken with a `&'a mut Radio`so it can later transmit the response
<re_irc> <@dirbaio:matrix.org> lifetimes on the `Device` trait are a bit confusing, it's kinda a hack to workaround lack of GAT (generic associated types)
<re_irc> <@dirbaio:matrix.org> essentially it's allowed for RxToken/TxToken to borrow stuff from the Device
<re_irc> <@dirbaio:matrix.org> ah you're copying from RawSocket?
<re_irc> <@oddstr13:matrix.org> yep, I grabbed RawSocket
<re_irc> <@oddstr13:matrix.org> I can push my current mess to github if you wanna look at what I've got
<re_irc> <@dirbaio:matrix.org> yea these don't have lifetimes in RxToken/TxToken
<re_irc> <@dirbaio:matrix.org> you can put a lifetime on it and hook it up like this https://github.com/smoltcp-rs/smoltcp/blob/master/src/phy/loopback.rs#L34
<re_irc> <@dirbaio:matrix.org> then TxToken can borrow stuff from the Device struct
<re_irc> <@oddstr13:matrix.org> here's my current (obviously non-working) mess; https://github.com/oddstr13/usb-dongle-smoltcp-6lowpan-test/blob/master/src/ieee802154socket/mod.rs
<re_irc> <@oddstr13:matrix.org> I really don't have a good grasp on lifetimes yet, but I'm getting a conflict between 'static and 'a it looks like
<re_irc> <@dirbaio:matrix.org> ```rust
<re_irc> <@dirbaio:matrix.org> pub struct TxToken<'a> {
<re_irc> <@dirbaio:matrix.org> }
<re_irc> <@dirbaio:matrix.org> lower: &'a mut ieee802154::Radio,
<re_irc> <@dirbaio:matrix.org> I'm gonna go sleep, it's 5AM here
<re_irc> <@dirbaio:matrix.org> have fun :)
<re_irc> <@oddstr13:matrix.org> welp, time flies when having fun 🙈
DepthDeluxe has joined #rust-embedded
DepthDeluxe has quit [Ping timeout: 260 seconds]
fabic has quit [Ping timeout: 260 seconds]
emerent has quit [Ping timeout: 252 seconds]
emerent has joined #rust-embedded
dcz has joined #rust-embedded
richardeoin has quit [Ping timeout: 240 seconds]
richardeoin has joined #rust-embedded
<re_irc> <@richarddodd:matrix.org> Does anyone know of a good compile-time map for embedded?
<re_irc> <@richarddodd:matrix.org> (or lookup table)
<re_irc> <@xiretza:xiretza.xyz> what are your keys?
starblue has quit [Ping timeout: 260 seconds]
starblue has joined #rust-embedded
<re_irc> <@richarddodd:matrix.org> Keys are bytes
<re_irc> <@richarddodd:matrix.org> (or ascii characters)
<re_irc> <@xiretza:xiretza.xyz> and a simple `[T; 256]` won't cut it?
<re_irc> <@richarddodd:matrix.org> hmm maybe that's the best solution. Would be 4 * 256 ~ 1K mem. I'm probably not going to beat that with any other method.
<re_irc> <@richarddodd:matrix.org> Might stick with that for now, then if I run out, then start changing things.
fabic has joined #rust-embedded
fabic has quit [Ping timeout: 252 seconds]
DepthDeluxe has joined #rust-embedded
fabic has joined #rust-embedded
<re_irc> <@thejpster:matrix.org> https://github.com/rust-phf/rust-phf
<re_irc> <@newam:matrix.org> How cursed is this for RTC example code?
<re_irc> <@newam:matrix.org> ```rs
<re_irc> <@newam:matrix.org> use proc_macro::TokenStream;
<re_irc> <@newam:matrix.org> extern crate proc_macro;
<re_irc> <@thejpster:matrix.org> I've seen worse. But it does completely break repeatable builds - what do you need the timestamp for?
<re_irc> <@newam:matrix.org> Just for example code (to make the date-time set a little closer to reality), I wanted to see if I could, I didn't know that proc-macros were not sandboxed.
starblue has quit [Ping timeout: 252 seconds]
DepthDeluxe has quit [Ping timeout: 260 seconds]
DepthDeluxe has joined #rust-embedded
fabic has quit [Ping timeout: 265 seconds]
starblue has joined #rust-embedded
<re_irc> <@newam:matrix.org> is this safe (or is there a better way do extract non-overlapping sub-slices from an array)?
<re_irc> <@newam:matrix.org> ```rs
<re_irc> <@newam:matrix.org> use core::slice;
<re_irc> <@newam:matrix.org> pub fn main () {
<Lumpio-> If you need just two parts use split_at_mut
<Lumpio-> Otherwise there's chunks_mut and such
<re_irc> <@newam:matrix.org> `split_at_mut` works great, thanks!
<re_irc> <@eldruin:matrix.org> PSA: `embedded-hal` `1.0.0-alpha.5` is out: https://github.com/rust-embedded/embedded-hal/releases/tag/v1.0.0-alpha.5
dcz has quit [Ping timeout: 252 seconds]
<Lumpio-> Whoa, 1.x?
starblue has quit [Ping timeout: 252 seconds]
<re_irc> <@almindor:matrix.org> Yay
starblue has joined #rust-embedded
crabbedhaloablut has quit [Write error: Connection reset by peer]
<re_irc> <@thejpster:matrix.org> newam:matrix.org: It's safe - and it's in the Book as an example of an unsafe function wrapped in a safe function
GenTooMan has quit [Ping timeout: 260 seconds]
GenTooMan has joined #rust-embedded
GenTooMan has quit [Excess Flood]
GenTooMan has joined #rust-embedded
<re_irc> <@firefrommoonlight:matrix.org> Has anyone used CMSIS? I'm interested in some of the DSP functions, and am deciding whether to translate, or use FFI. Leaning translate, although FFI has the advantage of being able to import the whole library
<re_irc> <@firefrommoonlight:matrix.org> The C-compiling and FFI piece seem... nontrivial