Skip to content

Commit aece2e8

Browse files
author
albezanc
committed
lps27hhw: added const to stmdev_write_ptr #121
1 parent f0f4cbe commit aece2e8

2 files changed

Lines changed: 8 additions & 9 deletions

File tree

lps27hhw_STdC/driver

lps27hhw_STdC/examples/lps27hhw_read_data_polling.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
*/
5454

5555
//#define STEVAL_MKI109V3 /* little endian */
56-
#define NUCLEO_F411RE /* little endian */
56+
//#define NUCLEO_F411RE /* little endian */
5757
//#define SPC584B_DIS /* big endian */
5858

5959
/* ATTENTION: By default the driver is little endian. If you need switch
@@ -93,6 +93,7 @@
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"
@@ -122,8 +123,7 @@ static uint8_t tx_buffer[TX_BUF_DIM];
122123
*
123124
*/
124125

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,
127127
uint16_t len);
128128
static int32_t platform_read(void *handle, uint8_t reg, uint8_t *bufp,
129129
uint16_t len);
@@ -199,20 +199,19 @@ void lps27hhw_read_data_polling(void)
199199
* @param len number of consecutive register to write
200200
*
201201
*/
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,
204203
uint16_t len)
205204
{
206205
#if defined(NUCLEO_F411RE)
207206
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);
209208
#elif defined(STEVAL_MKI109V3)
210209
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
211210
HAL_SPI_Transmit(handle, &reg, 1, 1000);
212-
HAL_SPI_Transmit(handle, bufp, len, 1000);
211+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
213212
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
214213
#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);
216215
#endif
217216
return 0;
218217
}

0 commit comments

Comments
 (0)