so i just wanted to initialize the i2c-Bus and write data to a known address.
In lua it was quite simple:
id=0
sda=3 --GPIO0
scl=4 --GPIO2
i2c.setup(id, sda, scl, i2c.SLOW)
i2c.start(id)
i2c.address(id, "address" ,i2c.TRANSMITTER)
i2c.write(id,"something")
i2c.stop(id)
I wanted to write a c-code to do the same, but i don't know how to address the slave correctly. I tried it several times with this basic code and some minor changes, so hopefully someone could help me out.
user_init()
{
i2c_master_gpio_init();
i2c_master_init();
i2c_master_start();
ack=i2c_master_getAck();
i2c_master_stop;
i2c_master_start();
i2c_master_writeByte("something");
i2c_master_stop();
return;}
in i2c_master.h i uncomment this, because i wanted to use GPIO0 and GPIO2
#define I2C_MASTER_SDA_MUX PERIPHS_IO_MUX_GPIO2_U
#define I2C_MASTER_SCL_MUX PERIPHS_IO_MUX_GPIO0_U
#define I2C_MASTER_SDA_GPIO 2
#define I2C_MASTER_SCL_GPIO 0
#define I2C_MASTER_SDA_FUNC FUNC_GPIO2
#define I2C_MASTER_SCL_FUNC FUNC_GPIO0
and commented the define section before with GPIO14 and GPIO2.
Grateful for every piece of help