Skip to content

Commit 4573922

Browse files
author
albezanc
committed
lps33w: added const to stmdev_write_ptr #121
1 parent fed43d7 commit 4573922

4 files changed

Lines changed: 16 additions & 22 deletions

File tree

lps33w_STdC/driver

lps33w_STdC/examples/lps33w_multi_read_fifo.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ static stmdev_ctx_t dev_ctx;
117117
* and are strictly related to the hardware platform used.
118118
*
119119
*/
120-
static int32_t platform_write(void *handle, uint8_t reg,
121-
uint8_t *bufp,
120+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
122121
uint16_t len);
123122
static int32_t platform_read(void *handle, uint8_t reg, uint8_t *bufp,
124123
uint16_t len);
@@ -202,20 +201,19 @@ void lps33w_multi_read_fifo(void)
202201
* @param len number of consecutive register to write
203202
*
204203
*/
205-
static int32_t platform_write(void *handle, uint8_t reg,
206-
uint8_t *bufp,
204+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
207205
uint16_t len)
208206
{
209207
#if defined(NUCLEO_F411RE)
210208
HAL_I2C_Mem_Write(handle, LPS33W_I2C_ADD_H, reg,
211-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
209+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
212210
#elif defined(STEVAL_MKI109V3)
213211
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
214212
HAL_SPI_Transmit(handle, &reg, 1, 1000);
215-
HAL_SPI_Transmit(handle, bufp, len, 1000);
213+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
216214
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
217215
#elif defined(SPC584B_DIS)
218-
i2c_lld_write(handle, LPS33W_I2C_ADD_H & 0xFE, reg, bufp, len);
216+
i2c_lld_write(handle, LPS33W_I2C_ADD_H & 0xFE, reg, (uint8_t*) bufp, len);
219217
#endif
220218
return 0;
221219
}

lps33w_STdC/examples/lps33w_read_data_polling.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ static stmdev_ctx_t dev_ctx;
117117
* and are strictly related to the hardware platform used.
118118
*
119119
*/
120-
static int32_t platform_write(void *handle, uint8_t reg,
121-
uint8_t *bufp,
120+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
122121
uint16_t len);
123122
static int32_t platform_read(void *handle, uint8_t reg, uint8_t *bufp,
124123
uint16_t len);
@@ -191,20 +190,19 @@ void lps33w_read_data_polling(void)
191190
* @param len number of consecutive register to write
192191
*
193192
*/
194-
static int32_t platform_write(void *handle, uint8_t reg,
195-
uint8_t *bufp,
193+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
196194
uint16_t len)
197195
{
198196
#if defined(NUCLEO_F411RE)
199197
HAL_I2C_Mem_Write(handle, LPS33W_I2C_ADD_H, reg,
200-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
198+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
201199
#elif defined(STEVAL_MKI109V3)
202200
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
203201
HAL_SPI_Transmit(handle, &reg, 1, 1000);
204-
HAL_SPI_Transmit(handle, bufp, len, 1000);
202+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
205203
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
206204
#elif defined(SPC584B_DIS)
207-
i2c_lld_write(handle, LPS33W_I2C_ADD_H & 0xFE, reg, bufp, len);
205+
i2c_lld_write(handle, LPS33W_I2C_ADD_H & 0xFE, reg, (uint8_t*) bufp, len);
208206
#endif
209207
return 0;
210208
}

lps33w_STdC/examples/lps33w_read_one_shot.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@ static stmdev_ctx_t dev_ctx;
118118
* and are strictly related to the hardware platform used.
119119
*
120120
*/
121-
static int32_t platform_write(void *handle, uint8_t reg,
122-
uint8_t *bufp,
121+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
123122
uint16_t len);
124123
static int32_t platform_read(void *handle, uint8_t reg, uint8_t *bufp,
125124
uint16_t len);
@@ -197,20 +196,19 @@ void lps33w_read_one_shot_(void)
197196
* @param len number of consecutive register to write
198197
*
199198
*/
200-
static int32_t platform_write(void *handle, uint8_t reg,
201-
uint8_t *bufp,
199+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
202200
uint16_t len)
203201
{
204202
#if defined(NUCLEO_F411RE)
205203
HAL_I2C_Mem_Write(handle, LPS33W_I2C_ADD_H, reg,
206-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
204+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
207205
#elif defined(STEVAL_MKI109V3)
208206
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
209207
HAL_SPI_Transmit(handle, &reg, 1, 1000);
210-
HAL_SPI_Transmit(handle, bufp, len, 1000);
208+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
211209
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
212210
#elif defined(SPC584B_DIS)
213-
i2c_lld_write(handle, LPS33W_I2C_ADD_H & 0xFE, reg, bufp, len);
211+
i2c_lld_write(handle, LPS33W_I2C_ADD_H & 0xFE, reg, (uint8_t*) bufp, len);
214212
#endif
215213
return 0;
216214
}

0 commit comments

Comments
 (0)