Skip to content

Commit

Permalink
iis2iclx: 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 284bbaa commit 16b3b34
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion iis2iclx_STdC/driver
15 changes: 7 additions & 8 deletions iis2iclx_STdC/examples/iis2iclx_read_data_polling.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
*/

//#define STEVAL_MKI109V3 /* little endian */
#define NUCLEO_F411RE /* little endian */
//#define NUCLEO_F411RE /* little endian */
//#define SPC584B_DIS /* big endian */

/* ATTENTION: By default the driver is little endian. If you need switch
Expand Down Expand Up @@ -93,6 +93,7 @@
#include "usbd_cdc_if.h"
#include "gpio.h"
#include "spi.h"
#include "tim.h"

#elif defined(SPC584B_DIS)
#include "components.h"
Expand All @@ -119,8 +120,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 @@ -210,20 +210,19 @@ void example_main_iis2iclx(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, IIS2ICLX_I2C_ADD_L, 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, IIS2ICLX_I2C_ADD_L & 0xFE, reg, bufp, len);
i2c_lld_write(handle, IIS2ICLX_I2C_ADD_L & 0xFE, reg, (uint8_t*) bufp, len);
#endif
return 0;
}
Expand Down

0 comments on commit 16b3b34

Please sign in to comment.