Skip to content

Commit 434e79e

Browse files
author
albezanc
committed
lps22ch: added const to stmdev_write_ptr #121
1 parent f266cb8 commit 434e79e

2 files changed

Lines changed: 8 additions & 9 deletions

File tree

lps22ch_STdC/driver

lps22ch_STdC/examples/lps22ch_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);
@@ -201,20 +201,19 @@ void lps22ch_read_data_polling(void)
201201
* @param len number of consecutive register to write
202202
*
203203
*/
204-
static int32_t platform_write(void *handle, uint8_t reg,
205-
uint8_t *bufp,
204+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
206205
uint16_t len)
207206
{
208207
#if defined(NUCLEO_F411RE)
209208
HAL_I2C_Mem_Write(handle, LPS22CH_I2C_ADD_H, reg,
210-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
209+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
211210
#elif defined(STEVAL_MKI109V3)
212211
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
213212
HAL_SPI_Transmit(handle, &reg, 1, 1000);
214-
HAL_SPI_Transmit(handle, bufp, len, 1000);
213+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
215214
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
216215
#elif defined(SPC584B_DIS)
217-
i2c_lld_write(handle, LPS22CH_I2C_ADD_H & 0xFE, reg, bufp, len);
216+
i2c_lld_write(handle, LPS22CH_I2C_ADD_H & 0xFE, reg, (uint8_t*) bufp, len);
218217
#endif
219218
return 0;
220219
}

0 commit comments

Comments
 (0)