PebbleOS v4.47.0-512-g5285d4236
Loading...
Searching...
No Matches

Heart rate monitor implementation for the Goodix GH3x2x sensors. More...

Data Structures

struct  HRMDevice
 GH3x2x device. More...
 

Macros

#define HRM_PPG_CH_NUM   6
 Number of PPG channels.
 
#define HRM_PPG_FACTORY_TEST_FIFO_LEN   80
 Samples per channel averaged by the factory tests.
 

Enumerations

enum  GH3x2xFTType { HRM_FACTORY_TEST_NONE , HRM_FACTORY_TEST_CTR , HRM_FACTORY_TEST_LIGHT_LEAK , HRM_FACTORY_TEST_HSM }
 Factory test type. More...
 

Functions

bool gh3x2x_ble_data_recv (void *context)
 Queue tuning protocol data received over BLE for processing on the background work queue.
 
void gh3x2x_wear_evt_notify (bool is_wear)
 Report the wear detection state.
 
void gh3x2x_rawdata_notify (uint32_t *p_rawdata, uint32_t data_count)
 Feed raw PPG data to the factory tests.
 
void gh3x2x_start_ft_ctr (void)
 Start the CTR factory test on the background work queue.
 
void gh3x2x_start_ft_leakage (void)
 Start the light leakage factory test on the background work queue.
 
void gh3x2x_factory_test_disable ()
 Stop the running factory test on the background work queue.
 
void gh3x2x_set_work_mode (int32_t mode)
 Set the sampling functions used when the sensor is next enabled.
 

Detailed Description

Heart rate monitor implementation for the Goodix GH3x2x sensors.

Also exposes the hooks used by the vendor library and the manufacturing tests.


Data Structure Documentation

◆ HRMDevice

struct HRMDevice

GH3x2x device.

QEMU HRM device.

Data Fields
const struct pbl_i2c_dev * i2c Sensor I2C port.
struct pbl_gpio int_input Sensor interrupt line, as an input.
struct pbl_irq_spec int_irq Sensor interrupt line.
struct pbl_gpio reset Sensor reset line, optional.
HRMDeviceState * state Driver runtime state.

Macro Definition Documentation

◆ HRM_PPG_CH_NUM

#define HRM_PPG_CH_NUM   6

Number of PPG channels.

◆ HRM_PPG_FACTORY_TEST_FIFO_LEN

#define HRM_PPG_FACTORY_TEST_FIFO_LEN   80

Samples per channel averaged by the factory tests.

Enumeration Type Documentation

◆ GH3x2xFTType

Factory test type.

Enumerator
HRM_FACTORY_TEST_NONE 

No test.

HRM_FACTORY_TEST_CTR 

CTR (LED-to-sensor coupling) test.

HRM_FACTORY_TEST_LIGHT_LEAK 

Light leakage test.

HRM_FACTORY_TEST_HSM 

Noise test.

Function Documentation

◆ gh3x2x_ble_data_recv()

bool gh3x2x_ble_data_recv ( void *  context)

Queue tuning protocol data received over BLE for processing on the background work queue.

Only with CONFIG_BT_SERVICE_GH3X2X_TUNING.

Parameters
contextHeap buffer holding a 32-bit length followed by the data; freed once processed.
Returns
True if queued.

◆ gh3x2x_factory_test_disable()

void gh3x2x_factory_test_disable ( )

Stop the running factory test on the background work queue.

Requires CONFIG_HRM_GH3X2X_FACTORY_TEST.

◆ gh3x2x_rawdata_notify()

void gh3x2x_rawdata_notify ( uint32_t *  p_rawdata,
uint32_t  data_count 
)

Feed raw PPG data to the factory tests.

Does nothing unless a factory test is running (CONFIG_HRM_GH3X2X_FACTORY_TEST only).

Parameters
p_rawdataRaw samples, interleaved over HRM_PPG_CH_NUM channels.
data_countNumber of values in p_rawdata.

◆ gh3x2x_set_work_mode()

void gh3x2x_set_work_mode ( int32_t  mode)

Set the sampling functions used when the sensor is next enabled.

Soft wear detection is always added. Requires CONFIG_HRM_GH3X2X_FACTORY_TEST.

Parameters
modeBitmask of GH3X2X_FUNCTION_* values.

◆ gh3x2x_start_ft_ctr()

void gh3x2x_start_ft_ctr ( void  )

Start the CTR factory test on the background work queue.

Results are reported through the HRM manager as HRMFeature_CTR data. Requires CONFIG_HRM_GH3X2X_FACTORY_TEST.

◆ gh3x2x_start_ft_leakage()

void gh3x2x_start_ft_leakage ( void  )

Start the light leakage factory test on the background work queue.

Results are reported through the HRM manager as HRMFeature_Leakage data. Requires CONFIG_HRM_GH3X2X_FACTORY_TEST.

◆ gh3x2x_wear_evt_notify()

void gh3x2x_wear_evt_notify ( bool  is_wear)

Report the wear detection state.

Parameters
is_wearTrue if the watch is worn.