zBeeble42 has joined #rust-embedded
zBeeble has quit [Read error: Connection reset by peer]
starblue has joined #rust-embedded
starblue3 has quit [Ping timeout: 240 seconds]
emerent has quit [Ping timeout: 255 seconds]
emerent has joined #rust-embedded
<re_irc> <@j​ohn_socha:m​atrix.org> I have a module I created that is processor independent...mostly. I had to use a generic so the caller provides type-specific I2C information:
<re_irc> <@j​ohn_socha:m​atrix.org> ```rs
<re_irc> <@j​ohn_socha:m​atrix.org> where
<re_irc> <@j​ohn_socha:m​atrix.org> pub struct Lcd<I>
dcz has joined #rust-embedded
dcz_ has quit [Ping timeout: 256 seconds]
Ekho has quit [*.net *.split]
Darius has quit [*.net *.split]
vancz has quit [*.net *.split]
vancz has joined #rust-embedded
Darius_ has joined #rust-embedded
Darius_ is now known as Darius
cyrozap has quit [*.net *.split]
cyrozap has joined #rust-embedded
Ekho has joined #rust-embedded
crabbedhaloablut has quit [Quit: No Ping reply in 180 seconds.]
crabbedhaloablut has joined #rust-embedded
<re_irc> <@9​names:m​atrix.org> adamgreig: Yep, sure does
<re_irc> <@d​irbaio:m​atrix.org> but no defmt 😛
<re_irc> <@9​names:m​atrix.org> Very true! And it's a lot more effort to set up
<re_irc> <@j​amesmunns:m​atrix.org> dirbaio: Not built in, but possible :D
<re_irc> <@j​amesmunns:m​atrix.org> https://ferrous-systems.com/blog/gdb-and-defmt/
<re_irc> <@d​irbaio:m​atrix.org> lol `cat /dev/ttyUSB0 | defmt-print -f path/to/elf`
fabic_ has quit [Ping timeout: 265 seconds]
<re_irc> <@g​rantm11235:m​atrix.org> john_socha: There is no need to create a new trait, you can pass an `Lcd` struct to a function like this:
<re_irc> <@g​rantm11235:m​atrix.org> ```rust
<re_irc> <@g​rantm11235:m​atrix.org> fn foo<I>(lcd: Lcd<I>)
<re_irc> <@g​rantm11235:m​atrix.org> where
<re_irc> <@g​rantm11235:m​atrix.org> I: embedded_hal::blocking::i2c::Write,
zBeeble42 has quit [Read error: Connection reset by peer]
zBeeble42 has joined #rust-embedded
<re_irc> <@m​athias_koch:m​atrix.org> I'm looking for the best way to encode data in a HTTP request.
<re_irc> <@m​athias_koch:m​atrix.org> Requirements:
<re_irc> <@m​athias_koch:m​atrix.org> - Must be able to deserialize borrowed with serde or equivalent (i cannot afford doubling the stack usage)
<re_irc> <@m​athias_koch:m​atrix.org> - Must be able to re represented in ascii due to my shitty AT based device
<re_irc> <@d​irbaio:m​atrix.org> > Must be able to be represented in ascii due to my shitty AT based device
<re_irc> <@d​irbaio:m​atrix.org> 🤯... I'm not sure HTTP itself is always fully-ascii in all situations
<re_irc> <@m​athias_koch:m​atrix.org> Hmm..Well, if i could solve the base64 inplace decoding, i could just change my certificates from PEM to Base64(DER), and both my issues would be solved.. 😲
<re_irc> <@d​irbaio:m​atrix.org> some content encodings can be binary
<re_irc> <@d​irbaio:m​atrix.org> might be ok if you control the client but still..
<re_irc> <@d​irbaio:m​atrix.org> what AT device is it? 🤣
<re_irc> <@m​athias_koch:m​atrix.org> Ublox cellular device.. Issue is that im cutting corners, using the offloaded http client, that writes to a file on the AT device, to be read later on.. And the file read command doesn't support HEX reading, only ascii
<re_irc> <@m​athias_koch:m​atrix.org> But i am on a deadline :/
<re_irc> <@d​irbaio:m​atrix.org> oh noo :D
<re_irc> <@d​irbaio:m​atrix.org> inplace base64 decode should be possible, as encoded is always longer
<re_irc> <@m​athias_koch:m​atrix.org> You don't happen to have a base64 decoder that mutates? :p
<re_irc> <@m​athias_koch:m​atrix.org> exactly
<re_irc> <@d​irbaio:m​atrix.org> but I think it's super rare 🤣
<re_irc> <@d​irbaio:m​atrix.org> i'd just roll my own, it shouldn't be that hard copypasting from an existing impl and adjusting it
<re_irc> <@m​athias_koch:m​atrix.org> That will probably be my go-to aswell.. Hmm, off we go i guess.
<re_irc> <@d​irbaio:m​atrix.org> or do hex instead of base64 if oyu can afford 2x bloat? :P
<re_irc> <@d​irbaio:m​atrix.org> base64 is 1.33x bloat
<re_irc> <@d​irbaio:m​atrix.org> btw I think regular file read should work fine with binary data
<re_irc> <@d​irbaio:m​atrix.org> they do on simcoms at least
<re_irc> <@m​athias_koch:m​atrix.org> Hmm.. interesting.. How is that encoded?
<re_irc> <@m​riise:m​atrix.org> u would need to move a way from JSON to use binary formats
<re_irc> <@m​athias_koch:m​atrix.org> Yeah, i realise that. But that wouldn't be a problem if my AT device works with binary.. I can just use COBS or CBOR, or equivalent
<re_irc> <@d​irbaio:m​atrix.org> you ask it to read 100 bytes, it spits the 100 bytes on the uart, raw
<re_irc> <@d​irbaio:m​atrix.org> so you read 100 bytes
<re_irc> <@d​irbaio:m​atrix.org> how to distinguish the bytes from an "ERROR" response, no idea :rofl:
<re_irc> <@m​athias_koch:m​atrix.org> Huh.. Guess i'll give that a shot
<re_irc> <@m​athias_koch:m​atrix.org> :p
<re_irc> <@d​irbaio:m​atrix.org> but at least you can read "raw"
<re_irc> <@d​irbaio:m​atrix.org> but it may be different on ubloxs, dunno :S
<re_irc> <@d​irbaio:m​atrix.org> AT+URDFILE="filename"
<re_irc> <@d​irbaio:m​atrix.org> OK
<re_irc> <@d​irbaio:m​atrix.org> +URDFILE: "filename",36,"these bytes are the data of the file"
<re_irc> <@d​irbaio:m​atrix.org> Notes
<re_irc> <@d​irbaio:m​atrix.org> • The returned file data is displayed as an ASCII string of <size> characters in the range [0x00,0xFF]. At
<re_irc> <@d​irbaio:m​atrix.org> the end of the string, <CR><LF> are provided for user convenience and visualization purposes.
<re_irc> <@d​irbaio:m​atrix.org> that seems to imply it does spit out the data raw?
<re_irc> <@d​irbaio:m​atrix.org> so even if it's wrapped in `"` quotes, it's the raw unsecaped bytes? 🤷‍♂️
<re_irc> <@m​athias_koch:m​atrix.org> That what i feel like is strange ? 😕
<re_irc> <@d​irbaio:m​atrix.org> I wouldn't be surprised, AT is full of weird shit like this
<re_irc> <@d​irbaio:m​atrix.org> strings-but-not-really 💩
<re_irc> <@m​athias_koch:m​atrix.org> Yeah! I am so sick a tired of all the edge cases.. All vendor specific... 🤮
<re_irc> <@d​irbaio:m​atrix.org> it's a flaming pile of rotten garbage
<re_irc> <@m​athias_koch:m​atrix.org> Which binary encoding would be my go-to, with borrowed decoding?
<re_irc> <@d​irbaio:m​atrix.org> `repr(C)` struct? 🤣
<re_irc> <@m​athias_koch:m​atrix.org> Seems a little hard to error handle in the long run?
<re_irc> <@d​irbaio:m​atrix.org> otherwise I dunno, haven't played with serde in nostd
<re_irc> <@d​irbaio:m​atrix.org> I get by fine with repr(c) hehe
<re_irc> <@d​irbaio:m​atrix.org> I'm ok with fixed-length-ing everything etc
<re_irc> <@d​irbaio:m​atrix.org> though yeah extending it is inflexible
<re_irc> <@d​irbaio:m​atrix.org> you can append fields, just make sure to `asert!(received_len >= size_of::<Foo>())` instead of `==`
<re_irc> <@d​irbaio:m​atrix.org> so that old decoders ignore the extra fields.. I've been burned by this a few times..
<re_irc> <@d​irbaio:m​atrix.org> literally zero code size for decoding, hard to beat that :D
fabic_ has joined #rust-embedded
cr19011 has joined #rust-embedded
cr1901 has quit [Killed (NickServ (GHOST command used by cr19011!~William@2601:8d:8600:911:7c10:167b:ad8e:ebd))]
cr19011 is now known as cr1901
<re_irc> <@r​icharddodd:m​atrix.org> I've always wondered if you can decode escape sequences in-place. OFC depends on the scheme you are using, but if you have \\, \n, \t, \u{1234}, they are all smaller when decoded.
hifi has quit [Remote host closed the connection]
hifi has joined #rust-embedded
fabic_ has quit [Ping timeout: 252 seconds]
cr19011 has joined #rust-embedded
cr1901 has quit [Read error: Connection reset by peer]
fabic_ has joined #rust-embedded
<re_irc> <@f​irefrommoonlight:m​atrix.org> john_socha: You only need one window with Probe-run instead of 2, you don't have to mess with config files, and the print isn't lagged
neceve has joined #rust-embedded
fabic_ has quit [Ping timeout: 258 seconds]
fabic_ has joined #rust-embedded
fabic has joined #rust-embedded
<re_irc> <@j​ohn_socha:m​atrix.org> GrantM11235: Perfect! Thanks.
fabic_ has quit [Ping timeout: 252 seconds]
<re_irc> <@j​duchniewicz:m​atrix.org> I need to definitely experiment with aforementioned probe-rs and cross (maybe even dig into the project itself!)
<re_irc> <@j​duchniewicz:m​atrix.org> did only very simple _probing_ (excuse the pun)
<re_irc> <@j​duchniewicz:m​atrix.org> as most of my projects are C/C++ related ATM
<re_irc> <@j​duchniewicz:m​atrix.org> glad to be seeing a stark rise of Rust jobs in embedded recently though
neceve has quit [Ping timeout: 268 seconds]
<re_irc> <@a​lmindor:m​atrix.org> is there any primitive "usb-stack" written for a pin-connected usb? (e.g. manual pin operation)
<re_irc> <@g​rantm11235:m​atrix.org> almindor: I don't know of anything written in rust, but you could check out V-USB for inspiration https://www.obdev.at/products/vusb/index.html
<re_irc> <@a​lmindor:m​atrix.org> found this abstraction: https://github.com/mvirkkunen/usb-device
<re_irc> <@a​lmindor:m​atrix.org> seems promising, not sure if it's worth the trouble tho. I just wanted to use a generic hid gamepad with my mcu for fun :D
<re_irc> <@g​rantm11235:m​atrix.org> Oh, you want the MCU to be the USB host?
<re_irc> <@a​lmindor:m​atrix.org> yeah I just wanna use a basic gamepad to control it, I thought about dismantling it and directly wiring some buttons but then I thought,... why not just usb
<re_irc> <@g​rantm11235:m​atrix.org> USB is pretty complicated, you might want to use something simpler. I believe NES/SNES controllers just use a shift register, wiimote accessories and NES mini controllers use i2c
<re_irc> <@a​lmindor:m​atrix.org> oh this is just a generic HID gamepad, some logitech thing I dug out
<re_irc> <@a​lmindor:m​atrix.org> I'm considering dismantling and just getting some of the buttons out if possible, wire them up directly
<re_irc> <@g​rantm11235:m​atrix.org> That would be about a billion times easier than trying to figure out a bit-banged usb host stack 🤣\
neceve has joined #rust-embedded
fabic has quit [Ping timeout: 258 seconds]
<re_irc> <@a​lmindor:m​atrix.org> doesn't seem THAT complex here: https://github.com/stm32-rs/stm32-usbd/blob/master/examples/hal.rs
<re_irc> <@g​rantm11235:m​atrix.org> In that example, the MCU is acting as a USB peripheral, not a host
<re_irc> <@a​lmindor:m​atrix.org> oh, right...
<re_irc> <@g​rantm11235:m​atrix.org> It is also not bit-banged, it is using some built-in USB hardware
<re_irc> <@g​rantm11235:m​atrix.org> That hardware might also support host mode, but I'm not sure
cr19011 is now known as cr1901
starblue has quit [Ping timeout: 258 seconds]
starblue has joined #rust-embedded
GenTooMan has quit [Ping timeout: 252 seconds]
neceve has quit [Ping timeout: 256 seconds]
GenTooMan has joined #rust-embedded
<re_irc> <@h​mvp:m​atrix.org> Anybody knows why `form` has a 0.8.0 release (https://crates.io/crates/form/0.8.0) but its repo does not have the code for that? https://github.com/djmcgill/form only says 0.7.0 in its Cargo.toml
<re_irc> <@a​nahata:m​atrix.org> Probably someone just forgot to push is all
<re_irc> <@o​ddstr13:m​atrix.org> ^ Protip; to avoid this ever happening, use GitHub Actions to build/package and publish releases
<re_irc> <@o​ddstr13:m​atrix.org> release-drafter is also awesome
<re_irc> <@a​damgreig:m​atrix.org> do you give GHA permission to publish to crates.io for you?
<re_irc> <@a​damgreig:m​atrix.org> `cargo-release` is nice too
<re_irc> <@t​herealprof:m​atrix.org> As much as I love GHA, I'm not terribly crazy about relying for everything on GHA, especially when it requires more upfront work to setup than to do it manually quite a few times.
<re_irc> <@a​nahata:m​atrix.org> Not a fan of github in general myself, MS has shown they're not at all a good steward of open source (shocking, I know)