cancel
Showing results for 
Search instead for 
Did you mean: 

How to integrate driver for iis2mdc magnetometer

GS1
Senior III

Hi all,

I need to integrate the driver for the iis2mdc magnetometer (Github: https://github.com/STMicroelectronics/stm32-iis2mdc/tree/main) into my own project for a custom board (with STM32H7A3 and i2c3). 

 

The code from the driver requires an additional hardware driver so that the magnetometer can be read/written to. However this interface functions are not included in the driver on Github.

 

int32_t __weak iis2mdc_read_reg( ...) and

 

int32_t __weak iis2mdc_write_reg(stmdev_ctx_t *ctx, uint8_t reg,
uint8_t *data,
uint16_t len)
{
int32_t ret;

ret = ctx->write_reg(ctx->handle, reg, data, len);

return ret;
}

 

Is there any sample code available, which can be simply adjusted for the specific i2c interface?

 

or do I simply have to replace the call:

ret = ctx->write_reg(ctx->handle, reg, data, len);    

by  the corresponding    HAL_i2c... calls?

 

Many thanks for any hints.

BR GS

 

   

0 REPLIES 0