@@ -129,8 +129,7 @@ static uint8_t tx_buffer[1000];
129129 * and are strictly related to the hardware platform used.
130130 *
131131 */
132- static int32_t platform_write (void * handle , uint8_t reg ,
133- uint8_t * bufp ,
132+ static int32_t platform_write (void * handle , uint8_t reg , const uint8_t * bufp ,
134133 uint16_t len );
135134static int32_t platform_read (void * handle , uint8_t reg , uint8_t * bufp ,
136135 uint16_t len );
@@ -191,8 +190,7 @@ static int32_t lsm6dsm_read_lis2mdl_cx(void *ctx, uint8_t reg,
191190 * to master I2C interface.
192191 */
193192static int32_t lsm6dsm_write_lis2mdl_cx (void * ctx , uint8_t reg ,
194- uint8_t * data ,
195- uint16_t len )
193+ const uint8_t * data , uint16_t len )
196194{
197195 axis3bit16_t data_raw_acceleration ;
198196 int32_t mm_error ;
@@ -422,20 +420,19 @@ void lsm6dsm_sens_hub_fifo_lis2mdl(void)
422420 * @param len number of consecutive register to write
423421 *
424422 */
425- static int32_t platform_write (void * handle , uint8_t reg ,
426- uint8_t * bufp ,
423+ static int32_t platform_write (void * handle , uint8_t reg , const uint8_t * bufp ,
427424 uint16_t len )
428425{
429426#if defined(NUCLEO_F411RE )
430427 HAL_I2C_Mem_Write (handle , LSM6DSM_I2C_ADD_H , reg ,
431- I2C_MEMADD_SIZE_8BIT , bufp , len , 1000 );
428+ I2C_MEMADD_SIZE_8BIT , ( uint8_t * ) bufp , len , 1000 );
432429#elif defined(STEVAL_MKI109V3 )
433430 HAL_GPIO_WritePin (CS_up_GPIO_Port , CS_up_Pin , GPIO_PIN_RESET );
434431 HAL_SPI_Transmit (handle , & reg , 1 , 1000 );
435- HAL_SPI_Transmit (handle , bufp , len , 1000 );
432+ HAL_SPI_Transmit (handle , ( uint8_t * ) bufp , len , 1000 );
436433 HAL_GPIO_WritePin (CS_up_GPIO_Port , CS_up_Pin , GPIO_PIN_SET );
437434#elif defined(SPC584B_DIS )
438- i2c_lld_write (handle , LSM6DSM_I2C_ADD_H & 0xFE , reg , bufp , len );
435+ i2c_lld_write (handle , LSM6DSM_I2C_ADD_H & 0xFE , reg , ( uint8_t * ) bufp , len );
439436#endif
440437 return 0 ;
441438}
0 commit comments