From 3d4351584935be90e334aecfc25b0ab2a0681a8f Mon Sep 17 00:00:00 2001 From: "Shen Jianping (CC-DA/ESI6)" Date: Fri, 7 Jul 2023 13:45:09 +0200 Subject: [PATCH] v0.3.2.0 v0.3.2.0 Co-Authored-By: Markus Lochmann <100404916+ma-loc@users.noreply.github.com> Co-Authored-By: Yong Shen <47750708+yongbosch@users.noreply.github.com> --- smi230/Makefile | 42 --------------------- smi230/hal/sensors.cpp | 29 +++++++------- smi230/sensord/sensord_hwcntl.cpp | 2 +- smi230/sensord/sensord_hwcntl_implement.cpp | 11 ++---- 4 files changed, 19 insertions(+), 65 deletions(-) delete mode 100644 smi230/Makefile diff --git a/smi230/Makefile b/smi230/Makefile deleted file mode 100644 index 285d02a..0000000 --- a/smi230/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -TARGET ?= hal_test - -SRCS := \ - sensord/axis_remap.c\ - sensord/sensord_hwcntl.cpp\ - sensord/sensord_hwcntl_implement.cpp\ - sensord/util_misc.c\ - sensord/sensord_pltf.c\ - sensord/sensord_cfg.cpp\ - sensord/sensord_algo.cpp\ - sensord/sensord.cpp\ - sensord/boschsimple_list.cpp\ - hal/sensors.cpp\ - hal/BoschSensor.cpp - -OBJS := $(addsuffix .o,$(basename $(SRCS))) -#DEPS := $(addsuffix .d,$(basename $(SRCS))) - -INC_DIRS := $(shell find $(SRC_DIRS) -type d) -INC_FLAGS := $(addprefix -I,$(INC_DIRS)) - -HAL_TEST ?= false - -ifeq ($(HAL_TEST), true) -CPPFLAGS ?= $(INC_FLAGS) -MMD -MP -DPLTF_LINUX_ENABLED -DTEST_APP_ACTIVE -LDFLAGS ?= -lpthread -lstdc++ -static -OUTPUT ?= smi230_hal_test - -all: $(SRCS) clean - arm-linux-gnueabihf-gcc $(CPPFLAGS) -lpthread -lstdc++ $(SRCS) $(LDFLAGS) -o $(OUTPUT) -else -CPPFLAGS ?= $(INC_FLAGS) -MMD -MP -DPLTF_LINUX_ENABLED -LDFLAGS ?= -lpthread -lstdc++ -shared -OUTPUT ?= smi230_hal - -all: $(SRCS) clean - arm-linux-gnueabihf-gcc $(CPPFLAGS) -lpthread -lstdc++ $(SRCS) $(LDFLAGS) -o $(OUTPUT).so -endif - -.PHONY: clean -clean: - $(RM) $(TARGET) $(OBJS) $(DEPS) $(OUTPUT).d $(OUTPUT) $(OUTPUT).so diff --git a/smi230/hal/sensors.cpp b/smi230/hal/sensors.cpp index a017ee2..e062cb7 100644 --- a/smi230/hal/sensors.cpp +++ b/smi230/hal/sensors.cpp @@ -32,6 +32,8 @@ #include "sensors_poll_context.h" +#define VERSION_MAJOR (0) +#define VERSION_MINOR (3) /*****************************************************************************/ static const struct sensor_t *sSensorList = NULL; @@ -234,21 +236,20 @@ static struct hw_module_methods_t sensors_module_methods = }; struct sensors_module_t HAL_MODULE_INFO_SYM = -{ - .common = { - .tag = HARDWARE_MODULE_TAG, - .version_major = 1, - .version_minor = 0, - .id = SENSORS_HARDWARE_MODULE_ID, - .name = "Bosch Sensor module", - .author = "Robert Bosch,GmbH", - .methods = &sensors_module_methods, - .dso = NULL, - .reserved = {0} - }, - .get_sensors_list = sensors__get_sensors_list, + { + .common = { + .tag = HARDWARE_MODULE_TAG, + .module_api_version = (VERSION_MAJOR << 8) | VERSION_MINOR, + .hal_api_version = 0, + .id = SENSORS_HARDWARE_MODULE_ID, + .name = "Bosch Sensor module", + .author = "Robert Bosch,GmbH", + .methods = &sensors_module_methods, + .dso = NULL, + .reserved = {0}}, + .get_sensors_list = sensors__get_sensors_list, #if defined(SENSORS_DEVICE_API_VERSION_1_4) - .set_operation_mode = sensors__set_operation_mode, + .set_operation_mode = sensors__set_operation_mode, #endif }; diff --git a/smi230/sensord/sensord_hwcntl.cpp b/smi230/sensord/sensord_hwcntl.cpp index ad21ba3..0c19537 100644 --- a/smi230/sensord/sensord_hwcntl.cpp +++ b/smi230/sensord/sensord_hwcntl.cpp @@ -46,7 +46,7 @@ * 2nd byte minor version of HAL * 3nd byte bug fix version of HAL */ -uint8_t HAL_ver[4] = { 0, 3, 0, 0 }; +uint8_t HAL_ver[4] = { 0, 3, 2, 0 }; #define UNUSED_SENSOR_T(sensor_name) \ { .name = sensor_name,\ diff --git a/smi230/sensord/sensord_hwcntl_implement.cpp b/smi230/sensord/sensord_hwcntl_implement.cpp index 854bda2..2a7b3b3 100644 --- a/smi230/sensord/sensord_hwcntl_implement.cpp +++ b/smi230/sensord/sensord_hwcntl_implement.cpp @@ -187,9 +187,7 @@ EV_FF_STATUS 0x17 EV_MAX 0x1f EV_CNT (EV_MAX+1) #define SMI230_GYRO_RANGE_1000DPS 1000 #define SMI230_GYRO_RANGE_2000DPS 2000 -#define SMI230_GYRO_BYTES_PER_FIFO_SAMPLE 6 -#define SMI230_GYRO_MAX_FIFO_BYTE 100 -#define SMI230_GYRO_MAX_FIFO_FRAME (SMI230_GYRO_MAX_FIFO_BYTE / SMI230_GYRO_BYTES_PER_FIFO_SAMPLE) +#define SMI230_GYRO_MAX_FIFO_FRAME 100 #define BMA2X2_RANGE_2G 3 #define BMA2X2_RANGE_4G 5 @@ -826,7 +824,6 @@ static void ap_config_phyGYR(bsx_f32_t sample_rate, uint16_t fifo_data_len) int32_t odr_Hz; int32_t bandwidth = 0; int32_t fifo_data_sel_regval; - int32_t fifo_data_len_in_bytes; float physical_Hz = 0; PINFO("set physical GYRO rate %f", sample_rate); @@ -924,10 +921,8 @@ static void ap_config_phyGYR(bsx_f32_t sample_rate, uint16_t fifo_data_len) if (fifo_data_len < 1) fifo_data_len = 1; - fifo_data_len_in_bytes = SMI230_GYRO_BYTES_PER_FIFO_SAMPLE * fifo_data_len; - - PINFO("write gyro wm as %d samples, in %d bytes", fifo_data_len, fifo_data_len_in_bytes); - ret = wr_sysfs_oneint("fifo_wm", gyr_input_dir_name, fifo_data_len_in_bytes); + PINFO("write gyro wm as %d", fifo_data_len); + ret = wr_sysfs_oneint("fifo_wm", gyr_input_dir_name, fifo_data_len); #endif }