Skip to content

Commit

Permalink
drivers: sensor: lis2de12: add length check in spi write incr routine
Browse files Browse the repository at this point in the history
Added a length check in the spi write incr routine to handle both
single and multi byte write operations properly.

Signed-off-by: Mayank Narang <[email protected]>
(cherry picked from commit cb60881)
  • Loading branch information
narangmayank authored and github-actions[bot] committed Jan 24, 2025
1 parent 99a3a8e commit 978560a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/sensor/st/stmemsc/stmemsc_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ int stmemsc_spi_read_incr(const struct spi_dt_spec *stmemsc,
int stmemsc_spi_write_incr(const struct spi_dt_spec *stmemsc,
uint8_t reg_addr, uint8_t *value, uint8_t len)
{
reg_addr |= STMEMSC_SPI_ADDR_AUTO_INCR;
if (len > 1) {
reg_addr |= STMEMSC_SPI_ADDR_AUTO_INCR;
}

return stmemsc_spi_write(stmemsc, reg_addr, value, len);
}

0 comments on commit 978560a

Please sign in to comment.