Call I2C to method of Micropython from C
Posted: Tue Mar 09, 2021 7:24 am
Hi, again I have a doubt about how to implement some methods to use the I2C from C, this is as an educational purpose, currently I want to use the functions contained in the pyb_i2c.c file located in ports/stm32.
using these functions that are defined for micropython:
In this case I want to use to call the functions, but I have not found any clear example of how to implement the call, it would be very helpful, some example of using this method.
Thank you very much in advance for any advice.
using these functions that are defined for micropython:
Code: Select all
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&pyb_i2c_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_mem_read), MP_ROM_PTR(&pyb_i2c_mem_read_obj) },
{ MP_ROM_QSTR(MP_QSTR_mem_write), MP_ROM_PTR(&pyb_i2c_mem_write_obj)
Code: Select all
mp_call_function_n_kw
Thank you very much in advance for any advice.