driver/sensor: support new sensor type:ECG,PPG,Imdepance
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
parent
26fedb2770
commit
f1f0bcc521
@ -125,6 +125,9 @@ static const struct sensor_info g_sensor_info[] =
|
||||
{sizeof(struct sensor_event_dust), "dust"},
|
||||
{sizeof(struct sensor_event_hrate), "hrate"},
|
||||
{sizeof(struct sensor_event_hbeat), "hbeat"},
|
||||
{sizeof(struct sensor_event_ecg), "ecg"},
|
||||
{sizeof(struct sensor_event_ppg), "ppg"},
|
||||
{sizeof(struct sensor_event_impd), "impd"},
|
||||
};
|
||||
|
||||
static const struct file_operations g_sensor_fops =
|
||||
|
@ -217,9 +217,37 @@
|
||||
|
||||
#define SENSOR_TYPE_HEART_BEAT 24
|
||||
|
||||
/* ECG (Electrocardiogram)
|
||||
* A sensor of this type returns the ECG voltage in μV. Sensors may amplify
|
||||
* the input ECG signal. Here the ECG voltage is the un-amplified ECG
|
||||
* voltage.
|
||||
*/
|
||||
|
||||
#define SENSOR_TYPE_ECG 25
|
||||
|
||||
/* PPG (Photoplethysmography)
|
||||
* A sensor of this type returns the PPG measurements in counts. The PPG
|
||||
* measurements come from photodiode and following current amplifiers, where
|
||||
* the photodiode switches reflected light intensity to current. Here the PPG
|
||||
* value means the ADC counts, since the LED lightness, the photodiode model,
|
||||
* the reflect-ratio, and the integration time of ADC varies with different
|
||||
* measurements, while the useful information of PPG is the not the magnitude
|
||||
* but the shape of the waveform.
|
||||
*/
|
||||
|
||||
#define SENSOR_TYPE_PPG 26
|
||||
|
||||
/* Imdepance
|
||||
* A sensor of this type returns the impedance measurements. An impedance
|
||||
* is a complex number, which consists of a real part(resistance) and an
|
||||
* imaginary part(reactance). Both of them are in uint Ohm(Ω).
|
||||
*/
|
||||
|
||||
#define SENSOR_TYPE_IMPEDANCE 27
|
||||
|
||||
/* The total number of sensor */
|
||||
|
||||
#define SENSOR_TYPE_COUNT 25
|
||||
#define SENSOR_TYPE_COUNT 28
|
||||
|
||||
/****************************************************************************
|
||||
* Inline Functions
|
||||
@ -414,6 +442,25 @@ struct sensor_event_hbeat /* Type: Heart Beat */
|
||||
float beat; /* Units is times/minutes */
|
||||
};
|
||||
|
||||
struct sensor_event_ecg /* Type: ECG */
|
||||
{
|
||||
uint64_t timestamp; /* Unit is microseconds */
|
||||
float ecg; /* Unit is μV */
|
||||
};
|
||||
|
||||
struct sensor_event_ppg /* Type: PPG */
|
||||
{
|
||||
uint64_t timestamp; /* Unit is microseconds */
|
||||
uint32_t ppg; /* Unit is ADC counts */
|
||||
};
|
||||
|
||||
struct sensor_event_impd /* Type: Impedance */
|
||||
{
|
||||
uint64_t timestamp; /* Unit is microseconds */
|
||||
float real; /* Real part, unit is Ohm(Ω) */
|
||||
float imag; /* Imaginary part, unit is Ohm(Ω) */
|
||||
};
|
||||
|
||||
/* The sensor lower half driver interface */
|
||||
|
||||
struct sensor_lowerhalf_s;
|
||||
|
Loading…
Reference in New Issue
Block a user