|
53 | 53 | */ |
54 | 54 |
|
55 | 55 | //#define STEVAL_MKI109V3 /* little endian */ |
56 | | -#define NUCLEO_F411RE /* little endian */ |
| 56 | +//#define NUCLEO_F411RE /* little endian */ |
57 | 57 | //#define SPC584B_DIS /* big endian */ |
58 | 58 |
|
59 | 59 | /* ATTENTION: By default the driver is little endian. If you need switch |
|
93 | 93 | #include "usbd_cdc_if.h" |
94 | 94 | #include "gpio.h" |
95 | 95 | #include "spi.h" |
| 96 | +#include "tim.h" |
96 | 97 |
|
97 | 98 | #elif defined(SPC584B_DIS) |
98 | 99 | #include "components.h" |
@@ -122,8 +123,7 @@ static uint8_t tx_buffer[TX_BUF_DIM]; |
122 | 123 | * |
123 | 124 | */ |
124 | 125 |
|
125 | | -static int32_t platform_write(void *handle, uint8_t reg, |
126 | | - uint8_t *bufp, |
| 126 | +static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp, |
127 | 127 | uint16_t len); |
128 | 128 | static int32_t platform_read(void *handle, uint8_t reg, uint8_t *bufp, |
129 | 129 | uint16_t len); |
@@ -199,20 +199,19 @@ void lps27hhw_read_data_polling(void) |
199 | 199 | * @param len number of consecutive register to write |
200 | 200 | * |
201 | 201 | */ |
202 | | -static int32_t platform_write(void *handle, uint8_t reg, |
203 | | - uint8_t *bufp, |
| 202 | +static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp, |
204 | 203 | uint16_t len) |
205 | 204 | { |
206 | 205 | #if defined(NUCLEO_F411RE) |
207 | 206 | HAL_I2C_Mem_Write(handle, LPS27HHW_I2C_ADD_H, reg, |
208 | | - I2C_MEMADD_SIZE_8BIT, bufp, len, 1000); |
| 207 | + I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000); |
209 | 208 | #elif defined(STEVAL_MKI109V3) |
210 | 209 | HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET); |
211 | 210 | HAL_SPI_Transmit(handle, ®, 1, 1000); |
212 | | - HAL_SPI_Transmit(handle, bufp, len, 1000); |
| 211 | + HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000); |
213 | 212 | HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET); |
214 | 213 | #elif defined(SPC584B_DIS) |
215 | | - i2c_lld_write(handle, LPS27HHW_I2C_ADD_H & 0xFE, reg, bufp, len); |
| 214 | + i2c_lld_write(handle, LPS27HHW_I2C_ADD_H & 0xFE, reg, (uint8_t*) bufp, len); |
216 | 215 | #endif |
217 | 216 | return 0; |
218 | 217 | } |
|
0 commit comments