Skip to content

Commit 3b8ae48

Browse files
author
albezanc
committed
lsm6dsr: added const to stmdev_write_ptr #121
1 parent ab9964d commit 3b8ae48

13 files changed

Lines changed: 61 additions & 85 deletions

lsm6dsr_STdC/driver

lsm6dsr_STdC/examples/lsm6dsr_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 lsm6dsr_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, LSM6DSR_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, LSM6DSR_I2C_ADD_L & 0xFE, reg, bufp, len);
213+
i2c_lld_write(handle, LSM6DSR_I2C_ADD_L & 0xFE, reg, (uint8_t*) bufp, len);
216214
#endif
217215
return 0;
218216
}

lsm6dsr_STdC/examples/lsm6dsr_compressed_fifo.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,7 @@ static st_fifo_out_slot gyr_slot[SLOT_NUMBER];
144144
* and are strictly related to the hardware platform used.
145145
*
146146
*/
147-
static int32_t platform_write(void *handle, uint8_t reg,
148-
uint8_t *bufp,
147+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
149148
uint16_t len);
150149
static int32_t platform_read(void *handle, uint8_t reg, uint8_t *bufp,
151150
uint16_t len);
@@ -307,20 +306,19 @@ void lsm6dsr_compressed_fifo(void)
307306
* @param len number of consecutive register to write
308307
*
309308
*/
310-
static int32_t platform_write(void *handle, uint8_t reg,
311-
uint8_t *bufp,
309+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
312310
uint16_t len)
313311
{
314312
#if defined(NUCLEO_F411RE)
315313
HAL_I2C_Mem_Write(handle, LSM6DSR_I2C_ADD_L, reg,
316-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
314+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
317315
#elif defined(STEVAL_MKI109V3)
318316
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
319317
HAL_SPI_Transmit(handle, &reg, 1, 1000);
320-
HAL_SPI_Transmit(handle, bufp, len, 1000);
318+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
321319
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
322320
#elif defined(SPC584B_DIS)
323-
i2c_lld_write(handle, LSM6DSR_I2C_ADD_L & 0xFE, reg, bufp, len);
321+
i2c_lld_write(handle, LSM6DSR_I2C_ADD_L & 0xFE, reg, (uint8_t*) bufp, len);
324322
#endif
325323
return 0;
326324
}

lsm6dsr_STdC/examples/lsm6dsr_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 lsm6dsr_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, LSM6DSR_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, LSM6DSR_I2C_ADD_L & 0xFE, reg, bufp, len);
256+
i2c_lld_write(handle, LSM6DSR_I2C_ADD_L & 0xFE, reg, (uint8_t*) bufp, len);
259257
#endif
260258
return 0;
261259
}

lsm6dsr_STdC/examples/lsm6dsr_free_fall.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);
@@ -198,20 +197,19 @@ void lsm6dsr_free_fall(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, LSM6DSR_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, LSM6DSR_I2C_ADD_L & 0xFE, reg, bufp, len);
212+
i2c_lld_write(handle, LSM6DSR_I2C_ADD_L & 0xFE, reg, (uint8_t*) bufp, len);
215213
#endif
216214
return 0;
217215
}

lsm6dsr_STdC/examples/lsm6dsr_multi_read_fifo.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,7 @@ static uint8_t tx_buffer[1000];
124124
* and are strictly related to the hardware platform used.
125125
*
126126
*/
127-
static int32_t platform_write(void *handle, uint8_t reg,
128-
uint8_t *bufp,
127+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
129128
uint16_t len);
130129
static int32_t platform_read(void *handle, uint8_t reg, uint8_t *bufp,
131130
uint16_t len);
@@ -260,20 +259,19 @@ void lsm6dsr_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, LSM6DSR_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, LSM6DSR_I2C_ADD_L & 0xFE, reg, bufp, len);
274+
i2c_lld_write(handle, LSM6DSR_I2C_ADD_L & 0xFE, reg, (uint8_t*) bufp, len);
277275
#endif
278276
return 0;
279277
}

lsm6dsr_STdC/examples/lsm6dsr_offset.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,7 @@ static uint8_t tx_buffer[1000];
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);
@@ -246,20 +245,19 @@ void lsm6dsr_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, LSM6DSR_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, LSM6DSR_I2C_ADD_L & 0xFE, reg, bufp, len);
260+
i2c_lld_write(handle, LSM6DSR_I2C_ADD_L & 0xFE, reg, (uint8_t*) bufp, len);
263261
#endif
264262
return 0;
265263
}

lsm6dsr_STdC/examples/lsm6dsr_orientation.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);
@@ -224,20 +223,19 @@ void lsm6dsr_orientation(void)
224223
* @param len number of consecutive register to write
225224
*
226225
*/
227-
static int32_t platform_write(void *handle, uint8_t reg,
228-
uint8_t *bufp,
226+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
229227
uint16_t len)
230228
{
231229
#if defined(NUCLEO_F411RE)
232230
HAL_I2C_Mem_Write(handle, LSM6DSR_I2C_ADD_L, reg,
233-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
231+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
234232
#elif defined(STEVAL_MKI109V3)
235233
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
236234
HAL_SPI_Transmit(handle, &reg, 1, 1000);
237-
HAL_SPI_Transmit(handle, bufp, len, 1000);
235+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
238236
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
239237
#elif defined(SPC584B_DIS)
240-
i2c_lld_write(handle, LSM6DSR_I2C_ADD_L & 0xFE, reg, bufp, len);
238+
i2c_lld_write(handle, LSM6DSR_I2C_ADD_L & 0xFE, reg, (uint8_t*) bufp, len);
241239
#endif
242240
return 0;
243241
}

lsm6dsr_STdC/examples/lsm6dsr_read_data_polling.c

Lines changed: 5 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);
@@ -235,20 +234,19 @@ void lsm6dsr_read_data_polling(void)
235234
* @param len number of consecutive register to write
236235
*
237236
*/
238-
static int32_t platform_write(void *handle, uint8_t reg,
239-
uint8_t *bufp,
237+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
240238
uint16_t len)
241239
{
242240
#if defined(NUCLEO_F411RE)
243241
HAL_I2C_Mem_Write(handle, LSM6DSR_I2C_ADD_L, reg,
244-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
242+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
245243
#elif defined(STEVAL_MKI109V3)
246244
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
247245
HAL_SPI_Transmit(handle, &reg, 1, 1000);
248-
HAL_SPI_Transmit(handle, bufp, len, 1000);
246+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
249247
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
250248
#elif defined(SPC584B_DIS)
251-
i2c_lld_write(handle, LSM6DSR_I2C_ADD_L & 0xFE, reg, bufp, len);
249+
i2c_lld_write(handle, LSM6DSR_I2C_ADD_L & 0xFE, reg, (uint8_t*) bufp, len);
252250
#endif
253251
return 0;
254252
}

lsm6dsr_STdC/examples/lsm6dsr_tap.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);
@@ -273,20 +272,19 @@ void lsm6dsr_tap(void)
273272
* @param len number of consecutive register to write
274273
*
275274
*/
276-
static int32_t platform_write(void *handle, uint8_t reg,
277-
uint8_t *bufp,
275+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
278276
uint16_t len)
279277
{
280278
#if defined(NUCLEO_F411RE)
281279
HAL_I2C_Mem_Write(handle, LSM6DSR_I2C_ADD_L, reg,
282-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
280+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
283281
#elif defined(STEVAL_MKI109V3)
284282
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
285283
HAL_SPI_Transmit(handle, &reg, 1, 1000);
286-
HAL_SPI_Transmit(handle, bufp, len, 1000);
284+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
287285
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
288286
#elif defined(SPC584B_DIS)
289-
i2c_lld_write(handle, LSM6DSR_I2C_ADD_L & 0xFE, reg, bufp, len);
287+
i2c_lld_write(handle, LSM6DSR_I2C_ADD_L & 0xFE, reg, (uint8_t*) bufp, len);
290288
#endif
291289
return 0;
292290
}

0 commit comments

Comments
 (0)