5454 */
5555
5656//#define STEVAL_MKI109V3 /* little endian */
57- #define NUCLEO_F411RE /* little endian */
57+ // #define NUCLEO_F411RE /* little endian */
5858//#define SPC584B_DIS /* big endian */
5959
6060/* ATTENTION: By default the driver is little endian. If you need switch
9595#include "usbd_cdc_if.h"
9696#include "gpio.h"
9797#include "spi.h"
98+ #include "tim.h"
9899
99100#elif defined(SPC584B_DIS )
100101#include "components.h"
@@ -121,8 +122,7 @@ static uint16_t threshold = (uint16_t)(1711 * 0.192f);
121122 * and are strictly related to the hardware platform used.
122123 *
123124 */
124- static int32_t platform_write (void * handle , uint8_t reg ,
125- uint8_t * bufp ,
125+ static int32_t platform_write (void * handle , uint8_t reg , const uint8_t * bufp ,
126126 uint16_t len );
127127static int32_t platform_read (void * handle , uint8_t reg , uint8_t * bufp ,
128128 uint16_t len );
@@ -249,26 +249,25 @@ void lis3mdl_interrupt(void)
249249 * @param len number of consecutive register to write
250250 *
251251 */
252- static int32_t platform_write (void * handle , uint8_t reg ,
253- uint8_t * bufp ,
252+ static int32_t platform_write (void * handle , uint8_t reg , const uint8_t * bufp ,
254253 uint16_t len )
255254{
256255#if defined(NUCLEO_F411RE )
257256 /* Write multiple command */
258257 reg |= 0x80 ;
259258 HAL_I2C_Mem_Write (handle , LIS3MDL_I2C_ADD_L , reg ,
260- I2C_MEMADD_SIZE_8BIT , bufp , len , 1000 );
259+ I2C_MEMADD_SIZE_8BIT , ( uint8_t * ) bufp , len , 1000 );
261260#elif defined(STEVAL_MKI109V3 )
262261 /* Write multiple command */
263262 reg |= 0x40 ;
264263 HAL_GPIO_WritePin (CS_up_GPIO_Port , CS_up_Pin , GPIO_PIN_RESET );
265264 HAL_SPI_Transmit (handle , & reg , 1 , 1000 );
266- HAL_SPI_Transmit (handle , bufp , len , 1000 );
265+ HAL_SPI_Transmit (handle , ( uint8_t * ) bufp , len , 1000 );
267266 HAL_GPIO_WritePin (CS_up_GPIO_Port , CS_up_Pin , GPIO_PIN_SET );
268267#elif defined(SPC584B_DIS )
269268 /* Write multiple command */
270269 reg |= 0x80 ;
271- i2c_lld_write (handle , LIS3MDL_I2C_ADD_L & 0xFE , reg , bufp , len );
270+ i2c_lld_write (handle , LIS3MDL_I2C_ADD_L & 0xFE , reg , ( uint8_t * ) bufp , len );
272271#endif
273272 return 0 ;
274273}
@@ -349,7 +348,7 @@ static void platform_init(void)
349348 TIM3 -> CCR2 = PWM_3V3 ;
350349 HAL_TIM_PWM_Start (& htim3 , TIM_CHANNEL_1 );
351350 HAL_TIM_PWM_Start (& htim3 , TIM_CHANNEL_2 );
352- HAL_Delay (1000 );
351+ platform_delay (1000 );
353352#endif
354353}
355354
0 commit comments