...
Instead of this:
Code Block |
---|
int lsmdso_read_reg(uint8_t reg)
{
return HAL_i2c_Mem_read(...); // THIS IS A FUNCTION FROM STM ONLY FOR CERTAIN STM32 DEVICES
} |
...
Code Block |
---|
typedef void (*I2C_WriteFuncPtr)(int device_addr, int reg_addr, int data); typedef int (*I2C_ReadFuncPtr)(int device_addr, int reg_addr); static I2C_WriteFuncPtr local_I2C_Write = NULL; static I2C_ReadFuncPtr local_I2C_Read = NULL; void lsm6dso_init(I2C_WriteFuncPtr write_func, I2C_ReadFuncPtr read_func) { local_I2C_Write = write_func; local_I2C_Read = read_func; } int lsmdso_read_reg(uint8_t reg) { return local_I2C_Read(...); } |
...