Compare commits

..

4 Commits
v1.1 ... master

Author SHA1 Message Date
TamTamHero
93e47861b3 Fix wrong addressing of raw temp and pressure buffers 2025-05-03 19:25:01 +03:00
TamTamHero
1e18e7a815 Remove non-existent IIR_X1 filter 2025-05-03 19:25:01 +03:00
TamTamHero
91c142fd5d Increase CMake version requirement to fix compilation on recent CMake install 2025-05-03 19:25:01 +03:00
TamTamHero
55e1ccc3c9 Expose reset function for external use 2025-04-13 15:56:00 +03:00
4 changed files with 15 additions and 10 deletions

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.17)
set(CMAKE_C_STANDARD 11)
idf_component_register(
SRCS bmx280.c

@ -338,12 +338,6 @@ static esp_err_t bmx280_probe(bmx280_t *bmx280)
#endif
}
static esp_err_t bmx280_reset(bmx280_t *bmx280)
{
const static uint8_t din[] = { BMX280_RESET_VEC };
return bmx280_write(bmx280, BMX280_REG_RESET, din, sizeof din);
}
static esp_err_t bmx280_calibrate(bmx280_t *bmx280)
{
// Honestly, the best course of action is to read the high and low banks
@ -448,6 +442,12 @@ bmx280_t* bmx280_create_master(i2c_master_bus_handle_t bus_handle)
}
#endif
esp_err_t bmx280_reset(bmx280_t *bmx280)
{
const static uint8_t din[] = { BMX280_RESET_VEC };
return bmx280_write(bmx280, BMX280_REG_RESET, din, sizeof din);
}
void bmx280_close(bmx280_t *bmx280)
{
#if CONFIG_USE_I2C_MASTER_DRIVER
@ -634,7 +634,7 @@ esp_err_t bmx280_readout(bmx280_t *bmx280, int32_t *temperature, uint32_t *press
return error;
*temperature = BME280_compensate_T_int32(bmx280,
(buffer[0] << 12) | (buffer[1] << 4) | (buffer[0] >> 4)
(buffer[0] << 12) | (buffer[1] << 4) | (buffer[2] >> 4)
);
}
@ -644,7 +644,7 @@ esp_err_t bmx280_readout(bmx280_t *bmx280, int32_t *temperature, uint32_t *press
return error;
*pressure = BME280_compensate_P_int64(bmx280,
(buffer[0] << 12) | (buffer[1] << 4) | (buffer[0] >> 4)
(buffer[0] << 12) | (buffer[1] << 4) | (buffer[2] >> 4)
);
}

@ -57,6 +57,12 @@ BMXAPI bmx280_t* bmx280_create_legacy(i2c_port_t port);
#define bmx280_create_master(port) static_assert(0, "You have the wrong driver configuration for using the new I2C master driver.")
#endif
/**
* Restart the sensor, effectively puting it into sleep mode.
* @param bmx280 The instance to reset.
*/
esp_err_t bmx280_reset(bmx280_t *bmx280);
/**
* Destroy your the instance.
* @param bmx280 The instance to destroy.

@ -57,7 +57,6 @@ typedef enum bmx280_tstby_t {
typedef enum bmx280_iirf_t {
BMX280_IIR_NONE = 0x0,
BMX280_IIR_X1,
BMX280_IIR_X2,
BMX280_IIR_X4,
BMX280_IIR_X8,