Skip to content

Commit 5d6b2fd

Browse files
author
albezanc
committed
lsm6dsox: added const to stmdev_write_ptr #121
1 parent ac0efdb commit 5d6b2fd

23 files changed

Lines changed: 121 additions & 174 deletions

lsm6dsox_STdC/driver

lsm6dsox_STdC/examples/lsm6dsox_activity.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,7 @@
112112
* and are strictly related to the hardware platform used.
113113
*
114114
*/
115-
static int32_t platform_write(void *handle, uint8_t reg,
116-
uint8_t *bufp,
115+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
117116
uint16_t len);
118117
static int32_t platform_read(void *handle, uint8_t reg, uint8_t *bufp,
119118
uint16_t len);
@@ -198,20 +197,19 @@ void lsm6dsox_activity(void)
198197
* @param len number of consecutive register to write
199198
*
200199
*/
201-
static int32_t platform_write(void *handle, uint8_t reg,
202-
uint8_t *bufp,
200+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
203201
uint16_t len)
204202
{
205203
#if defined(NUCLEO_F411RE)
206204
HAL_I2C_Mem_Write(handle, LSM6DSOX_I2C_ADD_L, reg,
207-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
205+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
208206
#elif defined(STEVAL_MKI109V3)
209207
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
210208
HAL_SPI_Transmit(handle, &reg, 1, 1000);
211-
HAL_SPI_Transmit(handle, bufp, len, 1000);
209+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
212210
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
213211
#elif defined(SPC584B_DIS)
214-
i2c_lld_write(handle, LSM6DSOX_I2C_ADD_L & 0xFE, reg, bufp, len);
212+
i2c_lld_write(handle, LSM6DSOX_I2C_ADD_L & 0xFE, reg, (uint8_t*) bufp, len);
215213
#endif
216214
return 0;
217215
}

lsm6dsox_STdC/examples/lsm6dsox_fifo.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,7 @@ static uint8_t tx_buffer[1000];
123123
* and are strictly related to the hardware platform used.
124124
*
125125
*/
126-
static int32_t platform_write(void *handle, uint8_t reg,
127-
uint8_t *bufp,
126+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
128127
uint16_t len);
129128
static int32_t platform_read(void *handle, uint8_t reg, uint8_t *bufp,
130129
uint16_t len);
@@ -261,20 +260,19 @@ void lsm6dsox_fifo(void)
261260
* @param len number of consecutive register to write
262261
*
263262
*/
264-
static int32_t platform_write(void *handle, uint8_t reg,
265-
uint8_t *bufp,
263+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
266264
uint16_t len)
267265
{
268266
#if defined(NUCLEO_F411RE)
269267
HAL_I2C_Mem_Write(handle, LSM6DSOX_I2C_ADD_L, reg,
270-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
268+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
271269
#elif defined(STEVAL_MKI109V3)
272270
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
273271
HAL_SPI_Transmit(handle, &reg, 1, 1000);
274-
HAL_SPI_Transmit(handle, bufp, len, 1000);
272+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
275273
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
276274
#elif defined(SPC584B_DIS)
277-
i2c_lld_write(handle, LSM6DSOX_I2C_ADD_L & 0xFE, reg, bufp, len);
275+
i2c_lld_write(handle, LSM6DSOX_I2C_ADD_L & 0xFE, reg, (uint8_t*) bufp, len);
278276
#endif
279277
return 0;
280278
}

lsm6dsox_STdC/examples/lsm6dsox_fifo_compressed.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,7 @@ static st_fifo_out_slot gyr_slot[SLOT_NUMBER];
128128
* and are strictly related to the hardware platform used.
129129
*
130130
*/
131-
static int32_t platform_write(void *handle, uint8_t reg,
132-
uint8_t *bufp,
131+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
133132
uint16_t len);
134133
static int32_t platform_read(void *handle, uint8_t reg, uint8_t *bufp,
135134
uint16_t len);
@@ -295,20 +294,19 @@ void lsm6dsox_compressed_fifo(void)
295294
* @param len number of consecutive register to write
296295
*
297296
*/
298-
static int32_t platform_write(void *handle, uint8_t reg,
299-
uint8_t *bufp,
297+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
300298
uint16_t len)
301299
{
302300
#if defined(NUCLEO_F411RE)
303301
HAL_I2C_Mem_Write(handle, LSM6DSOX_I2C_ADD_L, reg,
304-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
302+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
305303
#elif defined(STEVAL_MKI109V3)
306304
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
307305
HAL_SPI_Transmit(handle, &reg, 1, 1000);
308-
HAL_SPI_Transmit(handle, bufp, len, 1000);
306+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
309307
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
310308
#elif defined(SPC584B_DIS)
311-
i2c_lld_write(handle, LSM6DSOX_I2C_ADD_L & 0xFE, reg, bufp, len);
309+
i2c_lld_write(handle, LSM6DSOX_I2C_ADD_L & 0xFE, reg, (uint8_t*) bufp, len);
312310
#endif
313311
return 0;
314312
}

lsm6dsox_STdC/examples/lsm6dsox_fifo_step.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,7 @@ static uint8_t tx_buffer[1000];
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);
@@ -242,20 +241,19 @@ void lsm6dsox_fifo_step(void)
242241
* @param len number of consecutive register to write
243242
*
244243
*/
245-
static int32_t platform_write(void *handle, uint8_t reg,
246-
uint8_t *bufp,
244+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
247245
uint16_t len)
248246
{
249247
#if defined(NUCLEO_F411RE)
250248
HAL_I2C_Mem_Write(handle, LSM6DSOX_I2C_ADD_L, reg,
251-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
249+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
252250
#elif defined(STEVAL_MKI109V3)
253251
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
254252
HAL_SPI_Transmit(handle, &reg, 1, 1000);
255-
HAL_SPI_Transmit(handle, bufp, len, 1000);
253+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
256254
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
257255
#elif defined(SPC584B_DIS)
258-
i2c_lld_write(handle, LSM6DSOX_I2C_ADD_L & 0xFE, reg, bufp, len);
256+
i2c_lld_write(handle, LSM6DSOX_I2C_ADD_L & 0xFE, reg, (uint8_t*) bufp, len);
259257
#endif
260258
return 0;
261259
}

lsm6dsox_STdC/examples/lsm6dsox_free_fall.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,7 @@ static uint8_t tx_buffer[1000];
116116
* and are strictly related to the hardware platform used.
117117
*
118118
*/
119-
static int32_t platform_write(void *handle, uint8_t reg,
120-
uint8_t *bufp,
119+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
121120
uint16_t len);
122121
static int32_t platform_read(void *handle, uint8_t reg, uint8_t *bufp,
123122
uint16_t len);
@@ -199,20 +198,19 @@ void lsm6dsox_free_fall(void)
199198
* @param len number of consecutive register to write
200199
*
201200
*/
202-
static int32_t platform_write(void *handle, uint8_t reg,
203-
uint8_t *bufp,
201+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
204202
uint16_t len)
205203
{
206204
#if defined(NUCLEO_F411RE)
207205
HAL_I2C_Mem_Write(handle, LSM6DSOX_I2C_ADD_L, reg,
208-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
206+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
209207
#elif defined(STEVAL_MKI109V3)
210208
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
211209
HAL_SPI_Transmit(handle, &reg, 1, 1000);
212-
HAL_SPI_Transmit(handle, bufp, len, 1000);
210+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
213211
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
214212
#elif defined(SPC584B_DIS)
215-
i2c_lld_write(handle, LSM6DSOX_I2C_ADD_L & 0xFE, reg, bufp, len);
213+
i2c_lld_write(handle, LSM6DSOX_I2C_ADD_L & 0xFE, reg, (uint8_t*) bufp, len);
216214
#endif
217215
return 0;
218216
}

lsm6dsox_STdC/examples/lsm6dsox_fsm_glance.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,7 @@ static uint8_t tx_buffer[1000];
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);
@@ -206,20 +205,19 @@ void lsm6dsox_fsm_glance(void)
206205
* @param len number of consecutive register to write
207206
*
208207
*/
209-
static int32_t platform_write(void *handle, uint8_t reg,
210-
uint8_t *bufp,
208+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
211209
uint16_t len)
212210
{
213211
#if defined(NUCLEO_F411RE)
214212
HAL_I2C_Mem_Write(handle, LSM6DSOX_I2C_ADD_L, reg,
215-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
213+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
216214
#elif defined(STEVAL_MKI109V3)
217215
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
218216
HAL_SPI_Transmit(handle, &reg, 1, 1000);
219-
HAL_SPI_Transmit(handle, bufp, len, 1000);
217+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
220218
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
221219
#elif defined(SPC584B_DIS)
222-
i2c_lld_write(handle, LSM6DSOX_I2C_ADD_L & 0xFE, reg, bufp, len);
220+
i2c_lld_write(handle, LSM6DSOX_I2C_ADD_L & 0xFE, reg, (uint8_t*) bufp, len);
223221
#endif
224222
return 0;
225223
}

lsm6dsox_STdC/examples/lsm6dsox_fsm_raw.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,7 @@ static uint8_t tx_buffer[1000];
191191
* and are strictly related to the hardware platform used.
192192
*
193193
*/
194-
static int32_t platform_write(void *handle, uint8_t reg,
195-
uint8_t *bufp,
194+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
196195
uint16_t len);
197196
static int32_t platform_read(void *handle, uint8_t reg, uint8_t *bufp,
198197
uint16_t len);
@@ -382,20 +381,19 @@ void lsm6dsox_fsm_raw(void)
382381
* @param len number of consecutive register to write
383382
*
384383
*/
385-
static int32_t platform_write(void *handle, uint8_t reg,
386-
uint8_t *bufp,
384+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
387385
uint16_t len)
388386
{
389387
#if defined(NUCLEO_F411RE)
390388
HAL_I2C_Mem_Write(handle, LSM6DSOX_I2C_ADD_L, reg,
391-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
389+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
392390
#elif defined(STEVAL_MKI109V3)
393391
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
394392
HAL_SPI_Transmit(handle, &reg, 1, 1000);
395-
HAL_SPI_Transmit(handle, bufp, len, 1000);
393+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
396394
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
397395
#elif defined(SPC584B_DIS)
398-
i2c_lld_write(handle, LSM6DSOX_I2C_ADD_L & 0xFE, reg, bufp, len);
396+
i2c_lld_write(handle, LSM6DSOX_I2C_ADD_L & 0xFE, reg, (uint8_t*) bufp, len);
399397
#endif
400398
return 0;
401399
}

lsm6dsox_STdC/examples/lsm6dsox_mlc.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,7 @@ static uint8_t tx_buffer[1000];
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);
@@ -234,20 +233,19 @@ void lsm6dsox_mlc(void)
234233
* @param len number of consecutive register to write
235234
*
236235
*/
237-
static int32_t platform_write(void *handle, uint8_t reg,
238-
uint8_t *bufp,
236+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
239237
uint16_t len)
240238
{
241239
#if defined(NUCLEO_F411RE)
242240
HAL_I2C_Mem_Write(handle, LSM6DSOX_I2C_ADD_L, reg,
243-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
241+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
244242
#elif defined(STEVAL_MKI109V3)
245243
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
246244
HAL_SPI_Transmit(handle, &reg, 1, 1000);
247-
HAL_SPI_Transmit(handle, bufp, len, 1000);
245+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
248246
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
249247
#elif defined(SPC584B_DIS)
250-
i2c_lld_write(handle, LSM6DSOX_I2C_ADD_L & 0xFE, reg, bufp, len);
248+
i2c_lld_write(handle, LSM6DSOX_I2C_ADD_L & 0xFE, reg, (uint8_t*) bufp, len);
251249
#endif
252250
return 0;
253251
}

lsm6dsox_STdC/examples/lsm6dsox_multi_conf.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,7 @@ static uint8_t tx_buffer[1000];
127127
* and are strictly related to the hardware platform used.
128128
*
129129
*/
130-
static int32_t platform_write(void *handle, uint8_t reg,
131-
uint8_t *bufp,
130+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
132131
uint16_t len);
133132
static int32_t platform_read(void *handle, uint8_t reg, uint8_t *bufp,
134133
uint16_t len);
@@ -411,20 +410,19 @@ void lsm6dsox_multi_conf(void)
411410
* @param len number of consecutive register to write
412411
*
413412
*/
414-
static int32_t platform_write(void *handle, uint8_t reg,
415-
uint8_t *bufp,
413+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
416414
uint16_t len)
417415
{
418416
#if defined(NUCLEO_F411RE)
419417
HAL_I2C_Mem_Write(handle, LSM6DSOX_I2C_ADD_L, reg,
420-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
418+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
421419
#elif defined(STEVAL_MKI109V3)
422420
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
423421
HAL_SPI_Transmit(handle, &reg, 1, 1000);
424-
HAL_SPI_Transmit(handle, bufp, len, 1000);
422+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
425423
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
426424
#elif defined(SPC584B_DIS)
427-
i2c_lld_write(handle, LSM6DSOX_I2C_ADD_L & 0xFE, reg, bufp, len);
425+
i2c_lld_write(handle, LSM6DSOX_I2C_ADD_L & 0xFE, reg, (uint8_t*) bufp, len);
428426
#endif
429427
return 0;
430428
}

0 commit comments

Comments
 (0)