9393#include "usbd_cdc_if.h"
9494#include "gpio.h"
9595#include "spi.h"
96+ #include "tim.h"
9697
9798#elif defined(SPC584B_DIS )
9899#include "components.h"
@@ -118,8 +119,7 @@ static stmdev_ctx_t dev_ctx;
118119 * and are strictly related to the hardware platform used.
119120 *
120121 */
121- static int32_t platform_write (void * handle , uint8_t reg ,
122- uint8_t * bufp ,
122+ static int32_t platform_write (void * handle , uint8_t reg , const uint8_t * bufp ,
123123 uint16_t len );
124124static int32_t platform_read (void * handle , uint8_t reg , uint8_t * bufp ,
125125 uint16_t len );
@@ -191,20 +191,19 @@ void lps33k_read_data_polling(void)
191191 * @param len number of consecutive register to write
192192 *
193193 */
194- static int32_t platform_write (void * handle , uint8_t reg ,
195- uint8_t * bufp ,
194+ static int32_t platform_write (void * handle , uint8_t reg , const uint8_t * bufp ,
196195 uint16_t len )
197196{
198197#if defined(NUCLEO_F411RE )
199198 HAL_I2C_Mem_Write (handle , LPS33K_I2C_ADD , reg ,
200- I2C_MEMADD_SIZE_8BIT , bufp , len , 1000 );
199+ I2C_MEMADD_SIZE_8BIT , ( uint8_t * ) bufp , len , 1000 );
201200#elif defined(STEVAL_MKI109V3 )
202201 HAL_GPIO_WritePin (CS_up_GPIO_Port , CS_up_Pin , GPIO_PIN_RESET );
203202 HAL_SPI_Transmit (handle , & reg , 1 , 1000 );
204- HAL_SPI_Transmit (handle , bufp , len , 1000 );
203+ HAL_SPI_Transmit (handle , ( uint8_t * ) bufp , len , 1000 );
205204 HAL_GPIO_WritePin (CS_up_GPIO_Port , CS_up_Pin , GPIO_PIN_SET );
206205#elif defined(SPC584B_DIS )
207- i2c_lld_write (handle , LPS33K_I2C_ADD & 0xFE , reg , bufp , len );
206+ i2c_lld_write (handle , LPS33K_I2C_ADD & 0xFE , reg , ( uint8_t * ) bufp , len );
208207#endif
209208 return 0 ;
210209}
@@ -280,6 +279,6 @@ static void platform_init(void)
280279 TIM3 -> CCR2 = PWM_3V3 ;
281280 HAL_TIM_PWM_Start (& htim3 , TIM_CHANNEL_1 );
282281 HAL_TIM_PWM_Start (& htim3 , TIM_CHANNEL_2 );
283- HAL_Delay (1000 );
282+ platform_delay (1000 );
284283#endif
285284}
0 commit comments