Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed MAX14720 MAX30205 USBDevice
PaceChannel.cs
00001 /******************************************************************************* 00002 * Copyright (C) 2016 Maxim Integrated Products, Inc., All rights Reserved. 00003 * 00004 * This software is protected by copyright laws of the United States and 00005 * of foreign countries. This material may also be protected by patent laws 00006 * and technology transfer regulations of the United States and of foreign 00007 * countries. This software is furnished under a license agreement and/or a 00008 * nondisclosure agreement and may only be used or reproduced in accordance 00009 * with the terms of those agreements. Dissemination of this information to 00010 * any party or parties not specified in the license agreement and/or 00011 * nondisclosure agreement is expressly prohibited. 00012 * 00013 * The above copyright notice and this permission notice shall be included 00014 * in all copies or substantial portions of the Software. 00015 * 00016 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00017 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00018 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00019 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES 00020 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 00021 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 00022 * OTHER DEALINGS IN THE SOFTWARE. 00023 * 00024 * Except as contained in this notice, the name of Maxim Integrated 00025 * Products, Inc. shall not be used except as stated in the Maxim Integrated 00026 * Products, Inc. Branding Policy. 00027 * 00028 * The mere transfer of this software does not imply any licenses 00029 * of trade secrets, proprietary technology, copyrights, patents, 00030 * trademarks, maskwork rights, or any other form of intellectual 00031 * property whatsoever. Maxim Integrated Products, Inc. retains all 00032 * ownership rights. 00033 ******************************************************************************* 00034 */ 00035 00036 using System; 00037 using System.Collections.Generic; 00038 using System.Linq; 00039 using System.Text; 00040 00041 namespace HealthSensorPlatform 00042 { 00043 00044 public partial class HspForm 00045 { 00046 List<RegisterField> paceChannelField = new List<RegisterField>(); 00047 00048 void initalizePaceChannelFields() 00049 { 00050 // Pace Channel 00051 string[] aoutLbwOptions = { "Max (~100 kHz)*", "Limited (16 kHz)" }; 00052 string[] aoutOptions = { "Disabled*", "INA Output", "PGA Output", "Pace Input" }; 00053 string[] polOptions = { "Non-Inverted*", "Inverted" }; 00054 string[] gainOptions = { "540 / 50.625 / 202.50*", 00055 "270 / 50.625 / 101.25", 00056 "240 / 22.5 / 90", 00057 "120 / 22.5 / 45", 00058 " 60 / 5.625 / 22.5", 00059 " 30 / 5.625 / 11.25", 00060 " 26.4 / 5.625 / 22.5", 00061 " 13.2 / 5.625 / 11.25" 00062 }; 00063 string[] gnDiffOffOptions = { "Differentiator*", "Sample and Hold" }; 00064 string[] dacpOptions = new string[16]; 00065 for (int i = 0; i < dacpOptions.Length; i++) 00066 { 00067 dacpOptions[i] = (22.5 * i).ToString() + " mV"; 00068 } 00069 dacpOptions[5] += "*"; 00070 string[] dacnOptions = new string[16]; 00071 for (int i = 0; i < dacnOptions.Length; i++) 00072 { 00073 dacnOptions[i] = (-22.5 * i).ToString() + " mV"; 00074 } 00075 dacnOptions[5] += "*"; 00076 00077 //RegisterField rateField = new RegisterField { Name = "BIOZ_RATE", Register = 0x18, Index = 23, Width = 1, Descriptions = rateOptions, Label = lblBioZSampleRate, Control = cboBioZSampleRate }; 00078 RegisterField polField = new RegisterField { Name = "PACE_POL", Register = 0x1A, Index = 23, Width = 1, Descriptions = polOptions, Label = lblPaceInputPolarity, Control = cboPaceInputPolarity, Device = max30001 }; 00079 RegisterField gnDiffOffField = new RegisterField { Name = "PACE_GN_DIFF_OFF", Register = 0x1A, Index = 19, Width = 1, Descriptions = gnDiffOffOptions, Label = lblPaceDifferentiatorMode, Control = cboPaceDifferentiatorMode, Device = max30001 }; 00080 RegisterField gainField = new RegisterField { Name = "PACE_GAIN", Register = 0x1A, Index = 16, Width = 3, Descriptions = gainOptions, Label = lblPaceChannelGain, Control = cboPaceChannelGain, Device = max30001 }; 00081 RegisterField aoutLbwField = new RegisterField { Name = "PACE_AOUT_LBW", Register = 0x1A, Index = 14, Width = 1, Descriptions = aoutLbwOptions, Label = lblPaceBufferBandwidth, Control = cboPaceBufferBandwidth, Device = max30001 }; 00082 RegisterField aoutField = new RegisterField { Name = "PACE_AOUT", Register = 0x1A, Index = 12, Width = 2, Descriptions = aoutOptions, Label = lblPaceSignalSelection, Control = cboPaceSignalSelection, Device = max30001 }; 00083 RegisterField dacpField = new RegisterField { Name = "PACE_DACP", Register = 0x1A, Index = 4, Width = 4, Descriptions = dacpOptions, Label = lblPaceDetectorPostiveThreshold, Control = cboPaceDetectorPostiveThreshold, Device = max30001 }; 00084 RegisterField dacnField = new RegisterField { Name = "PACE_DACN", Register = 0x1A, Index = 0, Width = 4, Descriptions = dacnOptions, Label = lblPaceDetectorNegativeThreshold, Control = cboPaceDetectorNegativeThreshold, Device = max30001 }; 00085 paceChannelField.Add(polField); 00086 paceChannelField.Add(gnDiffOffField); 00087 paceChannelField.Add(gainField); 00088 paceChannelField.Add(aoutLbwField); 00089 paceChannelField.Add(aoutField); 00090 paceChannelField.Add(dacpField); 00091 paceChannelField.Add(dacnField); 00092 00093 // BioZ Channel 00094 string[] aHpfOptions = { "250 Hz", "500 Hz", "1000 Hz*", "2000 Hz", "4000 Hz", "8000 Hz", "Bypass" }; 00095 RegisterField aHpfField = new RegisterField { Name = "BIOZ_AHPF", Register = 0x18, Index = 20, Width = 3, Descriptions = aHpfOptions, Label = lblPaceAnalogHpf, Control = cboPaceAnalogHpf, Device = max30001 }; 00096 paceChannelField.Add(aHpfField); 00097 } 00098 00099 void PaceChannelUpdateRegisters() 00100 { 00101 internalUpdate = true; 00102 ReadComboBoxesRegisters(paceChannelField); 00103 internalUpdate = false; 00104 } 00105 00106 private CustomControls.InitArgs.PACEInitStart getPaceArgs() 00107 { 00108 CustomControls.InitArgs.PACEInitStart paceArgs = new CustomControls.InitArgs.PACEInitStart(); 00109 00110 paceArgs.En_pace = chkEnPace.Checked == true ? 1 : 0; 00111 paceArgs.Clr_pedge = 0; // TODO default from jerry 00112 paceArgs.Pol = cboPaceInputPolarity.SelectedIndex; 00113 paceArgs.Gn_diff_off = cboPaceDifferentiatorMode.SelectedIndex; 00114 paceArgs.Gain = cboPaceChannelGain.SelectedIndex; 00115 paceArgs.Aout_lbw = cboPaceBufferBandwidth.SelectedIndex; 00116 paceArgs.Aout = cboPaceSignalSelection.SelectedIndex; 00117 paceArgs.Dacp = cboPaceDetectorPostiveThreshold.SelectedIndex; 00118 paceArgs.Dacn = cboPaceDetectorNegativeThreshold.SelectedIndex; 00119 00120 return paceArgs; 00121 } 00122 00123 private void setPaceArgs(CustomControls.InitArgs.PACEInitStart paceArgs) 00124 { 00125 //paceArgs.En_pace = chkEnPace.Checked == true ? 1 : 0; 00126 //paceArgs.Clr_pedge = 0; // TODO default from jerry 00127 cboPaceInputPolarity.SelectedIndex = paceArgs.Pol; 00128 cboPaceDifferentiatorMode.SelectedIndex = paceArgs.Gn_diff_off; 00129 cboPaceChannelGain.SelectedIndex = paceArgs.Gain; 00130 cboPaceBufferBandwidth.SelectedIndex = paceArgs.Aout_lbw; 00131 cboPaceSignalSelection.SelectedIndex = paceArgs.Aout; 00132 cboPaceDetectorPostiveThreshold.SelectedIndex = paceArgs.Dacp; 00133 cboPaceDetectorNegativeThreshold.SelectedIndex = paceArgs.Dacn; 00134 } 00135 } 00136 }
Generated on Thu Jul 28 2022 18:07:15 by
1.7.2