@@ -150,8 +150,7 @@ static sensbus_t mag_bus = {&SENSOR_BUS,
150150 * and are strictly related to the hardware platform used.
151151 *
152152 */
153- static int32_t platform_write (void * handle , uint8_t reg ,
154- uint8_t * bufp ,
153+ static int32_t platform_write (void * handle , uint8_t reg , const uint8_t * bufp ,
155154 uint16_t len );
156155static int32_t platform_read (void * handle , uint8_t reg , uint8_t * bufp ,
157156 uint16_t len );
@@ -417,8 +416,7 @@ void lsm303agr_self_test(void)
417416 * @param len number of consecutive register to write
418417 *
419418 */
420- static int32_t platform_write (void * handle , uint8_t reg ,
421- uint8_t * bufp ,
419+ static int32_t platform_write (void * handle , uint8_t reg , const uint8_t * bufp ,
422420 uint16_t len )
423421{
424422 sensbus_t * sensbus = (sensbus_t * )handle ;
@@ -430,7 +428,7 @@ static int32_t platform_write(void *handle, uint8_t reg,
430428 }
431429
432430 HAL_I2C_Mem_Write (sensbus -> hbus , sensbus -> i2c_address , reg ,
433- I2C_MEMADD_SIZE_8BIT , bufp , len , 1000 );
431+ I2C_MEMADD_SIZE_8BIT , ( uint8_t * ) bufp , len , 1000 );
434432#elif defined(STEVAL_MKI109V3 )
435433
436434 if (sensbus -> cs_pin == CS_up_Pin ) {
@@ -440,7 +438,7 @@ static int32_t platform_write(void *handle, uint8_t reg,
440438
441439 HAL_GPIO_WritePin (sensbus -> cs_port , sensbus -> cs_pin , GPIO_PIN_RESET );
442440 HAL_SPI_Transmit (sensbus -> hbus , & reg , 1 , 1000 );
443- HAL_SPI_Transmit (sensbus -> hbus , bufp , len , 1000 );
441+ HAL_SPI_Transmit (sensbus -> hbus , ( uint8_t * ) bufp , len , 1000 );
444442 HAL_GPIO_WritePin (sensbus -> cs_port , sensbus -> cs_pin , GPIO_PIN_SET );
445443#elif defined(SPC584B_DIS )
446444
@@ -449,8 +447,8 @@ static int32_t platform_write(void *handle, uint8_t reg,
449447 reg |= 0x80 ;
450448 }
451449
452- i2c_lld_write (sensbus -> hbus , sensbus -> i2c_address & 0xFE , reg , bufp ,
453- len );
450+ i2c_lld_write (sensbus -> hbus , sensbus -> i2c_address & 0xFE , reg ,
451+ ( uint8_t * ) bufp , len );
454452#endif
455453 return 0 ;
456454}
0 commit comments