5151 */
5252
5353//#define STEVAL_MKI109V3 /* little endian */
54- #define NUCLEO_F411RE /* little endian */
54+ // #define NUCLEO_F411RE /* little endian */
5555//#define SPC584B_DIS /* big endian */
5656
5757/* ATTENTION: By default the driver is little endian. If you need switch
9292#include "usbd_cdc_if.h"
9393#include "gpio.h"
9494#include "spi.h"
95+ #include "tim.h"
9596
9697#elif defined(SPC584B_DIS )
9798#include "components.h"
@@ -126,8 +127,7 @@ static uint8_t tx_buffer[1000];
126127 * and are strictly related to the hardware platform used.
127128 *
128129 */
129- static int32_t platform_write (void * handle , uint8_t reg ,
130- uint8_t * bufp ,
130+ static int32_t platform_write (void * handle , uint8_t reg , const uint8_t * bufp ,
131131 uint16_t len );
132132static int32_t platform_read (void * handle , uint8_t reg , uint8_t * bufp ,
133133 uint16_t len );
@@ -148,6 +148,8 @@ void lsm6dsrx_fifo_pedo_simple(void)
148148 ag_ctx .handle = & SENSOR_BUS ;
149149 /* Init test platform */
150150 platform_init ();
151+ /* Wait sensor boot time */
152+ platform_delay (BOOT_TIME );
151153 /* Check device ID */
152154 lsm6dsrx_device_id_get (& ag_ctx , & whoamI );
153155
@@ -236,20 +238,19 @@ void lsm6dsrx_fifo_pedo_simple(void)
236238 * @param len number of consecutive register to write
237239 *
238240 */
239- static int32_t platform_write (void * handle , uint8_t reg ,
240- uint8_t * bufp ,
241+ static int32_t platform_write (void * handle , uint8_t reg , const uint8_t * bufp ,
241242 uint16_t len )
242243{
243244#if defined(NUCLEO_F411RE )
244245 HAL_I2C_Mem_Write (handle , LSM6DSRX_I2C_ADD_L , reg ,
245- I2C_MEMADD_SIZE_8BIT , bufp , len , 1000 );
246+ I2C_MEMADD_SIZE_8BIT , ( uint8_t * ) bufp , len , 1000 );
246247#elif defined(STEVAL_MKI109V3 )
247248 HAL_GPIO_WritePin (CS_up_GPIO_Port , CS_up_Pin , GPIO_PIN_RESET );
248249 HAL_SPI_Transmit (handle , & reg , 1 , 1000 );
249- HAL_SPI_Transmit (handle , bufp , len , 1000 );
250+ HAL_SPI_Transmit (handle , ( uint8_t * ) bufp , len , 1000 );
250251 HAL_GPIO_WritePin (CS_up_GPIO_Port , CS_up_Pin , GPIO_PIN_SET );
251252#elif defined(SPC584B_DIS )
252- i2c_lld_write (handle , LSM6DSRX_I2C_ADD_L & 0xFE , reg , bufp , len );
253+ i2c_lld_write (handle , LSM6DSRX_I2C_ADD_L & 0xFE , reg , ( uint8_t * ) bufp , len );
253254#endif
254255 return 0 ;
255256}
0 commit comments