This is the latest working repository used in our demo video for the Maxim to display temperature readings on Bluetooth

Dependencies:   USBDevice

Committer:
darienf
Date:
Sat Apr 10 03:05:42 2021 +0000
Revision:
3:36de8b9e4b1a
ayoooo

Who changed what in which revision?

UserRevisionLine numberNew contents of line
darienf 3:36de8b9e4b1a 1 //#define CES_DEMO
darienf 3:36de8b9e4b1a 2 using System;
darienf 3:36de8b9e4b1a 3 using System.Collections.Generic;
darienf 3:36de8b9e4b1a 4 using System.Linq;
darienf 3:36de8b9e4b1a 5 using System.Text;
darienf 3:36de8b9e4b1a 6
darienf 3:36de8b9e4b1a 7 using System.Runtime.InteropServices;
darienf 3:36de8b9e4b1a 8
darienf 3:36de8b9e4b1a 9 namespace HealthSensorPlatform
darienf 3:36de8b9e4b1a 10 {
darienf 3:36de8b9e4b1a 11 #if CES_DEMO
darienf 3:36de8b9e4b1a 12 class AlgorithmMobileBU
darienf 3:36de8b9e4b1a 13 {
darienf 3:36de8b9e4b1a 14 // Algorithm from Mobile BU
darienf 3:36de8b9e4b1a 15 public const string DllName = "algo_win.dll";
darienf 3:36de8b9e4b1a 16
darienf 3:36de8b9e4b1a 17 public struct AlgorithmOutput
darienf 3:36de8b9e4b1a 18 {
darienf 3:36de8b9e4b1a 19 public double version;
darienf 3:36de8b9e4b1a 20 public double hr;
darienf 3:36de8b9e4b1a 21 public double spo2;
darienf 3:36de8b9e4b1a 22 public double sigQual;
darienf 3:36de8b9e4b1a 23 public double irAC;
darienf 3:36de8b9e4b1a 24 public double irDC;
darienf 3:36de8b9e4b1a 25 public double redAC;
darienf 3:36de8b9e4b1a 26 public double redDC;
darienf 3:36de8b9e4b1a 27 //#ifdef _ELFI_
darienf 3:36de8b9e4b1a 28 public double acLowPerfusion;
darienf 3:36de8b9e4b1a 29 public double irLEDFlag;
darienf 3:36de8b9e4b1a 30 public double redLEDFlag;
darienf 3:36de8b9e4b1a 31 public double flagNoFinger; //Valid only at the first rest before motion
darienf 3:36de8b9e4b1a 32 public double flagMotion; //is equal to 1 when there is motion
darienf 3:36de8b9e4b1a 33 public double flagHrValid;
darienf 3:36de8b9e4b1a 34 //#endif
darienf 3:36de8b9e4b1a 35 public double hrUpdateFlag;
darienf 3:36de8b9e4b1a 36 public double PA_R;
darienf 3:36de8b9e4b1a 37 public double PA_IR;
darienf 3:36de8b9e4b1a 38 public double PA_V;
darienf 3:36de8b9e4b1a 39 public double ppg; // cetin
darienf 3:36de8b9e4b1a 40 public double raw_without_ppg;
darienf 3:36de8b9e4b1a 41 public double secondary_hr;
darienf 3:36de8b9e4b1a 42 public double secondary_spo2;
darienf 3:36de8b9e4b1a 43 public double source_is_secondary_flag;
darienf 3:36de8b9e4b1a 44 public double raw_ir;
darienf 3:36de8b9e4b1a 45 public double raw_red;
darienf 3:36de8b9e4b1a 46 public double acceleration;
darienf 3:36de8b9e4b1a 47
darienf 3:36de8b9e4b1a 48 public double smoothed_ir;
darienf 3:36de8b9e4b1a 49 public double smoothed_red;
darienf 3:36de8b9e4b1a 50 public double v42Tr;
darienf 3:36de8b9e4b1a 51 public double v60Tr;
darienf 3:36de8b9e4b1a 52 public double R_HR;
darienf 3:36de8b9e4b1a 53 public double IRHR;
darienf 3:36de8b9e4b1a 54 public double R_FO;
darienf 3:36de8b9e4b1a 55 public double IRFO;
darienf 3:36de8b9e4b1a 56 public double Clock;
darienf 3:36de8b9e4b1a 57 public double SysClk;
darienf 3:36de8b9e4b1a 58 public double IR_hrupd;
darienf 3:36de8b9e4b1a 59 public double R_hrupd;
darienf 3:36de8b9e4b1a 60
darienf 3:36de8b9e4b1a 61 public double pulse_average;
darienf 3:36de8b9e4b1a 62 public double pulse_interval;
darienf 3:36de8b9e4b1a 63 public double hrv;
darienf 3:36de8b9e4b1a 64 public double resp_rate;
darienf 3:36de8b9e4b1a 65 public double heartbeats_reported_in_this_touch;
darienf 3:36de8b9e4b1a 66 public double last_reported_heartbeat_rate;
darienf 3:36de8b9e4b1a 67 public double perfusion;
darienf 3:36de8b9e4b1a 68 public double R; // R ratio from SpO2
darienf 3:36de8b9e4b1a 69 };
darienf 3:36de8b9e4b1a 70
darienf 3:36de8b9e4b1a 71 public struct AlgorithmConfiguration
darienf 3:36de8b9e4b1a 72 {
darienf 3:36de8b9e4b1a 73 public sbyte snrNoFingerThreshold; // snr below that threshold will cause flagNoFingerRest to be equal to 1. Valid only at the first few secs rest
darienf 3:36de8b9e4b1a 74 public double acLowPerfusionThreshold; // Threshold for output.acLowPerfusion// Above this threshold flagLowPerfusion == 1
darienf 3:36de8b9e4b1a 75 public int isAGC;
darienf 3:36de8b9e4b1a 76 };
darienf 3:36de8b9e4b1a 77
darienf 3:36de8b9e4b1a 78 /// <summary>
darienf 3:36de8b9e4b1a 79 /// Heart Rate and Pulse Ox algorithm
darienf 3:36de8b9e4b1a 80 /// </summary>
darienf 3:36de8b9e4b1a 81 /// <param name="ir"></param>
darienf 3:36de8b9e4b1a 82 /// <param name="r"></param>
darienf 3:36de8b9e4b1a 83 /// <param name="led"></param>
darienf 3:36de8b9e4b1a 84 /// <param name="acThresh"></param>
darienf 3:36de8b9e4b1a 85 /// <param name="fs"></param>
darienf 3:36de8b9e4b1a 86 /// <param name="isReset"></param>
darienf 3:36de8b9e4b1a 87 /// <param name="accel_x"></param>
darienf 3:36de8b9e4b1a 88 /// <param name="accel_y"></param>
darienf 3:36de8b9e4b1a 89 /// <param name="accel_z"></param>
darienf 3:36de8b9e4b1a 90 /// <param name="inputParameters"></param>
darienf 3:36de8b9e4b1a 91 /// <param name="output"></param>
darienf 3:36de8b9e4b1a 92 /// <returns></returns>
darienf 3:36de8b9e4b1a 93 [DllImport(DllName)]
darienf 3:36de8b9e4b1a 94 public static extern int runAlgorithm_win(int ir, int r, int led, int acThresh, int fs, int isReset,
darienf 3:36de8b9e4b1a 95 float accel_x, float accel_y, float accel_z, ref AlgorithmConfiguration inputParameters, ref AlgorithmOutput output);
darienf 3:36de8b9e4b1a 96 }
darienf 3:36de8b9e4b1a 97 #endif
darienf 3:36de8b9e4b1a 98 }