Skip to content

Commit 662387d

Browse files
author
albezanc
committed
lsm6dso32x: added const to stmdev_write_ptr #121
1 parent 1519c43 commit 662387d

17 files changed

Lines changed: 97 additions & 113 deletions

lsm6dso32x_STdC/driver

lsm6dso32x_STdC/examples/lsm6dso32x_activity.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,7 @@ static uint8_t tx_buffer[1000];
119119
* and are strictly related to the hardware platform used.
120120
*
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);
@@ -203,20 +202,20 @@ void lsm6dso32x_activity(void)
203202
* @param len number of consecutive register to write
204203
*
205204
*/
206-
static int32_t platform_write(void *handle, uint8_t reg,
207-
uint8_t *bufp,
205+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
208206
uint16_t len)
209207
{
210208
#if defined(NUCLEO_F411RE)
211209
HAL_I2C_Mem_Write(handle, LSM6DSO32X_I2C_ADD_L, reg,
212-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
210+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
213211
#elif defined(STEVAL_MKI109V3)
214212
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
215213
HAL_SPI_Transmit(handle, &reg, 1, 1000);
216-
HAL_SPI_Transmit(handle, bufp, len, 1000);
214+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
217215
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
218216
#elif defined(SPC584B_DIS)
219-
i2c_lld_write(handle, LSM6DSO32X_I2C_ADD_L & 0xFE, reg, bufp, len);
217+
i2c_lld_write(handle, LSM6DSO32X_I2C_ADD_L & 0xFE, reg,
218+
(uint8_t*) bufp, len);
220219
#endif
221220
return 0;
222221
}

lsm6dso32x_STdC/examples/lsm6dso32x_compressed_fifo.c

Lines changed: 6 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);
@@ -297,20 +296,20 @@ void lsm6dso32x_compressed_fifo(void)
297296
* @param len number of consecutive register to write
298297
*
299298
*/
300-
static int32_t platform_write(void *handle, uint8_t reg,
301-
uint8_t *bufp,
299+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
302300
uint16_t len)
303301
{
304302
#if defined(NUCLEO_F411RE)
305303
HAL_I2C_Mem_Write(handle, LSM6DSO32X_I2C_ADD_L, reg,
306-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
304+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
307305
#elif defined(STEVAL_MKI109V3)
308306
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
309307
HAL_SPI_Transmit(handle, &reg, 1, 1000);
310-
HAL_SPI_Transmit(handle, bufp, len, 1000);
308+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
311309
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
312310
#elif defined(SPC584B_DIS)
313-
i2c_lld_write(handle, LSM6DSO32X_I2C_ADD_L & 0xFE, reg, bufp, len);
311+
i2c_lld_write(handle, LSM6DSO32X_I2C_ADD_L & 0xFE, reg,
312+
(uint8_t*) bufp, len);
314313
#endif
315314
return 0;
316315
}

lsm6dso32x_STdC/examples/lsm6dso32x_fifo.c

Lines changed: 6 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);
@@ -263,20 +262,20 @@ void lsm6dso32x_fifo(void)
263262
* @param len number of consecutive register to write
264263
*
265264
*/
266-
static int32_t platform_write(void *handle, uint8_t reg,
267-
uint8_t *bufp,
265+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
268266
uint16_t len)
269267
{
270268
#if defined(NUCLEO_F411RE)
271269
HAL_I2C_Mem_Write(handle, LSM6DSO32X_I2C_ADD_L, reg,
272-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
270+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
273271
#elif defined(STEVAL_MKI109V3)
274272
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
275273
HAL_SPI_Transmit(handle, &reg, 1, 1000);
276-
HAL_SPI_Transmit(handle, bufp, len, 1000);
274+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
277275
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
278276
#elif defined(SPC584B_DIS)
279-
i2c_lld_write(handle, LSM6DSO32X_I2C_ADD_L & 0xFE, reg, bufp, len);
277+
i2c_lld_write(handle, LSM6DSO32X_I2C_ADD_L & 0xFE, reg,
278+
(uint8_t*) bufp, len);
280279
#endif
281280
return 0;
282281
}

lsm6dso32x_STdC/examples/lsm6dso32x_fifo_pedo.c

Lines changed: 6 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,20 @@ void lsm6dso32x_fifo_pedo(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, LSM6DSO32X_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, LSM6DSO32X_I2C_ADD_L & 0xFE, reg, bufp, len);
256+
i2c_lld_write(handle, LSM6DSO32X_I2C_ADD_L & 0xFE, reg,
257+
(uint8_t*) bufp, len);
259258
#endif
260259
return 0;
261260
}

lsm6dso32x_STdC/examples/lsm6dso32x_free_fall.c

Lines changed: 6 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,20 @@ void lsm6dso32x_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, LSM6DSO32X_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, LSM6DSO32X_I2C_ADD_L & 0xFE, reg, bufp, len);
213+
i2c_lld_write(handle, LSM6DSO32X_I2C_ADD_L & 0xFE, reg,
214+
(uint8_t*) bufp, len);
216215
#endif
217216
return 0;
218217
}

lsm6dso32x_STdC/examples/lsm6dso32x_fsm.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,7 @@ static uint8_t tx_buffer[1000];
184184
* and are strictly related to the hardware platform used.
185185
*
186186
*/
187-
static int32_t platform_write(void *handle, uint8_t reg,
188-
uint8_t *bufp,
187+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
189188
uint16_t len);
190189
static int32_t platform_read(void *handle, uint8_t reg, uint8_t *bufp,
191190
uint16_t len);
@@ -379,20 +378,20 @@ void lsm6dso32x_fsm(void)
379378
* @param len number of consecutive register to write
380379
*
381380
*/
382-
static int32_t platform_write(void *handle, uint8_t reg,
383-
uint8_t *bufp,
381+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
384382
uint16_t len)
385383
{
386384
#if defined(NUCLEO_F411RE)
387385
HAL_I2C_Mem_Write(handle, LSM6DSO32X_I2C_ADD_L, reg,
388-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
386+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
389387
#elif defined(STEVAL_MKI109V3)
390388
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
391389
HAL_SPI_Transmit(handle, &reg, 1, 1000);
392-
HAL_SPI_Transmit(handle, bufp, len, 1000);
390+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
393391
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
394392
#elif defined(SPC584B_DIS)
395-
i2c_lld_write(handle, LSM6DSO32X_I2C_ADD_L & 0xFE, reg, bufp, len);
393+
i2c_lld_write(handle, LSM6DSO32X_I2C_ADD_L & 0xFE, reg,
394+
(uint8_t*) bufp, len);
396395
#endif
397396
return 0;
398397
}

lsm6dso32x_STdC/examples/lsm6dso32x_offset.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ static uint8_t tx_buffer[1000];
120120
* and are strictly related to the hardware platform used.
121121
*
122122
*/
123-
static int32_t platform_write(void *handle, uint8_t reg,
124-
uint8_t *bufp,
123+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
125124
uint16_t len);
126125
static int32_t platform_read(void *handle, uint8_t reg, uint8_t *bufp,
127126
uint16_t len);
@@ -246,20 +245,20 @@ void lsm6dso32x_offset(void)
246245
* @param len number of consecutive register to write
247246
*
248247
*/
249-
static int32_t platform_write(void *handle, uint8_t reg,
250-
uint8_t *bufp,
248+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
251249
uint16_t len)
252250
{
253251
#if defined(NUCLEO_F411RE)
254252
HAL_I2C_Mem_Write(handle, LSM6DSO32X_I2C_ADD_L, reg,
255-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
253+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
256254
#elif defined(STEVAL_MKI109V3)
257255
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
258256
HAL_SPI_Transmit(handle, &reg, 1, 1000);
259-
HAL_SPI_Transmit(handle, bufp, len, 1000);
257+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
260258
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
261259
#elif defined(SPC584B_DIS)
262-
i2c_lld_write(handle, LSM6DSO32X_I2C_ADD_L & 0xFE, reg, bufp, len);
260+
i2c_lld_write(handle, LSM6DSO32X_I2C_ADD_L & 0xFE, reg,
261+
(uint8_t*) bufp, len);
263262
#endif
264263
return 0;
265264
}

lsm6dso32x_STdC/examples/lsm6dso32x_orientation.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,7 @@ static uint8_t tx_buffer[1000];
115115
* and are strictly related to the hardware platform used.
116116
*
117117
*/
118-
static int32_t platform_write(void *handle, uint8_t reg,
119-
uint8_t *bufp,
118+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
120119
uint16_t len);
121120
static int32_t platform_read(void *handle, uint8_t reg, uint8_t *bufp,
122121
uint16_t len);
@@ -227,20 +226,20 @@ void lsm6dso32x_orientation(void)
227226
* @param len number of consecutive register to write
228227
*
229228
*/
230-
static int32_t platform_write(void *handle, uint8_t reg,
231-
uint8_t *bufp,
229+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
232230
uint16_t len)
233231
{
234232
#if defined(NUCLEO_F411RE)
235233
HAL_I2C_Mem_Write(handle, LSM6DSO32X_I2C_ADD_L, reg,
236-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
234+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
237235
#elif defined(STEVAL_MKI109V3)
238236
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
239237
HAL_SPI_Transmit(handle, &reg, 1, 1000);
240-
HAL_SPI_Transmit(handle, bufp, len, 1000);
238+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
241239
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
242240
#elif defined(SPC584B_DIS)
243-
i2c_lld_write(handle, LSM6DSO32X_I2C_ADD_L & 0xFE, reg, bufp, len);
241+
i2c_lld_write(handle, LSM6DSO32X_I2C_ADD_L & 0xFE, reg,
242+
(uint8_t*) bufp, len);
244243
#endif
245244
return 0;
246245
}

lsm6dso32x_STdC/examples/lsm6dso32x_pedometer.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,7 @@ static uint8_t tx_buffer[1000];
114114
* and are strictly related to the hardware platform used.
115115
*
116116
*/
117-
static int32_t platform_write(void *handle, uint8_t reg,
118-
uint8_t *bufp,
117+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
119118
uint16_t len);
120119
static int32_t platform_read(void *handle, uint8_t reg, uint8_t *bufp,
121120
uint16_t len);
@@ -206,20 +205,20 @@ void lsm6dso32x_pedometer(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, LSM6DSO32X_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, LSM6DSO32X_I2C_ADD_L & 0xFE, reg, bufp, len);
220+
i2c_lld_write(handle, LSM6DSO32X_I2C_ADD_L & 0xFE, reg,
221+
(uint8_t*) bufp, len);
223222
#endif
224223
return 0;
225224
}

0 commit comments

Comments
 (0)