-
Notifications
You must be signed in to change notification settings - Fork 48
Description
I want to use a CH32 to read out some analog peripherals and provide the values via I2C. I built an async driver that operates the I2C peripheral in device mode (also requested in #70). I put the code and a demo here:
https://github.com/polygon/ch32_i2cdevice/
It works for a while and then stops. Requests are no longer answered, the program spins in the embassy executor, and interrupts on the I2C device are disabled (ITEVTEN=0, ITERREN=0 in I2C1_CTLR2). I can't really see a way how these interrupts could get disabled while the poll function is being waited on (I verified that it's awaiting listen
).
Very happy for ideas about what might be going wrong here.
Driver src: https://github.com/polygon/ch32_i2cdevice/blob/main/src/i2c_device.rs
Demo src: https://github.com/polygon/ch32_i2cdevice/blob/main/src/bin/demo.rs