Skip to content

Commit 2c1c9a8

Browse files
author
albezanc
committed
lsm6ds3tr-c: added const to stmdev_write_ptr #121
1 parent 2eb7389 commit 2c1c9a8

3 files changed

Lines changed: 13 additions & 15 deletions

File tree

lsm6ds3tr-c_STdC/driver

lsm6ds3tr-c_STdC/examples/lsm6ds3tr_c_read_data_polling.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,7 @@ static uint8_t tx_buffer[TX_BUF_DIM];
121121
* and are strictly related to the hardware platform used.
122122
*
123123
*/
124-
static int32_t platform_write(void *handle, uint8_t reg,
125-
uint8_t *bufp,
124+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
126125
uint16_t len);
127126
static int32_t platform_read(void *handle, uint8_t reg, uint8_t *bufp,
128127
uint16_t len);
@@ -243,20 +242,20 @@ void lsm6ds3tr_c_read_data_polling(void)
243242
* @param len number of consecutive register to write
244243
*
245244
*/
246-
static int32_t platform_write(void *handle, uint8_t reg,
247-
uint8_t *bufp,
245+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
248246
uint16_t len)
249247
{
250248
#if defined(NUCLEO_F411RE)
251249
HAL_I2C_Mem_Write(handle, LSM6DS3TR_C_I2C_ADD_L, reg,
252-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
250+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
253251
#elif defined(STEVAL_MKI109V3)
254252
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
255253
HAL_SPI_Transmit(handle, &reg, 1, 1000);
256-
HAL_SPI_Transmit(handle, bufp, len, 1000);
254+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
257255
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
258256
#elif defined(SPC584B_DIS)
259-
i2c_lld_write(handle, LSM6DS3TR_C_I2C_ADD_L & 0xFE, reg, bufp, len);
257+
i2c_lld_write(handle, LSM6DS3TR_C_I2C_ADD_L & 0xFE, reg,
258+
(uint8_t*) bufp, len);
260259
#endif
261260
return 0;
262261
}

lsm6ds3tr-c_STdC/examples/lsm6ds3tr_c_self_test.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,7 @@
126126
* and are strictly related to the hardware platform used.
127127
*
128128
*/
129-
static int32_t platform_write(void *handle, uint8_t reg,
130-
uint8_t *bufp,
129+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
131130
uint16_t len);
132131
static int32_t platform_read(void *handle, uint8_t reg, uint8_t *bufp,
133132
uint16_t len);
@@ -373,20 +372,20 @@ void lsm6ds3tr_c_self_test(void)
373372
* @param len number of consecutive register to write
374373
*
375374
*/
376-
static int32_t platform_write(void *handle, uint8_t reg,
377-
uint8_t *bufp,
375+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
378376
uint16_t len)
379377
{
380378
#if defined(NUCLEO_F411RE)
381379
HAL_I2C_Mem_Write(handle, LSM6DS3TR_C_I2C_ADD_L, reg,
382-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
380+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
383381
#elif defined(STEVAL_MKI109V3)
384382
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
385383
HAL_SPI_Transmit(handle, &reg, 1, 1000);
386-
HAL_SPI_Transmit(handle, bufp, len, 1000);
384+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
387385
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
388386
#elif defined(SPC584B_DIS)
389-
i2c_lld_write(handle, LSM6DS3TR_C_I2C_ADD_L & 0xFE, reg, bufp, len);
387+
i2c_lld_write(handle, LSM6DS3TR_C_I2C_ADD_L & 0xFE, reg,
388+
(uint8_t*) bufp, len);
390389
#endif
391390
return 0;
392391
}

0 commit comments

Comments
 (0)