Skip to content

Commit

Permalink
iis3dhhc: 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 770ffcb commit b86bd94
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion iis3dhhc_STdC/driver
12 changes: 5 additions & 7 deletions iis3dhhc_STdC/examples/iis3dhhc_read_data_polling.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
#include "usbd_cdc_if.h"
#include "gpio.h"
#include "spi.h"
#include "tim.h"
#endif

/* Private macro -------------------------------------------------------------*/
Expand Down Expand Up @@ -95,8 +96,7 @@ static uint8_t tx_buffer[TX_BUF_DIM];
* 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 @@ -161,8 +161,7 @@ void iis3dhhc_read_data_polling(void)
/* Read temperature data */
memset(&data_raw_temperature, 0x00, sizeof(int16_t));
iis3dhhc_temperature_raw_get(&dev_ctx, &data_raw_temperature);
temperature_degC = iis3dhhc_from_lsb_to_celsius(
&data_raw_temperature );
temperature_degC = iis3dhhc_from_lsb_to_celsius(data_raw_temperature );
sprintf((char *)tx_buffer, "Temperature [degC]:%6.2f\r\n",
temperature_degC );
tx_com( tx_buffer, strlen( (char const *)tx_buffer ) );
Expand All @@ -180,14 +179,13 @@ void iis3dhhc_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)
{
#ifdef 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);
#endif
return 0;
Expand Down

0 comments on commit b86bd94

Please sign in to comment.