Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions drivers/sensor/bosch/bmp581/bmp581.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <zephyr/init.h>
#include <zephyr/logging/log.h>
#include <zephyr/sys/check.h>
#include <zephyr/sys/util.h>

LOG_MODULE_REGISTER(bmp581, CONFIG_SENSOR_LOG_LEVEL);

Expand Down Expand Up @@ -404,12 +405,16 @@
int ret = 0;

ret = bmp581_reg_read_rtio(&conf->bus, BMP5_REG_TEMP_DATA_XLSB, data, 6);
if (ret == BMP5_OK) {

Check warning on line 408 in drivers/sensor/bosch/bmp581/bmp581.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

SUSPECT_CODE_INDENT

drivers/sensor/bosch/bmp581/bmp581.c:408 suspect code indent for conditional statements (8, 17)
/* convert raw sensor data to sensor_value. Shift the decimal part by 1 decimal
* place to compensate for the conversion in sensor_value_to_double()
/* convert raw sensor data to sensor_value.
* BMP581 temperature data is 24-bit signed with LSB = 1/65536 °C
*/
drv->last_sample.temperature.val1 = data[2];
drv->last_sample.temperature.val2 = (data[1] << 8 | data[0]) * 10;
uint32_t raw_temp = ((uint32_t)data[2] << 16) | ((uint16_t)data[1] << 8) | data[0];

Check warning on line 412 in drivers/sensor/bosch/bmp581/bmp581.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

TABSTOP

drivers/sensor/bosch/bmp581/bmp581.c:412 Statements should start on a tabstop
int32_t raw_temp_signed = sign_extend(raw_temp, 23);

Check warning on line 413 in drivers/sensor/bosch/bmp581/bmp581.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

TABSTOP

drivers/sensor/bosch/bmp581/bmp581.c:413 Statements should start on a tabstop

/* Convert raw temperature: LSB = 1/65536 °C, val2 in millionths */
drv->last_sample.temperature.val1 = raw_temp_signed / 65536;
drv->last_sample.temperature.val2 = ((int64_t)(raw_temp_signed % 65536) * 1000000) / 65536;

Check warning on line 417 in drivers/sensor/bosch/bmp581/bmp581.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

LONG_LINE

drivers/sensor/bosch/bmp581/bmp581.c:417 line length of 107 exceeds 100 columns

if (drv->osr_odr_press_config.press_en == BMP5_ENABLE) {
/* convert raw sensor data to sensor_value. Shift the decimal part by
Expand Down
Loading