Skip to content

Commit

Permalink
iis2mdc: 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 16b3b34 commit 2e54e6e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion iis2mdc_STdC/driver
10 changes: 4 additions & 6 deletions iis2mdc_STdC/examples/iis2mdc_read_data_polling.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,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 @@ -185,15 +184,14 @@ void iis2mdc_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, IIS2MDC_I2C_ADD, reg,
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
#elif defined(SPC584B_DIS)
i2c_lld_write(handle, IIS2MDC_I2C_ADD & 0xFE, reg, bufp, len);
i2c_lld_write(handle, IIS2MDC_I2C_ADD & 0xFE, reg, (uint8_t*) bufp, len);
#endif
return 0;
}
Expand Down
10 changes: 4 additions & 6 deletions iis2mdc_STdC/examples/iis2mdc_self_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,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 @@ -295,15 +294,14 @@ void iis2mdc_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, IIS2MDC_I2C_ADD, reg,
I2C_MEMADD_SIZE_8BIT, bufp, len, 1000);
I2C_MEMADD_SIZE_8BIT, (uint8_t*) bufp, len, 1000);
#elif defined(SPC584B_DIS)
i2c_lld_write(handle, IIS2MDC_I2C_ADD & 0xFE, reg, bufp, len);
i2c_lld_write(handle, IIS2MDC_I2C_ADD & 0xFE, reg, (uint8_t*) bufp, len);
#endif
return 0;
}
Expand Down

0 comments on commit 2e54e6e

Please sign in to comment.