driver: sensor: icm42x70: Add Apex handling while stream #31
Please remove the indent modifications, it creates noise in the review.
I wonder if you should set this config prior to enable the sensor? In case of apex on/off then accel on it might have an unwanted decimation factor configured when starting the sensor.
What about recomputing the decimation factor when the apex is on and the accel is disabled ?
Not sure it is necessary to disable the interrupt.
If no sensor is enabled then no interrupt will occur, no need to disable it.
Same here, why do you need to disable interrupts?
This decimates also gyro samples, we need a decimation for accel samples only.
The decimation would probably require an anti aliasing filter, to be discuss with Pierre Grenet.
This is already defined in inv_imu_tap.h in tdk_hal driver
/** @brief Tap axis definition */
typedef enum {
INV_IMU_DMP_TAP_AXIS_Z = 0x02,
INV_IMU_DMP_TAP_AXIS_Y = 0x01,
INV_IMU_DMP_TAP_AXIS_X = 0x00,
} inv_imu_tap_axis_t;
Please use this instead.
This is already defined in inv_imu_tap.h in tdk_hal driver
/** @brief Tap direction definition */
typedef enum {
INV_IMU_DMP_TAP_DIR_POSITIVE = 0x01,
INV_IMU_DMP_TAP_DIR_NEGATIVE = 0x00,
} inv_imu_tap_dir_t;
Please use this instead.
Please removed unused comment
From previous PR:
I think this must be reworked.
We could use MOTION and TAP triggers to enable/disable APEX instead of TDK specific Attributes that no one knows about.
It needs a bit of discussion to decide of the best implementation.
JHKim8212 replied on Oct 14
@JHKim8212
JHKim8212
on Oct 14
Collaborator
Author
As I mentioned from
https://github.com/InvenSenseInc/fork.zephyr-rtos/pull/24/changes/BASE..ca7feaedd06fb232118eb7744257f718ccc0fcc4#r4273558568
zephyr sensor.h doesn't contain some motions.
So use TDK_APEX_XXX is more good instead of use sensor.h definitions.
rbuisson-invn replied on Oct 15
@rbuisson-invn
rbuisson-invn
on Oct 15
Collaborator
I agree that not all APEX are known to basic Zephyr sensor.h, however the aim of such drivers is to provide as much as possible regular interfaces, in order for an application to use them.
The goal of an OS is to provide basic services to ease spreading of applications relying on those, each time a non-conventional interface is used, the app using it is no more portable. And the other way around, if an application requires TAP support, and our sensor does not offers it, that will be an issue as well.
So I think we should take more time thinking about using those regular APIs, when they exist.
Remove the comment
Discussion from previous PR:
Only TAP requires 400Hz, may be clever to adapt frequency only when TAP is enabled.
JHKim8212 replied on Oct 14
@JHKim8212
JHKim8212
on Oct 14
Collaborator
Author
int icm42x70_apex_enable(inv_imu_device_t s)
this function doesn't know tap is enabled or not.
So I guess that set 50Hz in this function and re-set accel and dmp ODR to 400 in tap_enable function is more good.
below function is executed after icm42x70_apex_enable().
So how about adding inv_imu_set_accel_frequency(s, ACCEL_CONFIG0_ODR_400_HZ); and inv_imu_apex_set_frequency(s, APEX_CONFIG1_DMP_ODR_400Hz); in this function?
int icm42x70_apex_enable_tap(const struct device dev, inv_imu_device_t s)
{
int rc = 0;
struct icm42x70_data data = dev->data;
/ Enable TAP /
rc |= inv_imu_tap_enable(s);
data->dmp_odr_hz = 400;
return rc;
}
afontaine-invn replied on Oct 15
@afontaine-invn
afontaine-invn
on Oct 15
Collaborator
Your proposal seems reasonable, but it would be easier to review the new modified code. I would say, go ahead with the implementation you proposed.
rbuisson-invn replied on Oct 16
@rbuisson-invn
rbuisson-invn
on Oct 16
Collaborator
If this function does not know what APEX is started or not, the accel should not be started at all
These defines are supposed to be mask, because it can be triggered at the same time than the other apex.
Please define BIT(x) for each to be able to report apex_status properly.
IMO, we need to rediscuss the need to use standard Zephyr API for TAP triggers (i.e. SENSOR_TRIG_TAP).
Requested changes.
This should be a mask, the value should be |= to not clear the other apex status.
Same here.
The value should be |= to not clear the other apex status.
Same here.
The value should be |= to not clear the other apex status.
Requested changes.
rbuisson-invn
JHKim8212
Added APEX handling feature for
activate APEX event while stream raw data.
With this feature User can use APEX feature while
stream accel and/or gyro sensor data.