Skip to content

Commit eb5935a

Browse files
author
albezanc
committed
lsm6ds3: added const to stmdev_write_ptr #121
1 parent 2c1c9a8 commit eb5935a

15 files changed

Lines changed: 74 additions & 105 deletions

lsm6ds3_STdC/driver

lsm6ds3_STdC/examples/lsm6ds3_activity.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,7 @@ static uint8_t tx_buffer[1000];
113113
* and are strictly related to the hardware platform used.
114114
*
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);
@@ -204,20 +203,19 @@ void example_main_activity_lsm6ds3(void)
204203
* @param len number of consecutive register to write
205204
*
206205
*/
207-
static int32_t platform_write(void *handle, uint8_t reg,
208-
uint8_t *bufp,
206+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
209207
uint16_t len)
210208
{
211209
#if defined(NUCLEO_F411RE)
212210
HAL_I2C_Mem_Write(handle, LSM6DS3_I2C_ADD_L, reg,
213-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
211+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
214212
#elif defined(STEVAL_MKI109V3)
215213
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
216214
HAL_SPI_Transmit(handle, &reg, 1, 1000);
217-
HAL_SPI_Transmit(handle, bufp, len, 1000);
215+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
218216
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
219217
#elif defined(SPC584B_DIS)
220-
i2c_lld_write(handle, LSM6DS3_I2C_ADD_L & 0xFE, reg, bufp, len);
218+
i2c_lld_write(handle, LSM6DS3_I2C_ADD_L & 0xFE, reg, (uint8_t*) bufp, len);
221219
#endif
222220
return 0;
223221
}

lsm6ds3_STdC/examples/lsm6ds3_enable_timestamp_hw.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);
@@ -253,20 +252,19 @@ void example_main_timestamp_lsm6ds3(void)
253252
* @param len number of consecutive register to write
254253
*
255254
*/
256-
static int32_t platform_write(void *handle, uint8_t reg,
257-
uint8_t *bufp,
255+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
258256
uint16_t len)
259257
{
260258
#if defined(NUCLEO_F411RE)
261259
HAL_I2C_Mem_Write(handle, LSM6DS3_I2C_ADD_L, reg,
262-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
260+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
263261
#elif defined(STEVAL_MKI109V3)
264262
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
265263
HAL_SPI_Transmit(handle, &reg, 1, 1000);
266-
HAL_SPI_Transmit(handle, bufp, len, 1000);
264+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
267265
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
268266
#elif defined(SPC584B_DIS)
269-
i2c_lld_write(handle, LSM6DS3_I2C_ADD_L & 0xFE, reg, bufp, len);
267+
i2c_lld_write(handle, LSM6DS3_I2C_ADD_L & 0xFE, reg, (uint8_t*) bufp, len);
270268
#endif
271269
return 0;
272270
}

lsm6ds3_STdC/examples/lsm6ds3_fifo_stream_to_fifo.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);
@@ -226,20 +225,19 @@ void example_main_fifo_stream_lsm6ds3(void)
226225
* @param len number of consecutive register to write
227226
*
228227
*/
229-
static int32_t platform_write(void *handle, uint8_t reg,
230-
uint8_t *bufp,
228+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
231229
uint16_t len)
232230
{
233231
#if defined(NUCLEO_F411RE)
234232
HAL_I2C_Mem_Write(handle, LSM6DS3_I2C_ADD_L, reg,
235-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
233+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
236234
#elif defined(STEVAL_MKI109V3)
237235
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
238236
HAL_SPI_Transmit(handle, &reg, 1, 1000);
239-
HAL_SPI_Transmit(handle, bufp, len, 1000);
237+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
240238
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
241239
#elif defined(SPC584B_DIS)
242-
i2c_lld_write(handle, LSM6DS3_I2C_ADD_L & 0xFE, reg, bufp, len);
240+
i2c_lld_write(handle, LSM6DS3_I2C_ADD_L & 0xFE, reg, (uint8_t*) bufp, len);
243241
#endif
244242
return 0;
245243
}

lsm6ds3_STdC/examples/lsm6ds3_free_fall.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,7 @@ static uint8_t tx_buffer[1000];
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);
@@ -193,20 +192,19 @@ void example_main_free_fall_lsm6ds3(void)
193192
* @param len number of consecutive register to write
194193
*
195194
*/
196-
static int32_t platform_write(void *handle, uint8_t reg,
197-
uint8_t *bufp,
195+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
198196
uint16_t len)
199197
{
200198
#if defined(NUCLEO_F411RE)
201199
HAL_I2C_Mem_Write(handle, LSM6DS3_I2C_ADD_L, reg,
202-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
200+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
203201
#elif defined(STEVAL_MKI109V3)
204202
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
205203
HAL_SPI_Transmit(handle, &reg, 1, 1000);
206-
HAL_SPI_Transmit(handle, bufp, len, 1000);
204+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
207205
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
208206
#elif defined(SPC584B_DIS)
209-
i2c_lld_write(handle, LSM6DS3_I2C_ADD_L & 0xFE, reg, bufp, len);
207+
i2c_lld_write(handle, LSM6DS3_I2C_ADD_L & 0xFE, reg, (uint8_t*) bufp, len);
210208
#endif
211209
return 0;
212210
}

lsm6ds3_STdC/examples/lsm6ds3_multi_read_fifo.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,7 @@ static stmdev_ctx_t dev_ctx;
169169
* and are strictly related to the hardware platform used.
170170
*
171171
*/
172-
static int32_t platform_write(void *handle, uint8_t reg,
173-
uint8_t *bufp,
172+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
174173
uint16_t len);
175174
static int32_t platform_read(void *handle, uint8_t reg, uint8_t *bufp,
176175
uint16_t len);
@@ -360,20 +359,19 @@ void example_main_fifo_lsm6ds3(void)
360359
* @param len number of consecutive register to write
361360
*
362361
*/
363-
static int32_t platform_write(void *handle, uint8_t reg,
364-
uint8_t *bufp,
362+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
365363
uint16_t len)
366364
{
367365
#if defined(NUCLEO_F411RE)
368366
HAL_I2C_Mem_Write(handle, LSM6DS3_I2C_ADD_L, reg,
369-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
367+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
370368
#elif defined(STEVAL_MKI109V3)
371369
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
372370
HAL_SPI_Transmit(handle, &reg, 1, 1000);
373-
HAL_SPI_Transmit(handle, bufp, len, 1000);
371+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
374372
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
375373
#elif defined(SPC584B_DIS)
376-
i2c_lld_write(handle, LSM6DS3_I2C_ADD_L & 0xFE, reg, bufp, len);
374+
i2c_lld_write(handle, LSM6DS3_I2C_ADD_L & 0xFE, reg, (uint8_t*) bufp, len);
377375
#endif
378376
return 0;
379377
}

lsm6ds3_STdC/examples/lsm6ds3_multi_read_fifo_simple.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);
@@ -254,20 +253,19 @@ void example_multi_read_fifo_simple_lsm6ds3(void)
254253
* @param len number of consecutive register to write
255254
*
256255
*/
257-
static int32_t platform_write(void *handle, uint8_t reg,
258-
uint8_t *bufp,
256+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
259257
uint16_t len)
260258
{
261259
#if defined(NUCLEO_F411RE)
262260
HAL_I2C_Mem_Write(handle, LSM6DS3_I2C_ADD_L, reg,
263-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
261+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
264262
#elif defined(STEVAL_MKI109V3)
265263
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
266264
HAL_SPI_Transmit(handle, &reg, 1, 1000);
267-
HAL_SPI_Transmit(handle, bufp, len, 1000);
265+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
268266
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
269267
#elif defined(SPC584B_DIS)
270-
i2c_lld_write(handle, LSM6DS3_I2C_ADD_L & 0xFE, reg, bufp, len);
268+
i2c_lld_write(handle, LSM6DS3_I2C_ADD_L & 0xFE, reg, (uint8_t*) bufp, len);
271269
#endif
272270
return 0;
273271
}

lsm6ds3_STdC/examples/lsm6ds3_orientation.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,7 @@ static uint8_t tx_buffer[1000];
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);
@@ -220,20 +219,19 @@ void example_main_orientation_6D_lsm6ds3(void)
220219
* @param len number of consecutive register to write
221220
*
222221
*/
223-
static int32_t platform_write(void *handle, uint8_t reg,
224-
uint8_t *bufp,
222+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
225223
uint16_t len)
226224
{
227225
#if defined(NUCLEO_F411RE)
228226
HAL_I2C_Mem_Write(handle, LSM6DS3_I2C_ADD_L, reg,
229-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
227+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
230228
#elif defined(STEVAL_MKI109V3)
231229
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
232230
HAL_SPI_Transmit(handle, &reg, 1, 1000);
233-
HAL_SPI_Transmit(handle, bufp, len, 1000);
231+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
234232
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
235233
#elif defined(SPC584B_DIS)
236-
i2c_lld_write(handle, LSM6DS3_I2C_ADD_L & 0xFE, reg, bufp, len);
234+
i2c_lld_write(handle, LSM6DS3_I2C_ADD_L & 0xFE, reg, (uint8_t*) bufp, len);
237235
#endif
238236
return 0;
239237
}

lsm6ds3_STdC/examples/lsm6ds3_read_data_polling.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@ static uint8_t tx_buffer[1000];
118118
* and are strictly related to the hardware platform used.
119119
*
120120
*/
121-
static int32_t platform_write(void *handle, uint8_t reg,
122-
uint8_t *bufp,
121+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
123122
uint16_t len);
124123
static int32_t platform_read(void *handle, uint8_t reg, uint8_t *bufp,
125124
uint16_t len);
@@ -231,20 +230,19 @@ void example_main_lsm6ds3(void)
231230
* @param len number of consecutive register to write
232231
*
233232
*/
234-
static int32_t platform_write(void *handle, uint8_t reg,
235-
uint8_t *bufp,
233+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
236234
uint16_t len)
237235
{
238236
#if defined(NUCLEO_F411RE)
239237
HAL_I2C_Mem_Write(handle, LSM6DS3_I2C_ADD_L, reg,
240-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
238+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
241239
#elif defined(STEVAL_MKI109V3)
242240
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
243241
HAL_SPI_Transmit(handle, &reg, 1, 1000);
244-
HAL_SPI_Transmit(handle, bufp, len, 1000);
242+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
245243
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
246244
#elif defined(SPC584B_DIS)
247-
i2c_lld_write(handle, LSM6DS3_I2C_ADD_L & 0xFE, reg, bufp, len);
245+
i2c_lld_write(handle, LSM6DS3_I2C_ADD_L & 0xFE, reg, (uint8_t*) bufp, len);
248246
#endif
249247
return 0;
250248
}

lsm6ds3_STdC/examples/lsm6ds3_self_test.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,7 @@
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);
@@ -371,20 +370,19 @@ void lsm6ds3_self_test(void)
371370
* @param len number of consecutive register to write
372371
*
373372
*/
374-
static int32_t platform_write(void *handle, uint8_t reg,
375-
uint8_t *bufp,
373+
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
376374
uint16_t len)
377375
{
378376
#if defined(NUCLEO_F411RE)
379377
HAL_I2C_Mem_Write(handle, LSM6DS3_I2C_ADD_L, reg,
380-
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
378+
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
381379
#elif defined(STEVAL_MKI109V3)
382380
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
383381
HAL_SPI_Transmit(handle, &reg, 1, 1000);
384-
HAL_SPI_Transmit(handle, bufp, len, 1000);
382+
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
385383
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
386384
#elif defined(SPC584B_DIS)
387-
i2c_lld_write(handle, LSM6DS3_I2C_ADD_L & 0xFE, reg, bufp, len);
385+
i2c_lld_write(handle, LSM6DS3_I2C_ADD_L & 0xFE, reg, (uint8_t*) bufp, len);
388386
#endif
389387
return 0;
390388
}

0 commit comments

Comments
 (0)