RUI: How to set RUI_I2C_ST - I2C_REG_MAGIC


I am using RAK5205. Because it does not have enough ADC inputs, I am using I2C-ADC chip ADS1114 to get 4 analog inputs via I2C interface.

I saw in rui.h:

#define I2C_REG_MAGIC 0xAA
typedef struct RUI_I2C_ST {
uint32_t INSTANCE_ID;
uint32_t PIN_SDA; // SDA pin num
uint32_t PIN_SCL; // SCL pin num
uint32_t FREQUENCY;
uint32_t REG_NULL; // if no reg , should be 0xAA

uint32_t rui_i2c_rw(RUI_I2C_ST rui_i2c,RUI_IF_READ_WRITE rw, uint8_t devAddr, uint16_t regAddr, uint8_t data, uint16_t len);

What does REG_NULL=0xAA means? Does it mean the parameter regAddr in rui_i2c_rw() will be ignored? I am asking this because my I2C device, during read, does not need the regAddr.

Thanks and regards
Boh Lim

Hi, @bohlimsim
This parameter is not used in RAK5205 module.If Init ,you can config it to 0.
devAddr and regAddr must be needed at IIC standard agreement ,but you could set up a custom address.


I could not get I2C-ADC chip ADS1114 to work in RAK5205m using your RUI I2C API (rui_i2c_rw etc).

But I could get ADS1114 to work in ESP32 (using its IDE framework), and also in beaglebone, within a day,
So there is no issue with my I2C concept/usage…

What is the next step I can do?

Thanks and regards
Boh Lim

I don’t know how you use it.
We provide some application references,about RAK5205 based on RAK811 you can FYI: