sensor: bq274xx: use sys_put_le16 in bq274xx_ctrl_reg_write
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 <fabiobaltieri@google.com>
This commit is contained in:
parent
aae140cadb
commit
69a5e64f8c
1 changed files with 4 additions and 5 deletions
|
@ -86,11 +86,10 @@ static int bq274xx_ctrl_reg_write(const struct device *dev, uint16_t subcommand)
|
||||||
const struct bq274xx_config *config = dev->config;
|
const struct bq274xx_config *config = dev->config;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
uint8_t tx_buf[3] = {
|
uint8_t tx_buf[3];
|
||||||
BQ274XX_CMD_CONTROL_LOW,
|
|
||||||
subcommand & 0xff,
|
tx_buf[0] = BQ274XX_CMD_CONTROL_LOW;
|
||||||
subcommand >> 8,
|
sys_put_le16(subcommand, &tx_buf[1]);
|
||||||
};
|
|
||||||
|
|
||||||
ret = i2c_write_dt(&config->i2c, tx_buf, sizeof(tx_buf));
|
ret = i2c_write_dt(&config->i2c, tx_buf, sizeof(tx_buf));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue