Skip to content

Commit

Permalink
ais2dw12: added const to stmdev_write_ptr #121
Browse files Browse the repository at this point in the history
  • Loading branch information
albezanc committed May 21, 2021
1 parent 86ffde2 commit 53ae422
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 50 deletions.
2 changes: 1 addition & 1 deletion ais2dw12_STdC/driver
12 changes: 5 additions & 7 deletions ais2dw12_STdC/examples/ais2dw12_activity.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,7 @@ static uint8_t tx_buffer[1000];
* and are strictly related to the hardware platform used.
*
*/
static int32_t platform_write(void *handle, uint8_t reg,
uint8_t *bufp,
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
uint16_t len);
static int32_t platform_read(void *handle, uint8_t reg, uint8_t *bufp,
uint16_t len);
Expand Down Expand Up @@ -214,20 +213,19 @@ void ais2dw12_activity(void)
* @param len number of consecutive register to write
*
*/
static int32_t platform_write(void *handle, uint8_t reg,
uint8_t *bufp,
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
uint16_t len)
{
#if defined(NUCLEO_F411RE)
HAL_I2C_Mem_Write(handle, AIS2DW12_I2C_ADD_H, reg,
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
#elif defined(STEVAL_MKI109V3)
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
HAL_SPI_Transmit(handle, &reg, 1, 1000);
HAL_SPI_Transmit(handle, bufp, len, 1000);
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
#elif defined(SPC584B_DIS)
i2c_lld_write(handle, AIS2DW12_I2C_ADD_H & 0xFE, reg, bufp, len);
i2c_lld_write(handle, AIS2DW12_I2C_ADD_H & 0xFE, reg, (uint8_t*) bufp, len);
#endif
return 0;
}
Expand Down
12 changes: 5 additions & 7 deletions ais2dw12_STdC/examples/ais2dw12_free_fall.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ static uint8_t tx_buffer[1000];
* and are strictly related to the hardware platform used.
*
*/
static int32_t platform_write(void *handle, uint8_t reg,
uint8_t *bufp,
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
uint16_t len);
static int32_t platform_read(void *handle, uint8_t reg, uint8_t *bufp,
uint16_t len);
Expand Down Expand Up @@ -190,20 +189,19 @@ void ais2dw12_free_fall(void)
* @param len number of consecutive register to write
*
*/
static int32_t platform_write(void *handle, uint8_t reg,
uint8_t *bufp,
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
uint16_t len)
{
#if defined(NUCLEO_F411RE)
HAL_I2C_Mem_Write(handle, AIS2DW12_I2C_ADD_H, reg,
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
#elif defined(STEVAL_MKI109V3)
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
HAL_SPI_Transmit(handle, &reg, 1, 1000);
HAL_SPI_Transmit(handle, bufp, len, 1000);
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
#elif defined(SPC584B_DIS)
i2c_lld_write(handle, AIS2DW12_I2C_ADD_H & 0xFE, reg, bufp, len);
i2c_lld_write(handle, AIS2DW12_I2C_ADD_H & 0xFE, reg, (uint8_t*) bufp, len);
#endif
return 0;
}
Expand Down
12 changes: 5 additions & 7 deletions ais2dw12_STdC/examples/ais2dw12_orientation.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ static uint8_t tx_buffer[1000];
* and are strictly related to the hardware platform used.
*
*/
static int32_t platform_write(void *handle, uint8_t reg,
uint8_t *bufp,
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
uint16_t len);
static int32_t platform_read(void *handle, uint8_t reg, uint8_t *bufp,
uint16_t len);
Expand Down Expand Up @@ -215,20 +214,19 @@ void ais2dw12_orientation(void)
* @param len number of consecutive register to write
*
*/
static int32_t platform_write(void *handle, uint8_t reg,
uint8_t *bufp,
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
uint16_t len)
{
#if defined(NUCLEO_F411RE)
HAL_I2C_Mem_Write(handle, AIS2DW12_I2C_ADD_H, reg,
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
#elif defined(STEVAL_MKI109V3)
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
HAL_SPI_Transmit(handle, &reg, 1, 1000);
HAL_SPI_Transmit(handle, bufp, len, 1000);
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
#elif defined(SPC584B_DIS)
i2c_lld_write(handle, AIS2DW12_I2C_ADD_H & 0xFE, reg, bufp, len);
i2c_lld_write(handle, AIS2DW12_I2C_ADD_H & 0xFE, reg, (uint8_t*) bufp, len);
#endif
return 0;
}
Expand Down
12 changes: 5 additions & 7 deletions ais2dw12_STdC/examples/ais2dw12_read_data_polling.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ static uint8_t tx_buffer[1000];
* and are strictly related to the hardware platform used.
*
*/
static int32_t platform_write(void *handle, uint8_t reg,
uint8_t *bufp,
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
uint16_t len);
static int32_t platform_read(void *handle, uint8_t reg, uint8_t *bufp,
uint16_t len);
Expand Down Expand Up @@ -202,20 +201,19 @@ void ais2dw12_read_data_polling(void)
* @param len number of consecutive register to write
*
*/
static int32_t platform_write(void *handle, uint8_t reg,
uint8_t *bufp,
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
uint16_t len)
{
#if defined(NUCLEO_F411RE)
HAL_I2C_Mem_Write(handle, AIS2DW12_I2C_ADD_H, reg,
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
#elif defined(STEVAL_MKI109V3)
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
HAL_SPI_Transmit(handle, &reg, 1, 1000);
HAL_SPI_Transmit(handle, bufp, len, 1000);
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
#elif defined(SPC584B_DIS)
i2c_lld_write(handle, AIS2DW12_I2C_ADD_H & 0xFE, reg, bufp, len);
i2c_lld_write(handle, AIS2DW12_I2C_ADD_H & 0xFE, reg, (uint8_t*) bufp, len);
#endif
return 0;
}
Expand Down
12 changes: 5 additions & 7 deletions ais2dw12_STdC/examples/ais2dw12_read_fifo.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ static uint8_t tx_buffer[1000];
* and are strictly related to the hardware platform used.
*
*/
static int32_t platform_write(void *handle, uint8_t reg,
uint8_t *bufp,
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
uint16_t len);
static int32_t platform_read(void *handle, uint8_t reg, uint8_t *bufp,
uint16_t len);
Expand Down Expand Up @@ -212,20 +211,19 @@ void ais2dw12_read_data_fifo(void)
* @param len number of consecutive register to write
*
*/
static int32_t platform_write(void *handle, uint8_t reg,
uint8_t *bufp,
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
uint16_t len)
{
#if defined(NUCLEO_F411RE)
HAL_I2C_Mem_Write(handle, AIS2DW12_I2C_ADD_H, reg,
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
#elif defined(STEVAL_MKI109V3)
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
HAL_SPI_Transmit(handle, &reg, 1, 1000);
HAL_SPI_Transmit(handle, bufp, len, 1000);
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
#elif defined(SPC584B_DIS)
i2c_lld_write(handle, AIS2DW12_I2C_ADD_H & 0xFE, reg, bufp, len);
i2c_lld_write(handle, AIS2DW12_I2C_ADD_H & 0xFE, reg, (uint8_t*) bufp, len);
#endif
return 0;
}
Expand Down
12 changes: 5 additions & 7 deletions ais2dw12_STdC/examples/ais2dw12_self_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,7 @@ static uint8_t tx_buffer[1000];
* and are strictly related to the hardware platform used.
*
*/
static int32_t platform_write(void *handle, uint8_t reg,
uint8_t *bufp,
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
uint16_t len);
static int32_t platform_read(void *handle, uint8_t reg, uint8_t *bufp,
uint16_t len);
Expand Down Expand Up @@ -297,20 +296,19 @@ void ais2dw12_self_test(void)
* @param len number of consecutive register to write
*
*/
static int32_t platform_write(void *handle, uint8_t reg,
uint8_t *bufp,
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
uint16_t len)
{
#if defined(NUCLEO_F411RE)
HAL_I2C_Mem_Write(handle, AIS2DW12_I2C_ADD_H, reg,
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
#elif defined(STEVAL_MKI109V3)
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
HAL_SPI_Transmit(handle, &reg, 1, 1000);
HAL_SPI_Transmit(handle, bufp, len, 1000);
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
#elif defined(SPC584B_DIS)
i2c_lld_write(handle, AIS2DW12_I2C_ADD_H & 0xFE, reg, bufp, len);
i2c_lld_write(handle, AIS2DW12_I2C_ADD_H & 0xFE, reg, (uint8_t*) bufp, len);
#endif
return 0;
}
Expand Down
12 changes: 5 additions & 7 deletions ais2dw12_STdC/examples/ais2dw12_wake_up.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ static uint8_t tx_buffer[1000];
* and are strictly related to the hardware platform used.
*
*/
static int32_t platform_write(void *handle, uint8_t reg,
uint8_t *bufp,
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
uint16_t len);
static int32_t platform_read(void *handle, uint8_t reg, uint8_t *bufp,
uint16_t len);
Expand Down Expand Up @@ -213,20 +212,19 @@ void ais2dw12_wake_up(void)
* @param len number of consecutive register to write
*
*/
static int32_t platform_write(void *handle, uint8_t reg,
uint8_t *bufp,
static int32_t platform_write(void *handle, uint8_t reg, const uint8_t *bufp,
uint16_t len)
{
#if defined(NUCLEO_F411RE)
HAL_I2C_Mem_Write(handle, AIS2DW12_I2C_ADD_H, reg,
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
#elif defined(STEVAL_MKI109V3)
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_RESET);
HAL_SPI_Transmit(handle, &reg, 1, 1000);
HAL_SPI_Transmit(handle, bufp, len, 1000);
HAL_SPI_Transmit(handle, (uint8_t*) bufp, len, 1000);
HAL_GPIO_WritePin(CS_up_GPIO_Port, CS_up_Pin, GPIO_PIN_SET);
#elif defined(SPC584B_DIS)
i2c_lld_write(handle, AIS2DW12_I2C_ADD_H & 0xFE, reg, bufp, len);
i2c_lld_write(handle, AIS2DW12_I2C_ADD_H & 0xFE, reg, (uint8_t*) bufp, len);
#endif
return 0;
}
Expand Down

0 comments on commit 53ae422

Please sign in to comment.