Skip to content

Commit 0b7dfb3

Browse files
author
albezanc
committed
lsm6dso: added const to stmdev_write_ptr #121
1 parent 5d6b2fd commit 0b7dfb3

18 files changed

Lines changed: 93 additions & 134 deletions

lsm6dso_STdC/driver

lsm6dso_STdC/examples/lsm6dso_activity.c

Lines changed: 5 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);
@@ -199,20 +198,19 @@ void lsm6dso_activity(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, LSM6DSO_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, LSM6DSO_I2C_ADD_H & 0xFE, reg, bufp, len);
213+
i2c_lld_write(handle, LSM6DSO_I2C_ADD_H & 0xFE, reg, (uint8_t*) bufp, len);
216214
#endif
217215
return 0;
218216
}

lsm6dso_STdC/examples/lsm6dso_compressed_fifo.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);
@@ -294,20 +293,19 @@ void example_compressed_fifo_simple_lsm6dso(void)
294293
* @param len number of consecutive register to write
295294
*
296295
*/
297-
static int32_t platform_write(void *handle, uint8_t reg,
298-
uint8_t *bufp,
296+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
299297
uint16_t len)
300298
{
301299
#if defined(NUCLEO_F411RE)
302300
HAL_I2C_Mem_Write(handle, LSM6DSO_I2C_ADD_L, reg,
303-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
301+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
304302
#elif defined(STEVAL_MKI109V3)
305303
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
306304
HAL_SPI_Transmit(handle, &reg, 1, 1000);
307-
HAL_SPI_Transmit(handle, bufp, len, 1000);
305+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
308306
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
309307
#elif defined(SPC584B_DIS)
310-
i2c_lld_write(handle, LSM6DSO_I2C_ADD_H & 0xFE, reg, bufp, len);
308+
i2c_lld_write(handle, LSM6DSO_I2C_ADD_H & 0xFE, reg, (uint8_t*) bufp, len);
311309
#endif
312310
return 0;
313311
}

lsm6dso_STdC/examples/lsm6dso_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);
@@ -260,20 +259,19 @@ void lsm6dso_fifo(void)
260259
* @param len number of consecutive register to write
261260
*
262261
*/
263-
static int32_t platform_write(void *handle, uint8_t reg,
264-
uint8_t *bufp,
262+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
265263
uint16_t len)
266264
{
267265
#if defined(NUCLEO_F411RE)
268266
HAL_I2C_Mem_Write(handle, LSM6DSO_I2C_ADD_L, reg,
269-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
267+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
270268
#elif defined(STEVAL_MKI109V3)
271269
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
272270
HAL_SPI_Transmit(handle, &reg, 1, 1000);
273-
HAL_SPI_Transmit(handle, bufp, len, 1000);
271+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
274272
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
275273
#elif defined(SPC584B_DIS)
276-
i2c_lld_write(handle, LSM6DSO_I2C_ADD_H & 0xFE, reg, bufp, len);
274+
i2c_lld_write(handle, LSM6DSO_I2C_ADD_H & 0xFE, reg, (uint8_t*) bufp, len);
277275
#endif
278276
return 0;
279277
}

lsm6dso_STdC/examples/lsm6dso_fifo_pedo.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 lsm6dso_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, LSM6DSO_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, LSM6DSO_I2C_ADD_H & 0xFE, reg, bufp, len);
256+
i2c_lld_write(handle, LSM6DSO_I2C_ADD_H & 0xFE, reg, (uint8_t*) bufp, len);
259257
#endif
260258
return 0;
261259
}

lsm6dso_STdC/examples/lsm6dso_free_fall.c

Lines changed: 5 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);
@@ -197,20 +196,19 @@ void lsm6dso_free_fall(void)
197196
* @param len number of consecutive register to write
198197
*
199198
*/
200-
static int32_t platform_write(void *handle, uint8_t reg,
201-
uint8_t *bufp,
199+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
202200
uint16_t len)
203201
{
204202
#if defined(NUCLEO_F411RE)
205203
HAL_I2C_Mem_Write(handle, LSM6DSO_I2C_ADD_L, reg,
206-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
204+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
207205
#elif defined(STEVAL_MKI109V3)
208206
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
209207
HAL_SPI_Transmit(handle, &reg, 1, 1000);
210-
HAL_SPI_Transmit(handle, bufp, len, 1000);
208+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
211209
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
212210
#elif defined(SPC584B_DIS)
213-
i2c_lld_write(handle, LSM6DSO_I2C_ADD_H & 0xFE, reg, bufp, len);
211+
i2c_lld_write(handle, LSM6DSO_I2C_ADD_H & 0xFE, reg, (uint8_t*) bufp, len);
214212
#endif
215213
return 0;
216214
}

lsm6dso_STdC/examples/lsm6dso_fsm.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,7 @@ static uint8_t tx_buffer[1000];
178178
* and are strictly related to the hardware platform used.
179179
*
180180
*/
181-
static int32_t platform_write(void *handle, uint8_t reg,
182-
uint8_t *bufp,
181+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
183182
uint16_t len);
184183
static int32_t platform_read(void *handle, uint8_t reg, uint8_t *bufp,
185184
uint16_t len);
@@ -365,20 +364,19 @@ void lsm6dso_fsm(void)
365364
* @param len number of consecutive register to write
366365
*
367366
*/
368-
static int32_t platform_write(void *handle, uint8_t reg,
369-
uint8_t *bufp,
367+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
370368
uint16_t len)
371369
{
372370
#if defined(NUCLEO_F411RE)
373371
HAL_I2C_Mem_Write(handle, LSM6DSO_I2C_ADD_L, reg,
374-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
372+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
375373
#elif defined(STEVAL_MKI109V3)
376374
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
377375
HAL_SPI_Transmit(handle, &reg, 1, 1000);
378-
HAL_SPI_Transmit(handle, bufp, len, 1000);
376+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
379377
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
380378
#elif defined(SPC584B_DIS)
381-
i2c_lld_write(handle, LSM6DSO_I2C_ADD_H & 0xFE, reg, bufp, len);
379+
i2c_lld_write(handle, LSM6DSO_I2C_ADD_H & 0xFE, reg, (uint8_t*) bufp, len);
382380
#endif
383381
return 0;
384382
}

lsm6dso_STdC/examples/lsm6dso_offset.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,7 @@ static uint8_t tx_buffer[1000];
122122
* and are strictly related to the hardware platform used.
123123
*
124124
*/
125-
static int32_t platform_write(void *handle, uint8_t reg,
126-
uint8_t *bufp,
125+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
127126
uint16_t len);
128127
static int32_t platform_read(void *handle, uint8_t reg, uint8_t *bufp,
129128
uint16_t len);
@@ -247,20 +246,19 @@ void lsm6dso_offset(void)
247246
* @param len number of consecutive register to write
248247
*
249248
*/
250-
static int32_t platform_write(void *handle, uint8_t reg,
251-
uint8_t *bufp,
249+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
252250
uint16_t len)
253251
{
254252
#if defined(NUCLEO_F411RE)
255253
HAL_I2C_Mem_Write(handle, LSM6DSO_I2C_ADD_L, reg,
256-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
254+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
257255
#elif defined(STEVAL_MKI109V3)
258256
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
259257
HAL_SPI_Transmit(handle, &reg, 1, 1000);
260-
HAL_SPI_Transmit(handle, bufp, len, 1000);
258+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
261259
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
262260
#elif defined(SPC584B_DIS)
263-
i2c_lld_write(handle, LSM6DSO_I2C_ADD_H & 0xFE, reg, bufp, len);
261+
i2c_lld_write(handle, LSM6DSO_I2C_ADD_H & 0xFE, reg, (uint8_t*) bufp, len);
264262
#endif
265263
return 0;
266264
}

lsm6dso_STdC/examples/lsm6dso_orientation.c

Lines changed: 5 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);
@@ -223,20 +222,19 @@ void lsm6dso_orientation(void)
223222
* @param len number of consecutive register to write
224223
*
225224
*/
226-
static int32_t platform_write(void *handle, uint8_t reg,
227-
uint8_t *bufp,
225+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
228226
uint16_t len)
229227
{
230228
#if defined(NUCLEO_F411RE)
231229
HAL_I2C_Mem_Write(handle, LSM6DSO_I2C_ADD_L, reg,
232-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
230+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
233231
#elif defined(STEVAL_MKI109V3)
234232
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
235233
HAL_SPI_Transmit(handle, &reg, 1, 1000);
236-
HAL_SPI_Transmit(handle, bufp, len, 1000);
234+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
237235
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
238236
#elif defined(SPC584B_DIS)
239-
i2c_lld_write(handle, LSM6DSO_I2C_ADD_H & 0xFE, reg, bufp, len);
237+
i2c_lld_write(handle, LSM6DSO_I2C_ADD_H & 0xFE, reg, (uint8_t*) bufp, len);
240238
#endif
241239
return 0;
242240
}

lsm6dso_STdC/examples/lsm6dso_pedometer.c

Lines changed: 5 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);
@@ -203,20 +202,19 @@ void lsm6dso_pedometer(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, LSM6DSO_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, LSM6DSO_I2C_ADD_H & 0xFE, reg, bufp, len);
217+
i2c_lld_write(handle, LSM6DSO_I2C_ADD_H & 0xFE, reg, (uint8_t*) bufp, len);
220218
#endif
221219
return 0;
222220
}

0 commit comments

Comments
 (0)