Skip to content

Commit 03df670

Browse files
author
albezanc
committed
lsm6dsl: added const to stmdev_write_ptr #121
1 parent eb5935a commit 03df670

3 files changed

Lines changed: 11 additions & 15 deletions

File tree

lsm6dsl_STdC/driver

lsm6dsl_STdC/examples/lsm6dsl_read_data_polling.c

Lines changed: 5 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);
@@ -239,20 +238,19 @@ void lsm6dsl_read_data_polling(void)
239238
* @param len number of consecutive register to write
240239
*
241240
*/
242-
static int32_t platform_write(void *handle, uint8_t reg,
243-
uint8_t *bufp,
241+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
244242
uint16_t len)
245243
{
246244
#if defined(NUCLEO_F411RE)
247245
HAL_I2C_Mem_Write(handle, LSM6DSL_I2C_ADD_H, reg,
248-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
246+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
249247
#elif defined(STEVAL_MKI109V3)
250248
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
251249
HAL_SPI_Transmit(handle, &reg, 1, 1000);
252-
HAL_SPI_Transmit(handle, bufp, len, 1000);
250+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
253251
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
254252
#elif defined(SPC584B_DIS)
255-
i2c_lld_write(handle, LSM6DSL_I2C_ADD_H & 0xFE, reg, bufp, len);
253+
i2c_lld_write(handle, LSM6DSL_I2C_ADD_H & 0xFE, reg, (uint8_t*) bufp, len);
256254
#endif
257255
return 0;
258256
}

lsm6dsl_STdC/examples/lsm6dsl_self_test.c

Lines changed: 5 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);
@@ -371,20 +370,19 @@ void lsm6dsl_self_test(void)
371370
* @param len number of consecutive register to write
372371
*
373372
*/
374-
static int32_t platform_write(void *handle, uint8_t reg,
375-
uint8_t *bufp,
373+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
376374
uint16_t len)
377375
{
378376
#if defined(NUCLEO_F411RE)
379377
HAL_I2C_Mem_Write(handle, LSM6DSL_I2C_ADD_H, reg,
380-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
378+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
381379
#elif defined(STEVAL_MKI109V3)
382380
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
383381
HAL_SPI_Transmit(handle, &reg, 1, 1000);
384-
HAL_SPI_Transmit(handle, bufp, len, 1000);
382+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
385383
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
386384
#elif defined(SPC584B_DIS)
387-
i2c_lld_write(handle, LSM6DSL_I2C_ADD_H & 0xFE, reg, bufp, len);
385+
i2c_lld_write(handle, LSM6DSL_I2C_ADD_H & 0xFE, reg, (uint8_t*) bufp, len);
388386
#endif
389387
return 0;
390388
}

0 commit comments

Comments
 (0)