Skip to content

Commit ac0efdb

Browse files
author
albezanc
committed
lsm6dso32: added const to stmdev_write_ptr #121
1 parent 662387d commit ac0efdb

4 files changed

Lines changed: 16 additions & 22 deletions

File tree

lsm6dso32_STdC/driver

lsm6dso32_STdC/examples/lsm6dso32_multi_read_fifo.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,7 @@ static uint8_t tx_buffer[1000];
119119
* Functions declare in this section are defined at the end of this file
120120
* and are strictly related to the hardware platform used.
121121
*/
122-
static int32_t platform_write(void *handle, uint8_t reg,
123-
uint8_t *bufp,
122+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
124123
uint16_t len);
125124
static int32_t platform_read(void *handle, uint8_t reg, uint8_t *bufp,
126125
uint16_t len);
@@ -243,20 +242,19 @@ void lsm6dso32_multi_read_fifo(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, LSM6DSO32_I2C_ADD_H, 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, LSM6DSO32_I2C_ADD_H & 0xFE, reg, bufp, len);
257+
i2c_lld_write(handle, LSM6DSO32_I2C_ADD_H & 0xFE, reg, (uint8_t*) bufp, len);
260258
#endif
261259
return 0;
262260
}

lsm6dso32_STdC/examples/lsm6dso32_read_data_polling.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,7 @@ static uint8_t tx_buffer[1000];
111111
* Functions declare in this section are defined at the end of this file
112112
* and are strictly related to the hardware platform used.
113113
*/
114-
static int32_t platform_write(void *handle, uint8_t reg,
115-
uint8_t *bufp,
114+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
116115
uint16_t len);
117116
static int32_t platform_read(void *handle, uint8_t reg, uint8_t *bufp,
118117
uint16_t len);
@@ -218,20 +217,19 @@ void lsm6dso32_read_data_polling(void)
218217
* @param len number of consecutive register to write
219218
*
220219
*/
221-
static int32_t platform_write(void *handle, uint8_t reg,
222-
uint8_t *bufp,
220+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
223221
uint16_t len)
224222
{
225223
#if defined(NUCLEO_F411RE)
226224
HAL_I2C_Mem_Write(handle, LSM6DSO32_I2C_ADD_H, reg,
227-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
225+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
228226
#elif defined(STEVAL_MKI109V3)
229227
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
230228
HAL_SPI_Transmit(handle, &reg, 1, 1000);
231-
HAL_SPI_Transmit(handle, bufp, len, 1000);
229+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
232230
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
233231
#elif defined(SPC584B_DIS)
234-
i2c_lld_write(handle, LSM6DSO32_I2C_ADD_H & 0xFE, reg, bufp, len);
232+
i2c_lld_write(handle, LSM6DSO32_I2C_ADD_H & 0xFE, reg, (uint8_t*) bufp, len);
235233
#endif
236234
return 0;
237235
}

lsm6dso32_STdC/examples/lsm6dso32_self_test.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,7 @@
113113
* Functions declare in this section are defined at the end of this file
114114
* and are strictly related to the hardware platform used.
115115
*/
116-
static int32_t platform_write(void *handle, uint8_t reg,
117-
uint8_t *bufp,
116+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
118117
uint16_t len);
119118
static int32_t platform_read(void *handle, uint8_t reg, uint8_t *bufp,
120119
uint16_t len);
@@ -361,20 +360,19 @@ void lsm6dso32_self_test(void)
361360
* @param len number of consecutive register to write
362361
*
363362
*/
364-
static int32_t platform_write(void *handle, uint8_t reg,
365-
uint8_t *bufp,
363+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
366364
uint16_t len)
367365
{
368366
#if defined(NUCLEO_F411RE)
369367
HAL_I2C_Mem_Write(handle, LSM6DSO32_I2C_ADD_H, reg,
370-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
368+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
371369
#elif defined(STEVAL_MKI109V3)
372370
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
373371
HAL_SPI_Transmit(handle, &reg, 1, 1000);
374-
HAL_SPI_Transmit(handle, bufp, len, 1000);
372+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
375373
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
376374
#elif defined(SPC584B_DIS)
377-
i2c_lld_write(handle, LSM6DSO32_I2C_ADD_H & 0xFE, reg, bufp, len);
375+
i2c_lld_write(handle, LSM6DSO32_I2C_ADD_H & 0xFE, reg, (uint8_t*) bufp, len);
378376
#endif
379377
return 0;
380378
}

0 commit comments

Comments
 (0)