Raspberry Pi as an i2c follower with Rppal or Pigpio

I’m using the RPPAL library/crate to send messages on a i2c bus from a Raspberry Pi. The RPI is supposed to be a leader on the bus and RPPal is fine for that but I know the RPI can also act as a follower sometimes, on a separate bus set on another set of GPIO. With the Pigpio library it was possible to assign an address to it an make it receive messages sent over an i2c bus.

I’m wondering if anyone has successfully got a Raspberry Pi to act as an i2c follower using the RPPal library or if there’s any other solution using Rust. I know RPpal is apparently not made for that, at least such a scenario is not documented but perhaps there’s a trick I could use ?

There is a Pigpio library (or bindings) made for Rust but unfortunately it doesn’t implement the i2c part of it yet, especially the Bsci2c or Bscxfer (As documented here) and used here in Cpp that gives the possibility to have the RPi act as a follower. Unfortunately, I don’t know how to expand the Rust version of this library by myself... At least, not yet, I’m still very new to Rust :slight_smile:

Well, if anyone knows how I can do that with Rust... Any whelp would be really appreciated.

Thanks :wink:

I’ve been thinking about how to solve this problem by myself. Using the original Pigpio C Library seems to be the fastest path rather than asking to implement the possibility to add this feature in RPPAL. I must have missed that part in the book but creating « bindings » for a C library is apparently a possibility, perhaps I could try that.

There are already several Pigpio projects in Crates.io but none of them contains the i2c functions that I need. I read about « Bindgen » and watched a Rust meetup video about it. I cannot say that I understand everything about it but maybe I’ll try to do the work of porting Pigpio to Rust by myself. Do you think it’s somehow accessible for a newbie Rustecean ? Or should I try to only port the functions that I need manually ?


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.