SI117XDRV 0.1

Data Structures | Macros | Typedefs | Enumerations | Functions
si117xdrv.h File Reference

Driver for Si117x. More...

`#include <stdint.h>`
`#include <stdbool.h>`
`#include "si117x_types.h"`
`#include "si117xdrv_config.h"`

Go to the source code of this file.

## Data Structures
struct | SI117XDRV_BIOZSample_t
| bioz sample data typedef More...
struct | SI117XDRV_ECGCfg_t
| Si117XDRV ECG configuration. More...
struct | SI117XDRV_ECGLDCfg_t
| Si117XDRV ECG LD configuration. More...
struct | SI117XDRV_ECGLDSample_t
| ECG sample data typedef. More...
struct | SI117XDRV_ECGSample_t
| ECG sample data typedef. More...
struct | SI117XDRV_GlobalCfg_t
| Si117x global configuration. More...
struct | SI117XDRV_PPG24bSample_t
| PPG sample data typedef. More...
struct | SI117XDRV_PPGCfg_t
| Si117XDRV PPG configuration. More...
struct | SI117XDRV_PPGChannelCfg_t
| Si117XDRV one PPG channel configuration. More...
struct | SI117XDRV_PPGSample_t
| PPG 16bit sample data typedef. Use this data type to save memory. More...

## Macros
#define | ECODE_SI117XDRV_ALL_CB_USED -8
| All callbacks used.
#define | ECODE_SI117XDRV_ALL_QUEUES_USED -3
| No more queues left.
#define | ECODE_SI117XDRV_NOT_RUNNING -7
| Si117x is not running.
#define | ECODE_SI117XDRV_OK 0
| Success return value. //dlc: It is my opinion that these should be SI117XDRV_ECODE_....
#define | ECODE_SI117XDRV_PARAM_ERROR -4
| Invalid parameter.
#define | ECODE_SI117XDRV_QUEUE_EMPTY -2
| Fifo queue empty.
#define | ECODE_SI117XDRV_QUEUE_FULL -1
| Fifo queue full.
#define | ECODE_SI117XDRV_QUEUE_SIZE_ERROR -5
| Invalid queue size.
#define | ECODE_SI117XDRV_RUNNING -6
| Si117x is already running.
#define | ECODE_SI117XDRV_UNINITIALIZED -9
| All callbacks used.
#define | NULL 0
#define | SI117XDRV_BIOZ_SAMPLE_SIZE_BYTES 9
| BIOZ sample size in bytes.
#define | SI117XDRV_DEFAULT_ECG_CFG
| Si117x default ecg configuration. More...
#define | SI117XDRV_DEFAULT_ECG_LD_CFG
| Si117x default ecg ld configuration. More...
#define | SI117XDRV_DEFAULT_GLOBAL_CFG
| Si117x default global configuration. More...
#define | SI117XDRV_DEFAULT_PPG_CFG
| Si117x default ppg configuration. More...
#define | SI117XDRV_DEFAULT_PPG_CHANNEL_CFG
| Si117x default one channel ppg configuration. More...
#define | SI117XDRV_ECG_LD_SAMPLE_SIZE_BYTES 9
| ECG LD sample size in bytes.
#define | SI117XDRV_ECG_SAMPLE_SIZE_BYTES 9
| ECG sample size in bytes.
#define | SI117XDRV_IRQ_EN_FIFO (1<<0)
| Fifo irq enable bit.
#define | SI117XDRV_IRQ_EN_LD (1<<3)
| Lead detect irq enable bit.
#define | SI117XDRV_IRQ_EN_PPG1 (1<<1)
| Legacy PPG irq enable bit.
#define | SI117XDRV_IRQ_EN_WD (1<<2)
| Wrist detect irq enable bit.
#define | SI117XDRV_PPG_24BIT_SAMPLE_SIZE_BYTES 21
| PPG sample size in bytes.
#define | SI117XDRV_PPG_SAMPLE_SIZE_BYTES 13
| PPG 16 bit sample size in bytes.
#define | SI117XDRV_TASK_BIOZ1_AC_EN (1<<4)
| BIOZ AC task enable bit.
#define | SI117XDRV_TASK_BIOZ_DC_EN (1<<5)
| BIOZ DC task enable bit.
#define | SI117XDRV_TASK_ECG_EN (1<<6)
| ECG task enable bit.
#define | SI117XDRV_TASK_ECG_LD_EN (1<<7)
| ECG LD task enable bit.
#define | SI117XDRV_TASK_PPG1_EN (1<<0)
| PPG1 task enable bit.
#define | SI117XDRV_TASK_PPG2_EN (1<<1)
| PPG2 task enable bit.
#define | SI117XDRV_TASK_PPG3_EN (1<<2)
| PPG3 task enable bit.
#define | SI117XDRV_TASK_PPG4_EN (1<<3)
| PPG4 task enable bit.
#define | SI117XDRV_UNINITIALIZED_QUEUE_ID 0xffff
| Invalid queue ID for init code.

## Typedefs
typedef int32_t | Si117x_Ecode_t
| SI117XDRV error code.
typedef void(* | SI117XDRV_AccelCallback_t) (SI117XDRV_DeviceSelect_t device, uint16_t ppgCount, void *user)
| Typedef for accel sync DLE message received event. More...
typedef void(* | SI117XDRV_Callback_t) (SI117XDRV_DeviceSelect_t device, void *user)
| Typedef for the user supplied callback function which is called when a specific event happens. More...
typedef uint32_t | SI117XDRV_DataQueueID_t
| Queue ID.
typedef uint32_t | SI117XDRV_DeviceSelect_t
| Device ID.

## Enumerations
enum | SI117XDRV_MSPolar_t { MSPolarHighLowHigh = 0, MSPolarLowHighLow = 1 }
| MS pin polarity setting. More...
enum | SI117XDRV_SampleSize_t { sample16bit = 0, sample24bit = 1 }
| Sample size settings. More...
enum | SI117XDRV_SynchMode_t { SynchModeNone = 0, SynchModeAccel = 1, SynchModeTriggerIn = 2, SynchModeTriggerOut = 3, SynchModeSi117xMaster = 4, SynchModeSi117xSlave = 5 }
| Sync configuration settings. More...

## Functions
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...
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_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...
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 *ecgldCfg)
| 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...
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 *fifoData, 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 ecgTask)
| 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...

## Detailed Description

Driver for Si117x.

Version
  0.0.1

# License

Copyright 2017 Silicon Labs, 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.h.

## Macro Definition Documentation

## ◆ SI117XDRV_DEFAULT_ECG_CFG

#define SI117XDRV_DEFAULT_ECG_CFG

Value:
{ 0 , \
0x8, \
0, \
}

Si117x default ecg configuration.

Definition at line 193 of file si117xdrv.h.

## ◆ SI117XDRV_DEFAULT_ECG_LD_CFG

#define SI117XDRV_DEFAULT_ECG_LD_CFG

Value:
{ 0 , \
0, \
0, \
}

Si117x default ecg ld configuration.

Definition at line 200 of file si117xdrv.h.

## ◆ SI117XDRV_DEFAULT_GLOBAL_CFG

#define SI117XDRV_DEFAULT_GLOBAL_CFG

Value:
{ 5000 , \
5000, \
0, \
0, \
0, \
128, \
0, \
false, \
false, \
SynchModeNone, \
MSPolarHighLowHigh, \
sample16bit, \
sample24bit, \
sample16bit, \
0, \
0 \
}

Si117x default global configuration.

Definition at line 159 of file si117xdrv.h.

## ◆ SI117XDRV_DEFAULT_PPG_CFG

#define SI117XDRV_DEFAULT_PPG_CFG

Value:
{ 0 , \
{SI117XDRV_DEFAULT_PPG_CHANNEL_CFG, \
SI117XDRV_DEFAULT_PPG_CHANNEL_CFG, \
SI117XDRV_DEFAULT_PPG_CHANNEL_CFG, \
SI117XDRV_DEFAULT_PPG_CHANNEL_CFG} \
}
SI117XDRV_DEFAULT_PPG_CHANNEL_CFG
#define SI117XDRV_DEFAULT_PPG_CHANNEL_CFG
Si117x default one channel ppg configuration.
Definition: si117xdrv.h:219

Si117x default ppg configuration.

Definition at line 237 of file si117xdrv.h.

## ◆ SI117XDRV_DEFAULT_PPG_CHANNEL_CFG

#define SI117XDRV_DEFAULT_PPG_CHANNEL_CFG

Value:
{ 0 , \
0, \
0, \
0, \
0xf, \
0x3, \
0x30, \
}

Si117x default one channel ppg configuration.

Definition at line 219 of file si117xdrv.h.

## Typedef Documentation

## ◆ SI117XDRV_AccelCallback_t

typedef void(* SI117XDRV_AccelCallback_t) (SI117XDRV_DeviceSelect_t device, uint16_t ppgCount, void *user)

Typedef for accel sync DLE message received event.

The callback function is called when a accel sync DLE message is received in the fifo data.

Parameters

  [in] | device | The device
  [in] | ppgCount | Number of ppg samples received since last DLE message
  [in] | user | Extra parameter for user application

Definition at line 281 of file si117xdrv.h.

## ◆ SI117XDRV_Callback_t

typedef void(* SI117XDRV_Callback_t) (SI117XDRV_DeviceSelect_t device, void *user)

Typedef for the user supplied callback function which is called when a specific event happens.

Parameters

  [in] | device | The device.
  [in] | user | Extra parameter for user application.

Definition at line 262 of file si117xdrv.h.

## Enumeration Type Documentation

## ◆ SI117XDRV_MSPolar_t

enum SI117XDRV_MSPolar_t

MS pin polarity setting.

Enumerator
MSPolarHighLowHigh | high-low-high
MSPolarLowHighLow | low-high-low

Definition at line 119 of file si117xdrv.h.

## ◆ SI117XDRV_SampleSize_t

enum SI117XDRV_SampleSize_t

Sample size settings.

Enumerator
sample16bit | 16 bit data
sample24bit | 24 bit data

Definition at line 103 of file si117xdrv.h.

## ◆ SI117XDRV_SynchMode_t

enum SI117XDRV_SynchMode_t

Sync configuration settings.

Enumerator
SynchModeNone | None.
SynchModeAccel | Accelerometer.
SynchModeTriggerIn | Trigger in.
SynchModeTriggerOut | Trigger out.
SynchModeSi117xMaster | master
SynchModeSi117xSlave | slave

Definition at line 109 of file si117xdrv.h.

## 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.

Data Fifo Queue Functions

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_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.

Low level control functions - use these to allow driver to keep track of current config. Device configuration functions

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

Fifo/Interrupt Processing functions

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.

API configuration functions

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.

Device control functions

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.