lanre[m] has quit [Quit: Idle timeout reached: 172800s]
sroemer has quit [Quit: WeeChat 4.4.2]
sroemer has joined #rust-embedded
bpye has quit [Quit: Ping timeout (120 seconds)]
bpye has joined #rust-embedded
davidmpye[m] has joined #rust-embedded
<davidmpye[m]>
Does anybody know if there is a crate that implements i2c-tiny-usb in rust? I would like to use an RP2040 to expose an i2c device over usb to a Pi
<davidmpye[m]>
I could port it but there's nothing more delicious than finding someone's already done it
<JamesMunns[m]>
Not sure about i2c-tiny-usb, but you could use postcard-rpc to roll your own. I've used that to bridge SPI/uart etc
<JamesMunns[m]>
I guess it depends what you need to connect to on the host side, whether it is rust or something else :)
<davidmpye[m]>
Definitely going to use postcard-rpc elsewhere in the system as it IS rust it'll be connecting to, so it might well be reasonable for this too
<JamesMunns[m]>
Yeah, I can send you an example of how you can do this, I have an example for uart, should be easy to switch over to i2c.
<JamesMunns[m]>
If you expect to have multiple devices, or want some extra interface stuff, I can send you a preview build of poststation (https://onevariable.com/poststation/) too :)
<davidmpye[m]>
Ooh, I'll have a read, thank you. What I've done so far is get the rp2040 to scan a matrix keypad on the gpios and expose it as a usb keyboard to the host
<davidmpye[m]>
Reason for that was so the code on the Pi can just read from the /dev/input subsystem and any app I want to control should just work. (Yes, I want the vending machine it is part of to be able to run a doom port....!)
<davidmpye[m]>
Poststation does look interesting!
<JamesMunns[m]>
You should be able to have both postcard-rpc + usb HID at the same time, I definitely don't have any examples for that though :D
<davidmpye[m]>
There are going to be two separate picos in my system, one running postcard-rpc to handle most of the vending and payment subsystems, and the other is the IO one handling a keyboard and an i2c lcd
<davidmpye[m]>
No reason why the keyboard/i2c lcd one couldn't expose the LCD via postcard
<JamesMunns[m]>
Gotcha! Poststation might also be good if you want it to all be through a single interface, and you can talk to both devices through a single API :D
<davidmpye[m]>
I'd just assumed I'd bridge it as i2c but actually it just needs some endpoints to push text to the screen, clear it, and set backlight. Postcard would be ideal for that afaica
<davidmpye[m]>
*s
<JamesMunns[m]>
I just realized that the UART demo is in customer code, so I can't publish that, I can put together a simple i2c demo quickly tho for you.
<JamesMunns[m]>
yeah, the idea would be to expose a dumb interface, and on the host side you'd impl the embedded-hal-async traits so you can use drivers transparently.
<JamesMunns[m]>
gimme 10 and I'll share you a link, it's a good demo for me to have.
<davidmpye[m]>
I wouldn't want to put you to the effort as I can do with the practice but I might reappear when I get stuck! That's an extremely kind offer though
drahnr[m] has quit [Quit: Idle timeout reached: 172800s]