Open panciunio opened 1 year ago
I also ran into this - wanted to use a ch32v003 as a one-shot i2c configurator for a PMIC (current limits, various settings, etc.) and discovered that there's no easy API for it.
The only example I found is using low-level registers like ssd1306_i2c.h does, but nothing as straightfoward as Arduino's
Wire.begin();
Wire.beginTransmission(0x61); // target
Wire.write(0xd1); // CURRENT_LIMIT
Wire.write(0b11001111); // 750mA
Wire.endTransmission();
Though not quite as simplified-down as Arduino, check out https://github.com/ADBeta/CH32V003_lib_i2c
Just now I'm working on easy project which shall read some data from I2C bus and provide the results on display (also connected via I2C). There is two example related to I2C but one is concerned to hardware so deep.. and second example shown SLAVE mode.
It's little bit hard to understand how to connect other devices with own driver - e.g. I wrote in the past working code for RTC (PCF8583) dedicated to AVR and I want to rewrite it for RISC-V...
In case, I need some elementary functions/methods like:
It will be very easy to write driver related to any I2C device... for example for my PCF8583 read method: