Skip to content

Commit fe522dc

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

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

lps33hw_STdC/driver

lps33hw_STdC/examples/lps33hw_read_data_polling.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ static uint8_t tx_buffer[TX_BUF_DIM];
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 lps33hw_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, LPS33HW_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, LPS33HW_I2C_ADD_H & 0xFE, reg, bufp, len);
205+
i2c_lld_write(handle, LPS33HW_I2C_ADD_H & 0xFE, reg, (uint8_t*) bufp, len);
208206
#endif
209207
return 0;
210208
}

0 commit comments

Comments
 (0)