Update SensorLib

This commit is contained in:
lewisxhe 2026-04-08 09:28:20 +08:00
commit 4fdc6077b7
369 changed files with 362176 additions and 15123 deletions

View file

@ -100,10 +100,10 @@ static void bhi260_isr_init()
#endif
}
static void accel_process_callback(uint8_t sensor_id, uint8_t *data_ptr, uint32_t len, uint64_t *timestamp, void *user_data)
static void accel_process_callback(uint8_t sensor_id, const uint8_t *data_ptr, uint32_t len, uint64_t *timestamp, void *user_data)
{
struct bhy2_data_xyz data;
float scaling_factor = get_sensor_default_scaling(sensor_id);
float scaling_factor = BoschSensorUtils::get_sensor_default_scaling(sensor_id);
bhy2_parse_xyz(data_ptr, &data);
ESP_LOGI(TAG, "%s: x: %f, y: %f, z: %f;", bhy.getSensorName(sensor_id),
data.x * scaling_factor,
@ -111,10 +111,10 @@ static void accel_process_callback(uint8_t sensor_id, uint8_t *data_ptr, uint32_
data.z * scaling_factor);
}
static void gyro_process_callback(uint8_t sensor_id, uint8_t *data_ptr, uint32_t len, uint64_t *timestamp, void *user_data)
static void gyro_process_callback(uint8_t sensor_id, const uint8_t *data_ptr, uint32_t len, uint64_t *timestamp, void *user_data)
{
struct bhy2_data_xyz data;
float scaling_factor = get_sensor_default_scaling(sensor_id);
float scaling_factor = BoschSensorUtils::get_sensor_default_scaling(sensor_id);
bhy2_parse_xyz(data_ptr, &data);
ESP_LOGI(TAG, "%s: x: %f, y: %f, z: %f;", bhy.getSensorName(sensor_id),
data.x * scaling_factor,
@ -201,15 +201,15 @@ esp_err_t bhi260_init()
uint32_t report_latency_ms = 0; /* Report immediately */
// Enable acceleration
bhy.configure(SensorBHI260AP::ACCEL_PASSTHROUGH, sample_rate, report_latency_ms);
bhy.configure(BoschSensorID::ACCEL_PASSTHROUGH, sample_rate, report_latency_ms);
// Enable gyroscope
bhy.configure(SensorBHI260AP::GYRO_PASSTHROUGH, sample_rate, report_latency_ms);
bhy.configure(BoschSensorID::GYRO_PASSTHROUGH, sample_rate, report_latency_ms);
// Set the acceleration sensor result callback function
bhy.onResultEvent(SensorBHI260AP::ACCEL_PASSTHROUGH, accel_process_callback);
bhy.onResultEvent(BoschSensorID::ACCEL_PASSTHROUGH, accel_process_callback);
// Set the gyroscope sensor result callback function
bhy.onResultEvent(SensorBHI260AP::GYRO_PASSTHROUGH, gyro_process_callback);
bhy.onResultEvent(BoschSensorID::GYRO_PASSTHROUGH, gyro_process_callback);
// Registration interruption
bhi260_isr_init();

View file

@ -96,11 +96,6 @@ esp_err_t bma423_init()
#endif //ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5,0,0)
#endif //CONFIG_I2C_COMMUNICATION_METHOD_BUILTIN_RW
//Default 4G ,200HZ
accel.configAccelerometer();
accel.enableAccelerometer();
init_done = true;
return ESP_OK;
@ -111,9 +106,7 @@ void bma423_loop()
if (!init_done) {
return;
}
ESP_LOGI("BMA423", "Temperature:%.2f*C", accel.getTemperature(SensorBMA423::TEMP_DEG));
ESP_LOGI("BMA423", "Temperature:%.2f*F", accel.getTemperature(SensorBMA423::TEMP_FAHRENHEIT));
ESP_LOGI("BMA423", "Direction:%u", accel.direction());
ESP_LOGI("BMA423", "Temperature:%.2f*C", accel.getTemperature());
}
#endif

View file

@ -35,11 +35,11 @@
#ifdef CONFIG_XL9555
#include "ExtensionIOXL9555.hpp"
#include "IoExpanderXL9555.hpp"
static const char *TAG = "XL9555";
ExtensionIOXL9555 io;
IoExpanderXL9555 io;
static bool init_done = false;