@@ -161,8 +161,7 @@ static sensbus_t mag_bus = {&SENSOR_BUS,
161161 * and are strictly related to the hardware platform used.
162162 *
163163 */
164- static int32_t platform_write (void * handle , uint8_t reg ,
165- uint8_t * bufp ,
164+ static int32_t platform_write (void * handle , uint8_t reg , const uint8_t * bufp ,
166165 uint16_t len );
167166static int32_t platform_read (void * handle , uint8_t reg , uint8_t * bufp ,
168167 uint16_t len );
@@ -422,27 +421,26 @@ void lsm303ah_self_test(void)
422421 * @param len number of consecutive register to write
423422 *
424423 */
425- static int32_t platform_write (void * handle , uint8_t reg ,
426- uint8_t * bufp ,
424+ static int32_t platform_write (void * handle , uint8_t reg , const uint8_t * bufp ,
427425 uint16_t len )
428426{
429427 sensbus_t * sensbus = (sensbus_t * )handle ;
430428#if defined(NUCLEO_F411RE )
431429 /* Write multiple command */
432430 reg |= 0x80 ;
433431 HAL_I2C_Mem_Write (sensbus -> hbus , sensbus -> i2c_address , reg ,
434- I2C_MEMADD_SIZE_8BIT , bufp , len , 1000 );
432+ I2C_MEMADD_SIZE_8BIT , ( uint8_t * ) bufp , len , 1000 );
435433#elif defined(STEVAL_MKI109V3 )
436434 /* Write multiple command */
437435 reg |= 0x40 ;
438436 HAL_GPIO_WritePin (sensbus -> cs_port , sensbus -> cs_pin , GPIO_PIN_RESET );
439437 HAL_SPI_Transmit (sensbus -> hbus , & reg , 1 , 1000 );
440- HAL_SPI_Transmit (sensbus -> hbus , bufp , len , 1000 );
438+ HAL_SPI_Transmit (sensbus -> hbus , ( uint8_t * ) bufp , len , 1000 );
441439 HAL_GPIO_WritePin (sensbus -> cs_port , sensbus -> cs_pin , GPIO_PIN_SET );
442440#elif defined(SPC584B_DIS )
443441 reg |= 0x80 ;
444- i2c_lld_write (sensbus -> hbus , sensbus -> i2c_address & 0xFE , reg , bufp ,
445- len );
442+ i2c_lld_write (sensbus -> hbus , sensbus -> i2c_address & 0xFE , reg ,
443+ ( uint8_t * ) bufp , len );
446444#endif
447445 return 0 ;
448446}
0 commit comments