Skip to content

Commit

Permalink
sensor: bq274xx: use sys_put_le16 in bq274xx_ctrl_reg_write
Browse files Browse the repository at this point in the history
Use sys_put_le16 in bq274xx_ctrl_reg_write to convert the two bytes
value. This is coherent with the rest of the file.

Signed-off-by: Fabio Baltieri <[email protected]>
  • Loading branch information
fabiobaltieri authored and carlescufi committed Aug 30, 2023
1 parent aae140c commit 69a5e64
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions drivers/sensor/bq274xx/bq274xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,10 @@ static int bq274xx_ctrl_reg_write(const struct device *dev, uint16_t subcommand)
const struct bq274xx_config *config = dev->config;
int ret;

uint8_t tx_buf[3] = {
BQ274XX_CMD_CONTROL_LOW,
subcommand & 0xff,
subcommand >> 8,
};
uint8_t tx_buf[3];

tx_buf[0] = BQ274XX_CMD_CONTROL_LOW;
sys_put_le16(subcommand, &tx_buf[1]);

ret = i2c_write_dt(&config->i2c, tx_buf, sizeof(tx_buf));
if (ret < 0) {
Expand Down

0 comments on commit 69a5e64

Please sign in to comment.