@@ -123,8 +123,7 @@ static uint8_t tx_buffer[TX_BUF_DIM];
123123 *
124124 */
125125
126- static int32_t platform_write (void * handle , uint8_t reg ,
127- uint8_t * bufp ,
126+ static int32_t platform_write (void * handle , uint8_t reg , const uint8_t * bufp ,
128127 uint16_t len );
129128static int32_t platform_read (void * handle , uint8_t reg , uint8_t * bufp ,
130129 uint16_t len );
@@ -200,20 +199,19 @@ void example_main(void)
200199 * @param len number of consecutive register to write
201200 *
202201 */
203- static int32_t platform_write (void * handle , uint8_t reg ,
204- uint8_t * bufp ,
202+ static int32_t platform_write (void * handle , uint8_t reg , const uint8_t * bufp ,
205203 uint16_t len )
206204{
207205#if defined(NUCLEO_F411RE )
208206 HAL_I2C_Mem_Write (handle , LPS27HHTW_I2C_ADD_H , reg ,
209- I2C_MEMADD_SIZE_8BIT , bufp , len , 1000 );
207+ I2C_MEMADD_SIZE_8BIT , ( uint8_t * ) bufp , len , 1000 );
210208#elif defined(STEVAL_MKI109V3 )
211209 HAL_GPIO_WritePin (CS_up_GPIO_Port , CS_up_Pin , GPIO_PIN_RESET );
212210 HAL_SPI_Transmit (handle , & reg , 1 , 1000 );
213- HAL_SPI_Transmit (handle , bufp , len , 1000 );
211+ HAL_SPI_Transmit (handle , ( uint8_t * ) bufp , len , 1000 );
214212 HAL_GPIO_WritePin (CS_up_GPIO_Port , CS_up_Pin , GPIO_PIN_SET );
215213#elif defined(SPC584B_DIS )
216- i2c_lld_write (handle , LPS27HHTW_I2C_ADD_H & 0xFE , reg , bufp , len );
214+ i2c_lld_write (handle , LPS27HHTW_I2C_ADD_H & 0xFE , reg , ( uint8_t * ) bufp , len );
217215#endif
218216 return 0 ;
219217}
0 commit comments