SI117XDRV 0.1

Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
si117xdrv.c File Reference

SI117XDRV API implementation. More...

`#include "si117xdrv.h"`
`#include <stdbool.h>`
`#include "si117xdrv_config.h"`
`#include "si117x_functions.h"`

Go to the source code of this file.

## Data Structures
struct | SI117XDRV_AccelCallbackData_t
| Accel sync DLE callback function datatype. More...
struct | SI117XDRV_BIOZChannelRegisters_t
struct | SI117XDRV_BioZRegisters_t
struct | SI117XDRV_CallbackData_t
| General callback function datatype. More...
struct | SI117XDRV_Callbacks_t
| Data structure containing all callback info. More...
struct | SI117XDRV_Device_t
struct | SI117XDRV_DeviceRegisters_t
struct | SI117XDRV_DeviceStatus_t
struct | SI117XDRV_ECGRegisters_t
struct | SI117XDRV_FifoQueue_t
| Raw data FIFO queue typedef. More...
struct | SI117XDRV_FifoQueueConfig_t
| Raw data FIFO queue typedef. More...
struct | SI117XDRV_GlobalRegisters_t
struct | SI117XDRV_PPGChannelRegisters_t
struct | SI117XDRV_PPGRegisters_t
struct | si117xFifoStateMachine

## Macros
#define | MEASCOUNT_LSB 20000
#define | MEASCOUNT_MAX 0xff
#define | MEASRATE_MAX 0xffff
#define | MEASRATE_MIN 3
#define | PPG_OFFSET 7
#define | SI117X_FIFO_DEFAULT_FIFO_STATE {SI117x_FIFO_STATE_UNKNOWN,1,0,0,0,0,0,0,0}

## Typedefs
typedef enum si117xFifoState | si117xFifoState_t
typedef struct si117xFifoStateMachine | si117xFifoStateMachine_t
typedef enum si117xFifoStateTaskComplete | si117xFifoStateTaskComplete_t

## Enumerations
enum | si117xFifoState { SI117x_FIFO_STATE_PPG1_HI =0, SI117x_FIFO_STATE_PPG1_MID =1, SI117x_FIFO_STATE_PPG1_LO =2, SI117x_FIFO_STATE_PPG2_HI =3, SI117x_FIFO_STATE_PPG2_MID =4, SI117x_FIFO_STATE_PPG2_LO =5, SI117x_FIFO_STATE_PPG3_HI =6, SI117x_FIFO_STATE_PPG3_MID =7, SI117x_FIFO_STATE_PPG3_LO =8, SI117x_FIFO_STATE_PPG4_HI =9, SI117x_FIFO_STATE_PPG4_MID =10, SI117x_FIFO_STATE_PPG4_LO =11, SI117x_FIFO_STATE_BIOZ1_HI = 12, SI117x_FIFO_STATE_BIOZ1_MID = 13, SI117x_FIFO_STATE_BIOZ1_LO = 14, SI117x_FIFO_STATE_BIOZ2_HI = 15, SI117x_FIFO_STATE_BIOZ2_MID = 16, SI117x_FIFO_STATE_BIOZ2_LO = 17, SI117x_FIFO_STATE_ECG_HI =18, SI117x_FIFO_STATE_ECG_MID =19, SI117x_FIFO_STATE_ECG_LO =20, SI117x_FIFO_STATE_ECG_LD_BYTE1 =21, SI117x_FIFO_STATE_ECG_LD_BYTE2 =22, SI117x_FIFO_STATE_ECG_LD_BYTE3 =23, SI117x_FIFO_STATE_ECG_LD_BYTE4 =24, SI117x_FIFO_STATE_UNKNOWN = 0xff }
enum | si117xFifoStateTaskComplete { SI117x_TASK_NOT_COMPLETE, SI117x_TASK_COMPLETE_PPG, SI117x_TASK_COMPLETE_BIOZ, SI117x_TASK_COMPLETE_ECG, SI117x_TASK_COMPLETE_ECG_LD }

## Functions
static void | accelSyncCallbacks (SI117XDRV_DeviceSelect_t device, uint16_t ppg_count)
| Call accel sync DLE received callback functions.
static bool | findMeasRate (uint16_t freqDivider, uint16_t *measrate, uint8_t *meascount, uint32_t accelSyncus)
static bool | findThreeMeasCount (uint16_t freqDivider1, uint16_t freqDivider2, uint16_t freqDivider3, uint16_t *measrate, uint8_t *meascount1, uint8_t *meascount2, uint8_t *meascount3, uint32_t accelSyncus)
static bool | findTwoMeasCount (uint16_t freqDivider1, uint16_t freqDivider2, uint16_t *measrate, uint8_t *meascount1, uint8_t *meascount2, uint32_t accelSyncus)
static uint16_t | gcd2 (uint16_t n1, uint16_t n2)
static uint16_t | gcd3 (uint16_t n1, uint16_t n2, uint16_t n3)
static void | postFifoFlushCallbacks (SI117XDRV_DeviceSelect_t device)
static void | postStartCallbacks (SI117XDRV_DeviceSelect_t device)
static void | preFifoFlushCallbacks (SI117XDRV_DeviceSelect_t device)
static void | preStartCallbacks (SI117XDRV_DeviceSelect_t device)
static void | resetSynchSampleCounters (SI117XDRV_DeviceSelect_t device)
void | setFifoProcessingValues (int oversampling, uint8_t meas_cntl, uint8_t taskEnable, uint8_t ppg_measconfig0, uint8_t ppg_measconfig1, uint8_t ppg_measconfig2, uint8_t ppg_measconfig3)
Si117x_Ecode_t | SI117XDRV_Allocate24bPPGDataQueue (SI117XDRV_DataQueueID_t *id, SI117XDRV_PPG24bSample_t *queueBuffer, int16_t queueSizeInBytes)
| Allocate a fifo queue for PPG data. More...
Si117x_Ecode_t | SI117XDRV_AllocateECGDataQueue (SI117XDRV_DataQueueID_t *id, SI117XDRV_ECGSample_t *queueBuffer, int16_t queueSizeInBytes)
| Allocate a fifo queue for ECG data. More...
Si117x_Ecode_t | SI117XDRV_AllocateECGLDDataQueue (SI117XDRV_DataQueueID_t *id, SI117XDRV_ECGLDSample_t *queueBuffer, int16_t queueSizeInBytes)
| Allocate a fifo queue for ECG data. More...
Si117x_Ecode_t | SI117XDRV_AllocatePPGDataQueue (SI117XDRV_DataQueueID_t *id, SI117XDRV_PPGSample_t *queueBuffer, int16_t queueSizeInBytes)
| Allocate a fifo queue for 16 bit PPG data. More...
Si117x_Ecode_t | SI117XDRV_ClearQueue (SI117XDRV_DataQueueID_t id)
| Empty a fifo queue. More...
static Si117x_Ecode_t | SI117XDRV_ClearRawQueue (SI117XDRV_FifoQueue_t *queue)
| Empty queue.
Si117x_Ecode_t | SI117XDRV_ClearWristDetection (SI117XDRV_DeviceSelect_t device)
| wrist detection algorithm More...
Si117x_Ecode_t | SI117XDRV_Dequeue24bPPGSampleData (SI117XDRV_DataQueueID_t id, SI117XDRV_PPG24bSample_t *sample)
| Remove a PPG sample from the queue. More...
Si117x_Ecode_t | SI117XDRV_DequeueBIOZSampleData (SI117XDRV_DataQueueID_t id, SI117XDRV_BIOZSample_t *sample)
| Dequeue Si117x bioz sample data.
Si117x_Ecode_t | SI117XDRV_DequeueECGLDSampleData (SI117XDRV_DataQueueID_t id, SI117XDRV_ECGLDSample_t *sample)
| Remove an ECG LD sample from the queue. More...
Si117x_Ecode_t | SI117XDRV_DequeueECGSampleData (SI117XDRV_DataQueueID_t id, SI117XDRV_ECGSample_t *sample)
| Remove an ECG sample from the queue. More...
Si117x_Ecode_t | SI117XDRV_DequeuePPGSampleData (SI117XDRV_DataQueueID_t id, SI117XDRV_PPGSample_t *sample)
| Remove a 16bit PPG sample from the queue. More...
static Si117x_Ecode_t | SI117XDRV_DequeueRawData (SI117XDRV_FifoQueue_t *queue, int8_t *buffer, uint16_t size)
| Dequeue si117x raw data.
static Si117x_Ecode_t | SI117XDRV_EnqueueBIOZSampleData (SI117XDRV_BIOZSample_t *sample)
| Enqueue Si117x bioz sample data.
static Si117x_Ecode_t | SI117XDRV_EnqueueECGLDSampleData (SI117XDRV_ECGLDSample_t *sample)
| Enqueue Si117x ECG LD sample data.
static Si117x_Ecode_t | SI117XDRV_EnqueueECGSampleData (SI117XDRV_ECGSample_t *sample)
| Enqueue Si117x ECG sample data.
static Si117x_Ecode_t | SI117XDRV_EnqueuePPG16bSampleData (SI117XDRV_PPGSample_t *sample)
| Enqueue Si117x 16 bit PPG sample data.
static Si117x_Ecode_t | SI117XDRV_EnqueuePPG24bSampleData (SI117XDRV_PPG24bSample_t *sample)
| Enqueue Si117x PPG sample data.
static Si117x_Ecode_t | SI117XDRV_EnqueueRawData (SI117XDRV_FifoQueue_t *queue, int8_t *inputBuffer, uint16_t size)
| Enqueue Si117x raw data. More...
Si117x_Ecode_t | SI117XDRV_FifoFlush (SI117XDRV_DeviceSelect_t device)
| Flushes the Si117x fifo. More...
Si117x_Ecode_t | SI117XDRV_FifoIntConfig (SI117XDRV_DeviceSelect_t device, bool enable)
| Enable/disable fifo interrupt. More...
Si117x_Ecode_t | SI117XDRV_FreeDataQueue (SI117XDRV_DataQueueID_t id)
| De-allocate a fifo queue. More...
Si117x_Ecode_t | SI117XDRV_GetFifoIntLevel (SI117XDRV_DeviceSelect_t device, uint16_t *fifo_int_level)
| Returns the current fifo interrupt level the Si117x. More...
Si117x_Ecode_t | SI117XDRV_GetPartInfo (SI117XDRV_DeviceSelect_t device, uint8_t *id, uint8_t *rev, uint8_t *mfr_id, uint8_t *pkg_led_cfg)
| Returns the part number read from the Si117x. More...
Si117x_Ecode_t | SI117XDRV_InitAPI (SI117XDRV_DeviceSelect_t device, HANDLE deviceHandle)
| Initializes API memory and device handle. More...
Si117x_Ecode_t | SI117XDRV_InitECG (SI117XDRV_DeviceSelect_t device, SI117XDRV_ECGCfg_t *ecgCfg)
| Configure ECG parameters. More...
Si117x_Ecode_t | SI117XDRV_InitECGLD (SI117XDRV_DeviceSelect_t device, SI117XDRV_ECGLDCfg_t *ecgCfg)
| Configure ECG LD parameters. More...
Si117x_Ecode_t | SI117XDRV_InitGlobal (SI117XDRV_DeviceSelect_t device, SI117XDRV_GlobalCfg_t *globalCfg)
| Configure global Si117x settings. More...
Si117x_Ecode_t | SI117XDRV_InitializeSi117xFifoStateMachine (SI117XDRV_DeviceSelect_t device)
| Initializes the FIFO processing state machine. More...
Si117x_Ecode_t | SI117XDRV_InitPPG (SI117XDRV_DeviceSelect_t device, SI117XDRV_PPGCfg_t *ppgCfg)
| Configure PPG parameters. More...
Si117x_Ecode_t | SI117XDRV_LDIntConfig (SI117XDRV_DeviceSelect_t device, bool enable)
| Enable/disable lead detection interrupt. More...
Si117x_Ecode_t | SI117XDRV_LeadDetection (SI117XDRV_DeviceSelect_t device, bool *leadDetectStatus)
| Lead detection algorithm. More...
static uint16_t | SI117XDRV_NumBytesInQueue (SI117XDRV_FifoQueue_t *queue)
| Get number of bytes in queue.
uint16_t | SI117XDRV_NumSamplesInQueue (SI117XDRV_DataQueueID_t id)
| Get number of samples in the queue. More...
Si117x_Ecode_t | SI117XDRV_PPG1IntConfig (SI117XDRV_DeviceSelect_t device, bool enable)
| Enable/disable PPG interrupt. More...
Si117x_Ecode_t | SI117XDRV_ProcessFifoData (SI117XDRV_DeviceSelect_t device, uint8_t *record, uint16_t fifo_length, uint16_t timestamp, uint16_t irqSequence)
| FIFO interrupt handler. More...
Si117x_Ecode_t | SI117XDRV_ProcessLDInterrupt (SI117XDRV_DeviceSelect_t device)
| lead detection interrupt handler More...
Si117x_Ecode_t | SI117XDRV_ProcessPPGInterrupt (SI117XDRV_DeviceSelect_t device, uint8_t *fifoData, uint16_t timestamp, uint16_t irqSequence)
| PPG1 interrupt handler. More...
Si117x_Ecode_t | SI117XDRV_ProcessWDInterrupt (SI117XDRV_DeviceSelect_t device)
| wrist detection interrupt handler More...
Si117x_Ecode_t | SI117XDRV_RegisterAccelSyncCallback (SI117XDRV_DeviceSelect_t device, SI117XDRV_AccelCallback_t callback, void *user)
| Register an accelerometer sync message callback. More...
Si117x_Ecode_t | SI117XDRV_RegisterPostFifoFlushCallback (SI117XDRV_DeviceSelect_t device, SI117XDRV_Callback_t callback, void *user)
| Register a post fifo flush callback. More...
Si117x_Ecode_t | SI117XDRV_RegisterPostStartCallback (SI117XDRV_DeviceSelect_t device, SI117XDRV_Callback_t callback, void *user)
| Register a post start callback. More...
Si117x_Ecode_t | SI117XDRV_RegisterPreFifoFlushCallback (SI117XDRV_DeviceSelect_t device, SI117XDRV_Callback_t callback, void *user)
| Register a pre fifo flush callback. More...
Si117x_Ecode_t | SI117XDRV_RegisterPreStartCallback (SI117XDRV_DeviceSelect_t device, SI117XDRV_Callback_t callback, void *user)
| Register a pre start callback. More...
Si117x_Ecode_t | SI117XDRV_Reset (SI117XDRV_DeviceSelect_t device)
| Resets the Si117x. More...
Si117x_Ecode_t | SI117XDRV_SetECGTaskEnable (SI117XDRV_DeviceSelect_t device, uint8_t ecgTasks)
| Configure ECG tasks. More...
Si117x_Ecode_t | SI117XDRV_SetPPGTaskEnable (SI117XDRV_DeviceSelect_t device, uint8_t ppgTasks)
| Configure PPG tasks. More...
Si117x_Ecode_t | SI117XDRV_Start (SI117XDRV_DeviceSelect_t device)
| Start running measurements with the current configuration. More...
Si117x_Ecode_t | SI117XDRV_StartLegacyPPG (SI117XDRV_DeviceSelect_t device, uint8_t ppg_meascount, uint16_t measrate)
| Start legacy PPG mode (ECG & BIOZ will be disabled before start) This function overwrites some configuration settings which are then restored in the accompanying Stop function. More...
Si117x_Ecode_t | SI117XDRV_Stop (SI117XDRV_DeviceSelect_t device)
| Stop running measurements in the Si117x. More...
Si117x_Ecode_t | SI117XDRV_StopLegacyPPG (SI117XDRV_DeviceSelect_t device)
| Stop legacy PPG mode (restores ECG & BIOZ tasks as previously set) More...
Si117x_Ecode_t | SI117XDRV_WDIntConfig (SI117XDRV_DeviceSelect_t device, bool enable)
| Enable/disable wrist detection interrupt. More...
Si117x_Ecode_t | SI117XDRV_WristDetection (SI117XDRV_DeviceSelect_t device, bool *wristDetectStatus)
| wrist detection algorithm More...
static int16_t | si117xFifoStateMachine_Next (SI117XDRV_DeviceSelect_t device, uint8_t isDle, uint8_t dleDataByte, si117xFifoStateTaskComplete_t *taskComplete)

## Variables
static SI117XDRV_Callbacks_t | callbacks [SI117XDRV_MAX_NUM_DEVICES]
static SI117XDRV_Device_t | devices [SI117XDRV_MAX_NUM_DEVICES]
static uint8_t | DLE_S_tag
static si117xFifoStateMachine_t | fifoStateMachines [SI117XDRV_MAX_NUM_DEVICES]
static uint8_t | found_DLE_S =0
static int | initFlag [SI117XDRV_MAX_NUM_DEVICES] = { 0 }
static bool | leadDetect [SI117XDRV_MAX_NUM_DEVICES]
static bool | leadDetectionFlag [SI117XDRV_MAX_NUM_DEVICES]
static uint16_t | ppg1_sample_count [SI117XDRV_MAX_NUM_DEVICES]
static uint16_t | ppg2_sample_count [SI117XDRV_MAX_NUM_DEVICES]
static uint16_t | ppg3_sample_count [SI117XDRV_MAX_NUM_DEVICES]
static uint16_t | ppg4_sample_count [SI117XDRV_MAX_NUM_DEVICES]
static uint16_t | ppg_count
static SI117XDRV_FifoQueueConfig_t | queues [SI117XDRV_MAX_DATA_QUEUES]
static bool | Unprocessed_DLE =false
static bool | Unprocessed_DLE_S =false
static bool | wristDetectionFlag [SI117XDRV_MAX_NUM_DEVICES]

## Detailed Description

SI117XDRV API implementation.

Version
  5.2.2

# License

Copyright 2017 Silicon Laboratories, Inc, http://www.silabs.com

This file is licensed under the Silabs License Agreement. See the file "Silabs_License_Agreement.txt" for details. Before using this software for any purpose, you must agree to the terms of that agreement.

Definition in file si117xdrv.c.

## Typedef Documentation

## ◆ si117xFifoState_t

typedef enum si117xFifoState si117xFifoState_t

Fifo/Interrupt Processing functions

## Enumeration Type Documentation

## ◆ si117xFifoState

enum si117xFifoState

Fifo/Interrupt Processing functions

Definition at line 2035 of file si117xdrv.c.

## Function Documentation

## ◆ SI117XDRV_Allocate24bPPGDataQueue()

Si117x_Ecode_t SI117XDRV_Allocate24bPPGDataQueue | ( | SI117XDRV_DataQueueID_t * | id,
|  | SI117XDRV_PPG24bSample_t * | queueBuffer,
|  | int16_t | queueSizeInBytes
| ) |  |

Allocate a fifo queue for PPG data.

Parameters

  [in] | pointer | to queue ID
  [in] | pointer | to buffer to use for fifo queue
  [in] | queue | buffer size in bytes

Returns
  Si117XDRV error code

Definition at line 1357 of file si117xdrv.c.

References ECODE_SI117XDRV_ALL_QUEUES_USED.

## ◆ SI117XDRV_AllocateECGDataQueue()

Si117x_Ecode_t SI117XDRV_AllocateECGDataQueue | ( | SI117XDRV_DataQueueID_t * | id,
|  | SI117XDRV_ECGSample_t * | queueBuffer,
|  | int16_t | queueSizeInBytes
| ) |  |

Allocate a fifo queue for ECG data.

Parameters

  [in] | pointer | to queue ID
  [in] | pointer | to buffer to use for fifo queue
  [in] | queue | buffer size in bytes

Returns
  Si117XDRV error code

Definition at line 1409 of file si117xdrv.c.

References ECODE_SI117XDRV_ALL_QUEUES_USED.

## ◆ SI117XDRV_AllocateECGLDDataQueue()

Si117x_Ecode_t SI117XDRV_AllocateECGLDDataQueue | ( | SI117XDRV_DataQueueID_t * | id,
|  | SI117XDRV_ECGLDSample_t * | queueBuffer,
|  | int16_t | queueSizeInBytes
| ) |  |

Allocate a fifo queue for ECG data.

Parameters

  [in] | pointer | to queue ID
  [in] | pointer | to buffer to use for fifo queue
  [in] | queue | buffer size in bytes

Returns
  Si117XDRV error code

Definition at line 1461 of file si117xdrv.c.

References ECODE_SI117XDRV_ALL_QUEUES_USED.

## ◆ SI117XDRV_AllocatePPGDataQueue()

Si117x_Ecode_t SI117XDRV_AllocatePPGDataQueue | ( | SI117XDRV_DataQueueID_t * | id,
|  | SI117XDRV_PPGSample_t * | queueBuffer,
|  | int16_t | queueSizeInBytes
| ) |  |

Allocate a fifo queue for 16 bit PPG data.

Parameters

  [in] | pointer | to queue ID
  [in] | pointer | to buffer to use for fifo queue
  [in] | queue | buffer size in bytes

Returns
  Si117XDRV error code

Definition at line 1306 of file si117xdrv.c.

References ECODE_SI117XDRV_ALL_QUEUES_USED.

## ◆ SI117XDRV_ClearQueue()

Si117x_Ecode_t SI117XDRV_ClearQueue | ( | SI117XDRV_DataQueueID_t | id | ) |

Empty a fifo queue.

Parameters

  [in] | queue | ID

Returns
  Si117XDRV error code

Definition at line 1543 of file si117xdrv.c.

References SI117XDRV_ClearRawQueue().

## ◆ SI117XDRV_ClearWristDetection()

Si117x_Ecode_t SI117XDRV_ClearWristDetection | ( | SI117XDRV_DeviceSelect_t | device | ) |

wrist detection algorithm

Parameters

  [in] | device | select ID
  [in] | pointer | bool to indicate wrist detection status

Returns
  Si117XDRV error code

Definition at line 1994 of file si117xdrv.c.

## ◆ SI117XDRV_Dequeue24bPPGSampleData()

Si117x_Ecode_t SI117XDRV_Dequeue24bPPGSampleData | ( | SI117XDRV_DataQueueID_t | id,
|  | SI117XDRV_PPG24bSample_t * | sample
| ) |  |

Remove a PPG sample from the queue.

Parameters

  [in] | queue | ID
  [in] | pointer | to sample

Returns
  Si117XDRV error code

Definition at line 1719 of file si117xdrv.c.

References SI117XDRV_PPG24bSample_t::ppg1, SI117XDRV_PPG24bSample_t::ppg2, SI117XDRV_PPG24bSample_t::ppg3, SI117XDRV_PPG24bSample_t::ppg4, SI117XDRV_PPG24bSample_t::sequence, SI117XDRV_DequeueRawData(), SI117XDRV_PPG_24BIT_SAMPLE_SIZE_BYTES, SI117XDRV_PPG24bSample_t::syncMessage, and SI117XDRV_PPG24bSample_t::timestamp.

## ◆ SI117XDRV_DequeueECGLDSampleData()

Si117x_Ecode_t SI117XDRV_DequeueECGLDSampleData | ( | SI117XDRV_DataQueueID_t | id,
|  | SI117XDRV_ECGLDSample_t * | sample
| ) |  |

Remove an ECG LD sample from the queue.

Parameters

  [in] | queue | ID
  [in] | pointer | to ECG LD sample

Returns
  Si117XDRV error code

Definition at line 1855 of file si117xdrv.c.

References SI117XDRV_ECGLDSample_t::data, SI117XDRV_ECGLDSample_t::sequence, SI117XDRV_DequeueRawData(), SI117XDRV_ECG_LD_SAMPLE_SIZE_BYTES, SI117XDRV_ECGLDSample_t::syncMessage, and SI117XDRV_ECGLDSample_t::timestamp.

## ◆ SI117XDRV_DequeueECGSampleData()

Si117x_Ecode_t SI117XDRV_DequeueECGSampleData | ( | SI117XDRV_DataQueueID_t | id,
|  | SI117XDRV_ECGSample_t * | sample
| ) |  |

Remove an ECG sample from the queue.

Parameters

  [in] | queue | ID
  [in] | pointer | to ECG sample

Returns
  Si117XDRV error code

Definition at line 1887 of file si117xdrv.c.

References SI117XDRV_ECGSample_t::ecg, SI117XDRV_ECGSample_t::sequence, SI117XDRV_DequeueRawData(), SI117XDRV_ECG_SAMPLE_SIZE_BYTES, SI117XDRV_ECGSample_t::syncMessage, and SI117XDRV_ECGSample_t::timestamp.

## ◆ SI117XDRV_DequeuePPGSampleData()

Si117x_Ecode_t SI117XDRV_DequeuePPGSampleData | ( | SI117XDRV_DataQueueID_t | id,
|  | SI117XDRV_PPGSample_t * | sample
| ) |  |

Remove a 16bit PPG sample from the queue.

Parameters

  [in] | queue | ID
  [in] | pointer | to sample

Returns
  Si117XDRV error code

Definition at line 1753 of file si117xdrv.c.

References SI117XDRV_PPGSample_t::ppg1, SI117XDRV_PPGSample_t::ppg2, SI117XDRV_PPGSample_t::ppg3, SI117XDRV_PPGSample_t::ppg4, SI117XDRV_PPGSample_t::sequence, SI117XDRV_DequeueRawData(), SI117XDRV_PPG_SAMPLE_SIZE_BYTES, SI117XDRV_PPGSample_t::syncMessage, and SI117XDRV_PPGSample_t::timestamp.

## ◆ SI117XDRV_EnqueueRawData()

static Si117x_Ecode_t SI117XDRV_EnqueueRawData | ( | SI117XDRV_FifoQueue_t * | queue,
|  | int8_t * | inputBuffer,
|  | uint16_t | size
| ) |  |
| static

Enqueue Si117x raw data.

Static functions

Definition at line 1553 of file si117xdrv.c.

References ECODE_SI117XDRV_OK, ECODE_SI117XDRV_QUEUE_FULL, SI117XDRV_FifoQueue_t::fifo, SI117XDRV_FifoQueue_t::head, SI117XDRV_FifoQueue_t::size, SI117XDRV_FifoQueue_t::tail, and SI117XDRV_FifoQueue_t::used.

Referenced by SI117XDRV_EnqueueECGLDSampleData(), SI117XDRV_EnqueueECGSampleData(), SI117XDRV_EnqueuePPG16bSampleData(), and SI117XDRV_EnqueuePPG24bSampleData().

## ◆ SI117XDRV_FifoFlush()

Si117x_Ecode_t SI117XDRV_FifoFlush | ( | SI117XDRV_DeviceSelect_t | device | ) |

Flushes the Si117x fifo.

Parameters

  [in] | device | select ID

Returns
  Si117XDRV error code

Definition at line 231 of file si117xdrv.c.

## ◆ SI117XDRV_FifoIntConfig()

Si117x_Ecode_t SI117XDRV_FifoIntConfig | ( | SI117XDRV_DeviceSelect_t | device,
|  | bool | enable
| ) |  |

Enable/disable fifo interrupt.

Parameters

  [in] | device | select ID
  [in] | Set | enable to true to enable interrupt

Returns
  Si117XDRV error code

Definition at line 523 of file si117xdrv.c.

## ◆ SI117XDRV_FreeDataQueue()

Si117x_Ecode_t SI117XDRV_FreeDataQueue | ( | SI117XDRV_DataQueueID_t | id | ) |

De-allocate a fifo queue.

Parameters

  [in] | queue | ID

Returns
  Si117XDRV error code

Definition at line 1509 of file si117xdrv.c.

References ECODE_SI117XDRV_OK, and ECODE_SI117XDRV_PARAM_ERROR.

## ◆ SI117XDRV_GetFifoIntLevel()

Si117x_Ecode_t SI117XDRV_GetFifoIntLevel | ( | SI117XDRV_DeviceSelect_t | device,
|  | uint16_t * | fifo_int_level
| ) |  |

Returns the current fifo interrupt level the Si117x.

Parameters

  [in] | device | select ID
  [in] | pointer | to uint16_t store the fifo level

Returns
  Si117XDRV error code

Definition at line 346 of file si117xdrv.c.

References ECODE_SI117XDRV_OK.

## ◆ SI117XDRV_GetPartInfo()

Si117x_Ecode_t SI117XDRV_GetPartInfo | ( | SI117XDRV_DeviceSelect_t | device,
|  | uint8_t * | id,
|  | uint8_t * | rev,
|  | uint8_t * | mfr_id,
|  | uint8_t * | pkg_led_cfg
| ) |  |

Returns the part number read from the Si117x.

Parameters

  [in] | device | select ID
  [in] | pointer | to byte to store part id

Returns
  Si117XDRV error code

Definition at line 322 of file si117xdrv.c.

## ◆ SI117XDRV_InitAPI()

Si117x_Ecode_t SI117XDRV_InitAPI | ( | SI117XDRV_DeviceSelect_t | device,
|  | HANDLE | deviceHandle
| ) |  |

Initializes API memory and device handle.

Parameters

  [in] | device | select ID
  [in] | device | handle to pass to low level functions

Returns
  Si117XDRV error code

Definition at line 1067 of file si117xdrv.c.

References SI117XDRV_CallbackData_t::allocated.

## ◆ SI117XDRV_InitECG()

Si117x_Ecode_t SI117XDRV_InitECG | ( | SI117XDRV_DeviceSelect_t | device,
|  | SI117XDRV_ECGCfg_t * | ecgCfg
| ) |  |

Configure ECG parameters.

Parameters

  [in] | device | select ID
  [in] | pointer | to ECG configuration structure

Returns
  Si117XDRV error code

Definition at line 363 of file si117xdrv.c.

## ◆ SI117XDRV_InitECGLD()

Si117x_Ecode_t SI117XDRV_InitECGLD | ( | SI117XDRV_DeviceSelect_t | device,
|  | SI117XDRV_ECGLDCfg_t * | ecgCfg
| ) |  |

Configure ECG LD parameters.

Parameters

  [in] | device | select ID
  [in] | pointer | to ECG LD configuration structure

Returns
  Si117XDRV error code

Definition at line 393 of file si117xdrv.c.

## ◆ SI117XDRV_InitGlobal()

Si117x_Ecode_t SI117XDRV_InitGlobal | ( | SI117XDRV_DeviceSelect_t | device,
|  | SI117XDRV_GlobalCfg_t * | globalCfg
| ) |  |

Configure global Si117x settings.

Parameters

  [in] | device | select ID
  [in] | pointer | to global configuration structure

Returns
  Si117XDRV error code

Definition at line 887 of file si117xdrv.c.

## ◆ SI117XDRV_InitializeSi117xFifoStateMachine()

Si117x_Ecode_t SI117XDRV_InitializeSi117xFifoStateMachine | ( | SI117XDRV_DeviceSelect_t | device | ) |

Initializes the FIFO processing state machine.

Parameters

  [in] | device | select ID

Returns
  Si117XDRV error code

Definition at line 2131 of file si117xdrv.c.

## ◆ SI117XDRV_InitPPG()

Si117x_Ecode_t SI117XDRV_InitPPG | ( | SI117XDRV_DeviceSelect_t | device,
|  | SI117XDRV_PPGCfg_t * | ppgCfg
| ) |  |

Configure PPG parameters.

Parameters

  [in] | device | select ID
  [in] | pointer | to PPG configuration structure

Returns
  Si117XDRV error code

Definition at line 422 of file si117xdrv.c.

## ◆ SI117XDRV_LDIntConfig()

Si117x_Ecode_t SI117XDRV_LDIntConfig | ( | SI117XDRV_DeviceSelect_t | device,
|  | bool | enable
| ) |  |

Enable/disable lead detection interrupt.

Parameters

  [in] | device | select ID
  [in] | Set | enable to true to enable interrupt

Returns
  Si117XDRV error code

Definition at line 577 of file si117xdrv.c.

## ◆ SI117XDRV_LeadDetection()

Si117x_Ecode_t SI117XDRV_LeadDetection | ( | SI117XDRV_DeviceSelect_t | device,
|  | bool * | leadDetectStatus
| ) |  |

Lead detection algorithm.

Parameters

  [in] | device | select ID
  [in] | pointer | bool to indicate lead detection status

Returns
  Si117XDRV error code

Definition at line 1936 of file si117xdrv.c.

## ◆ SI117XDRV_NumSamplesInQueue()

uint16_t SI117XDRV_NumSamplesInQueue | ( | SI117XDRV_DataQueueID_t | id | ) |

Get number of samples in the queue.

Parameters

  [in] | queue | ID

Returns
  Si117XDRV error code

Definition at line 1620 of file si117xdrv.c.

References SI117XDRV_NumBytesInQueue().

## ◆ SI117XDRV_PPG1IntConfig()

Si117x_Ecode_t SI117XDRV_PPG1IntConfig | ( | SI117XDRV_DeviceSelect_t | device,
|  | bool | enable
| ) |  |

Enable/disable PPG interrupt.

Parameters

  [in] | device | select ID
  [in] | Set | enable to true to enable interrupt

Returns
  Si117XDRV error code

Definition at line 550 of file si117xdrv.c.

## ◆ SI117XDRV_ProcessFifoData()

Si117x_Ecode_t SI117XDRV_ProcessFifoData | ( | SI117XDRV_DeviceSelect_t | device,
|  | uint8_t * | record,
|  | uint16_t | fifo_length,
|  | uint16_t | timestamp,
|  | uint16_t | irqSequence
| ) |  |

FIFO interrupt handler.

Parameters

  [in] | device | select ID
  [in] | pointer | fifo data read from the sensor
  [in] | number | of bytes read from fifo
  [in] | 16 | bit timestamp of interrupt occurrance
  [in] | irq | sequence number

Returns
  Si117XDRV error code

Definition at line 2230 of file si117xdrv.c.

References ECODE_SI117XDRV_OK, and Unprocessed_DLE.

## ◆ SI117XDRV_ProcessLDInterrupt()

Si117x_Ecode_t SI117XDRV_ProcessLDInterrupt | ( | SI117XDRV_DeviceSelect_t | device | ) |

lead detection interrupt handler

Parameters

  [in] | device | select ID

Returns
  Si117XDRV error code

Definition at line 2009 of file si117xdrv.c.

## ◆ SI117XDRV_ProcessPPGInterrupt()

Si117x_Ecode_t SI117XDRV_ProcessPPGInterrupt | ( | SI117XDRV_DeviceSelect_t | device,
|  | uint8_t * | fifoData,
|  | uint16_t | timestamp,
|  | uint16_t | irqSequence
| ) |  |

PPG1 interrupt handler.

Parameters

  [in] | device | select ID
  [in] | pointer | fifo data read from the sensor
  [in] | 16 | bit timestamp of interrupt occurance
  [in] | irq | sequence number

Returns
  Si117XDRV error code

Definition at line 2163 of file si117xdrv.c.

References SI117XDRV_PPG24bSample_t::ppg1, SI117XDRV_PPGSample_t::ppg1, SI117XDRV_PPG24bSample_t::ppg2, SI117XDRV_PPGSample_t::ppg2, SI117XDRV_PPG24bSample_t::ppg3, SI117XDRV_PPGSample_t::ppg3, SI117XDRV_PPG24bSample_t::ppg4, SI117XDRV_PPGSample_t::ppg4, SI117XDRV_PPG24bSample_t::sequence, SI117XDRV_PPGSample_t::sequence, SI117XDRV_EnqueuePPG16bSampleData(), SI117XDRV_EnqueuePPG24bSampleData(), SI117XDRV_PPG24bSample_t::syncMessage, SI117XDRV_PPGSample_t::syncMessage, SI117XDRV_PPG24bSample_t::timestamp, and SI117XDRV_PPGSample_t::timestamp.

## ◆ SI117XDRV_ProcessWDInterrupt()

Si117x_Ecode_t SI117XDRV_ProcessWDInterrupt | ( | SI117XDRV_DeviceSelect_t | device | ) |

wrist detection interrupt handler

Parameters

  [in] | device | select ID

Returns
  Si117XDRV error code

Definition at line 2024 of file si117xdrv.c.

## ◆ SI117XDRV_RegisterAccelSyncCallback()

Si117x_Ecode_t SI117XDRV_RegisterAccelSyncCallback | ( | SI117XDRV_DeviceSelect_t | device,
|  | SI117XDRV_AccelCallback_t | callback,
|  | void * | user
| ) |  |

Register an accelerometer sync message callback.

Parameters

  [in] | device | select ID
  [in] | callback | function pointer
  [in] | user | parameter to pass to callback function

Returns
  Si117XDRV error code

Definition at line 1099 of file si117xdrv.c.

References SI117XDRV_AccelCallbackData_t::allocated, SI117XDRV_AccelCallbackData_t::callback, ECODE_SI117XDRV_ALL_CB_USED, ECODE_SI117XDRV_OK, and SI117XDRV_AccelCallbackData_t::user.

## ◆ SI117XDRV_RegisterPostFifoFlushCallback()

Si117x_Ecode_t SI117XDRV_RegisterPostFifoFlushCallback | ( | SI117XDRV_DeviceSelect_t | device,
|  | SI117XDRV_Callback_t | callback,
|  | void * | user
| ) |  |

Register a post fifo flush callback.

Parameters

  [in] | device | select ID
  [in] | callback | function pointer
  [in] | user | parameter to pass to callback function

Returns
  Si117XDRV error code

Definition at line 1234 of file si117xdrv.c.

## ◆ SI117XDRV_RegisterPostStartCallback()

Si117x_Ecode_t SI117XDRV_RegisterPostStartCallback | ( | SI117XDRV_DeviceSelect_t | device,
|  | SI117XDRV_Callback_t | callback,
|  | void * | user
| ) |  |

Register a post start callback.

Parameters

  [in] | device | select ID
  [in] | callback | function pointer
  [in] | user | parameter to pass to callback function

Returns
  Si117XDRV error code

Definition at line 1167 of file si117xdrv.c.

## ◆ SI117XDRV_RegisterPreFifoFlushCallback()

Si117x_Ecode_t SI117XDRV_RegisterPreFifoFlushCallback | ( | SI117XDRV_DeviceSelect_t | device,
|  | SI117XDRV_Callback_t | callback,
|  | void * | user
| ) |  |

Register a pre fifo flush callback.

Parameters

  [in] | device | select ID
  [in] | callback | function pointer
  [in] | user | parameter to pass to callback function

Returns
  Si117XDRV error code

Definition at line 1201 of file si117xdrv.c.

## ◆ SI117XDRV_RegisterPreStartCallback()

Si117x_Ecode_t SI117XDRV_RegisterPreStartCallback | ( | SI117XDRV_DeviceSelect_t | device,
|  | SI117XDRV_Callback_t | callback,
|  | void * | user
| ) |  |

Register a pre start callback.

Parameters

  [in] | device | select ID
  [in] | callback | function pointer
  [in] | user | parameter to pass to callback function

Returns
  Si117XDRV error code

Definition at line 1133 of file si117xdrv.c.

## ◆ SI117XDRV_Reset()

Si117x_Ecode_t SI117XDRV_Reset | ( | SI117XDRV_DeviceSelect_t | device | ) |

Resets the Si117x.

Parameters

  [in] | device | select ID

Returns
  Si117XDRV error code

Definition at line 249 of file si117xdrv.c.

## ◆ SI117XDRV_SetECGTaskEnable()

Si117x_Ecode_t SI117XDRV_SetECGTaskEnable | ( | SI117XDRV_DeviceSelect_t | device,
|  | uint8_t | ecgTasks
| ) |  |

Configure ECG tasks.

Parameters

  [in] | device | select ID
  [in] | task | enable bits for ECG

Returns
  Si117XDRV error code

Definition at line 495 of file si117xdrv.c.

## ◆ SI117XDRV_SetPPGTaskEnable()

Si117x_Ecode_t SI117XDRV_SetPPGTaskEnable | ( | SI117XDRV_DeviceSelect_t | device,
|  | uint8_t | ppgTasks
| ) |  |

Configure PPG tasks.

Parameters

  [in] | device | select ID
  [in] | task | enable bits for PPG

Returns
  Si117XDRV error code

Definition at line 466 of file si117xdrv.c.

## ◆ SI117XDRV_Start()

Si117x_Ecode_t SI117XDRV_Start | ( | SI117XDRV_DeviceSelect_t | device | ) |

Start running measurements with the current configuration.

Parameters

  [in] | device | select ID

Returns
  Si117XDRV error code

Definition at line 745 of file si117xdrv.c.

## ◆ SI117XDRV_StartLegacyPPG()

Si117x_Ecode_t SI117XDRV_StartLegacyPPG | ( | SI117XDRV_DeviceSelect_t | device,
|  | uint8_t | ppg_meascount,
|  | uint16_t | measrate
| ) |  |

Start legacy PPG mode (ECG & BIOZ will be disabled before start) This function overwrites some configuration settings which are then restored in the accompanying Stop function.

Parameters

  [in] | device | select ID
  [in] | ppg_meascount | value to use (overwrites any current setting)
  [in] | measrate | value to use (overwrites any current setting)

Returns
  Si117XDRV error code

Definition at line 636 of file si117xdrv.c.

## ◆ SI117XDRV_Stop()

Si117x_Ecode_t SI117XDRV_Stop | ( | SI117XDRV_DeviceSelect_t | device | ) |

Stop running measurements in the Si117x.

Parameters

  [in] | device | select ID

Returns
  Si117XDRV error code

Definition at line 719 of file si117xdrv.c.

## ◆ SI117XDRV_StopLegacyPPG()

Si117x_Ecode_t SI117XDRV_StopLegacyPPG | ( | SI117XDRV_DeviceSelect_t | device | ) |

Stop legacy PPG mode (restores ECG & BIOZ tasks as previously set)

Parameters

  [in] | device | select ID

Returns
  Si117XDRV error code

Definition at line 682 of file si117xdrv.c.

## ◆ SI117XDRV_WDIntConfig()

Si117x_Ecode_t SI117XDRV_WDIntConfig | ( | SI117XDRV_DeviceSelect_t | device,
|  | bool | enable
| ) |  |

Enable/disable wrist detection interrupt.

Parameters

  [in] | device | select ID
  [in] | Set | enable to true to enable interrupt

Returns
  Si117XDRV error code

Definition at line 604 of file si117xdrv.c.

## ◆ SI117XDRV_WristDetection()

Si117x_Ecode_t SI117XDRV_WristDetection | ( | SI117XDRV_DeviceSelect_t | device,
|  | bool * | wristDetectStatus
| ) |  |

wrist detection algorithm

Parameters

  [in] | device | select ID
  [in] | pointer | bool to indicate wrist detection status

Returns
  Si117XDRV error code

Definition at line 1977 of file si117xdrv.c.

## Variable Documentation

## ◆ devices

SI117XDRV_Device_t devices[SI117XDRV_MAX_NUM_DEVICES]
| static

Static variables

Definition at line 154 of file si117xdrv.c.