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 /*******************************************************************************
darienf 3:36de8b9e4b1a 2 * Copyright (C) 2016 Maxim Integrated Products, Inc., All rights Reserved.
darienf 3:36de8b9e4b1a 3 *
darienf 3:36de8b9e4b1a 4 * This software is protected by copyright laws of the United States and
darienf 3:36de8b9e4b1a 5 * of foreign countries. This material may also be protected by patent laws
darienf 3:36de8b9e4b1a 6 * and technology transfer regulations of the United States and of foreign
darienf 3:36de8b9e4b1a 7 * countries. This software is furnished under a license agreement and/or a
darienf 3:36de8b9e4b1a 8 * nondisclosure agreement and may only be used or reproduced in accordance
darienf 3:36de8b9e4b1a 9 * with the terms of those agreements. Dissemination of this information to
darienf 3:36de8b9e4b1a 10 * any party or parties not specified in the license agreement and/or
darienf 3:36de8b9e4b1a 11 * nondisclosure agreement is expressly prohibited.
darienf 3:36de8b9e4b1a 12 *
darienf 3:36de8b9e4b1a 13 * The above copyright notice and this permission notice shall be included
darienf 3:36de8b9e4b1a 14 * in all copies or substantial portions of the Software.
darienf 3:36de8b9e4b1a 15 *
darienf 3:36de8b9e4b1a 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
darienf 3:36de8b9e4b1a 17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
darienf 3:36de8b9e4b1a 18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
darienf 3:36de8b9e4b1a 19 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
darienf 3:36de8b9e4b1a 20 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
darienf 3:36de8b9e4b1a 21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
darienf 3:36de8b9e4b1a 22 * OTHER DEALINGS IN THE SOFTWARE.
darienf 3:36de8b9e4b1a 23 *
darienf 3:36de8b9e4b1a 24 * Except as contained in this notice, the name of Maxim Integrated
darienf 3:36de8b9e4b1a 25 * Products, Inc. shall not be used except as stated in the Maxim Integrated
darienf 3:36de8b9e4b1a 26 * Products, Inc. Branding Policy.
darienf 3:36de8b9e4b1a 27 *
darienf 3:36de8b9e4b1a 28 * The mere transfer of this software does not imply any licenses
darienf 3:36de8b9e4b1a 29 * of trade secrets, proprietary technology, copyrights, patents,
darienf 3:36de8b9e4b1a 30 * trademarks, maskwork rights, or any other form of intellectual
darienf 3:36de8b9e4b1a 31 * property whatsoever. Maxim Integrated Products, Inc. retains all
darienf 3:36de8b9e4b1a 32 * ownership rights.
darienf 3:36de8b9e4b1a 33 *******************************************************************************
darienf 3:36de8b9e4b1a 34 */
darienf 3:36de8b9e4b1a 35
darienf 3:36de8b9e4b1a 36 using System;
darienf 3:36de8b9e4b1a 37 using System.Collections.Generic;
darienf 3:36de8b9e4b1a 38 using System.ComponentModel;
darienf 3:36de8b9e4b1a 39 using System.Data;
darienf 3:36de8b9e4b1a 40 using System.Drawing;
darienf 3:36de8b9e4b1a 41 using System.Linq;
darienf 3:36de8b9e4b1a 42 using System.Text;
darienf 3:36de8b9e4b1a 43 using System.Windows.Forms;
darienf 3:36de8b9e4b1a 44
darienf 3:36de8b9e4b1a 45 namespace HealthSensorPlatform
darienf 3:36de8b9e4b1a 46 {
darienf 3:36de8b9e4b1a 47 // Code for ECG Configuration Tab
darienf 3:36de8b9e4b1a 48 public partial class HspForm
darienf 3:36de8b9e4b1a 49 {
darienf 3:36de8b9e4b1a 50 List<RegisterField> ecgChannelField = new List<RegisterField>();
darienf 3:36de8b9e4b1a 51 List<RegisterField> ecgGlobalField = new List<RegisterField>();
darienf 3:36de8b9e4b1a 52 List<RegisterField> rToRField = new List<RegisterField>();
darienf 3:36de8b9e4b1a 53
darienf 3:36de8b9e4b1a 54 List<RegisterField> channelEnableField = new List<RegisterField>();
darienf 3:36de8b9e4b1a 55
darienf 3:36de8b9e4b1a 56 // Needed for dynamic changing of options
darienf 3:36de8b9e4b1a 57 RegisterField ecgSampleRateField;
darienf 3:36de8b9e4b1a 58 RegisterField ecgDlpfField;
darienf 3:36de8b9e4b1a 59
darienf 3:36de8b9e4b1a 60 string[][] ecgSampleRateOptions = new string[][]
darienf 3:36de8b9e4b1a 61 {
darienf 3:36de8b9e4b1a 62 new string[] { "512 sps", "256 sps", "128 sps*" },
darienf 3:36de8b9e4b1a 63 new string[] { "500 sps", "250 sps", "125 sps*" },
darienf 3:36de8b9e4b1a 64 new string[] { "N/A", "N/A", "200 sps*" },
darienf 3:36de8b9e4b1a 65 new string[] { "N/A", "N/A", "199.8 sps*" }
darienf 3:36de8b9e4b1a 66 };
darienf 3:36de8b9e4b1a 67
darienf 3:36de8b9e4b1a 68 double[][] ecgSampleRates = new double[][]
darienf 3:36de8b9e4b1a 69 {
darienf 3:36de8b9e4b1a 70 new double[] {512, 256, 128, 128},
darienf 3:36de8b9e4b1a 71 new double[] {500, 250, 125, 125},
darienf 3:36de8b9e4b1a 72 new double[] {200, 200, 200, 200},
darienf 3:36de8b9e4b1a 73 new double[] {199.8, 199.8, 199.8, 199.8} // using 200, the error is 0.1%
darienf 3:36de8b9e4b1a 74 };
darienf 3:36de8b9e4b1a 75
darienf 3:36de8b9e4b1a 76 string[][][] ecgDlpfOptions;
darienf 3:36de8b9e4b1a 77
darienf 3:36de8b9e4b1a 78
darienf 3:36de8b9e4b1a 79 void initalizeECGConfigFields()
darienf 3:36de8b9e4b1a 80 {
darienf 3:36de8b9e4b1a 81 ecgDlpfOptions = new string[4][][];
darienf 3:36de8b9e4b1a 82
darienf 3:36de8b9e4b1a 83 for (int i = 0; i < 4; i++)
darienf 3:36de8b9e4b1a 84 {
darienf 3:36de8b9e4b1a 85 ecgDlpfOptions[i] = new string[4][];
darienf 3:36de8b9e4b1a 86 }
darienf 3:36de8b9e4b1a 87
darienf 3:36de8b9e4b1a 88 // 32768 Hz
darienf 3:36de8b9e4b1a 89 ecgDlpfOptions[0][0] = new string[] {"Bypass (00)", "40.96 Hz (01)*", "102.4 Hz (10)", "153.6 Hz (11)"};
darienf 3:36de8b9e4b1a 90 ecgDlpfOptions[0][1] = new string[] {"Bypass (00)", "40.96 Hz (01)*", "102.4 Hz (10)"};//, "40.96 Hz (11)"};
darienf 3:36de8b9e4b1a 91 ecgDlpfOptions[0][2] = new string[] {"Bypass (00)", "40.96 Hz (01)*"}; //, "40.96 Hz (10)", "40.96 Hz (11)"};
darienf 3:36de8b9e4b1a 92 ecgDlpfOptions[0][3] = new string[] {"Bypass (00)", "40.96 Hz (01)*"}; //, "40.96 Hz (10)", "40.96 Hz (11)"};
darienf 3:36de8b9e4b1a 93 // 32000 Hz
darienf 3:36de8b9e4b1a 94 ecgDlpfOptions[1][0] = new string[] { "Bypass (00)", "40.00 Hz (01)*", "100.0 Hz (10)", "150.0 Hz (11)"};
darienf 3:36de8b9e4b1a 95 ecgDlpfOptions[1][1] = new string[] {"Bypass (00)", "40.00 Hz (01)*", "100.0 Hz (10)"}; //, "40.00 Hz (11)"};
darienf 3:36de8b9e4b1a 96 ecgDlpfOptions[1][2] = new string[] {"Bypass (00)", "40.00 Hz (01)*"}; //, "40.00 Hz (10)", "40.00 Hz (11)"};
darienf 3:36de8b9e4b1a 97 ecgDlpfOptions[1][3] = new string[] {"Bypass (00)", "40.00 Hz (01)*"}; //, "40.00 Hz (10)", "40.00 Hz (11)"};
darienf 3:36de8b9e4b1a 98 //32000 Hz
darienf 3:36de8b9e4b1a 99 ecgDlpfOptions[2][0] = new string[] { "Bypass", "40.00 Hz"}; //, "40.00 Hz", "40.00 Hz" };
darienf 3:36de8b9e4b1a 100 ecgDlpfOptions[2][1] = new string[] { "Bypass", "40.00 Hz"}; //, "40.00 Hz", "40.00 Hz" };
darienf 3:36de8b9e4b1a 101 ecgDlpfOptions[2][2] = new string[] { "Bypass", "40.00 Hz"}; //, "40.00 Hz", "40.00 Hz" };
darienf 3:36de8b9e4b1a 102 ecgDlpfOptions[2][3] = new string[] { "Bypass", "40.00 Hz"}; //, "40.00 Hz", "40.00 Hz" };
darienf 3:36de8b9e4b1a 103 // 31968 Hz
darienf 3:36de8b9e4b1a 104 ecgDlpfOptions[3][0] = new string[] { "Bypass (00)", "39.96 Hz (01)" }; //, "39.96 Hz (10)", "39.96 Hz (11)" };
darienf 3:36de8b9e4b1a 105 ecgDlpfOptions[3][1] = new string[] { "Bypass", "39.96 Hz"}; //, "39.96 Hz", "39.96 Hz" };
darienf 3:36de8b9e4b1a 106 ecgDlpfOptions[3][2] = new string[] { "Bypass", "39.96 Hz"};//, "39.96 Hz", "39.96 Hz" };
darienf 3:36de8b9e4b1a 107 ecgDlpfOptions[3][3] = new string[] { "Bypass", "39.96 Hz"};//, "39.96 Hz", "39.96 Hz" };
darienf 3:36de8b9e4b1a 108
darienf 3:36de8b9e4b1a 109 string[] fastOptions = { "Normal*", "Manual Fast Recovery", "Automatic Fast Recovery" };
darienf 3:36de8b9e4b1a 110 string[] fastThOptions = new string[64];
darienf 3:36de8b9e4b1a 111 for (int i = 0; i < 64; i++)
darienf 3:36de8b9e4b1a 112 {
darienf 3:36de8b9e4b1a 113 fastThOptions[i] = i.ToString() + " * 2048 LSB";
darienf 3:36de8b9e4b1a 114 }
darienf 3:36de8b9e4b1a 115 fastThOptions[0x3F] += "*"; // Default option
darienf 3:36de8b9e4b1a 116
darienf 3:36de8b9e4b1a 117 string[] channelGainOptions = { "20 V/V*", "40 V/V", "80 V/V", "160 V/V" };
darienf 3:36de8b9e4b1a 118
darienf 3:36de8b9e4b1a 119 //string[] sampleRateOptions = { "512 sps", "256 sps", "128 sps*"}; // Assume FMSTR = 32768 Hz
darienf 3:36de8b9e4b1a 120
darienf 3:36de8b9e4b1a 121 string[] dlpfOptions = { "Bypass", "40.96 Hz*", "102.4 Hz", "153.6 Hz" };
darienf 3:36de8b9e4b1a 122 string[] dhpfOptions = { "Bypass", "0.50 Hz*" };
darienf 3:36de8b9e4b1a 123
darienf 3:36de8b9e4b1a 124 RegisterField fastField = new RegisterField { Name = "FAST", Register = 5, Index = 22, Width = 2, Descriptions = fastOptions, Label = lblFast, Control = cboFast, Device = max30001};
darienf 3:36de8b9e4b1a 125 RegisterField fastThField = new RegisterField { Name = "FAST_TH", Register = 5, Index = 16, Width = 6, Descriptions = fastThOptions, Label = lblFastTh, Control = cboFastTh, Device = max30001};
darienf 3:36de8b9e4b1a 126 ecgChannelField.Add(fastField);
darienf 3:36de8b9e4b1a 127 ecgChannelField.Add(fastThField);
darienf 3:36de8b9e4b1a 128
darienf 3:36de8b9e4b1a 129 RegisterField channelGainField = new RegisterField { Name = "ECG_GAIN", Register = 0x15, Index = 16, Width = 2, Descriptions = channelGainOptions, Label = lblChannelGain, Control = cboChannelGain, Device = max30001};
darienf 3:36de8b9e4b1a 130 ecgChannelField.Add(channelGainField);
darienf 3:36de8b9e4b1a 131
darienf 3:36de8b9e4b1a 132 ecgSampleRateField = new RegisterField { Name = "ECG_RATE", Register = 0x15, Index = 22, Width = 2, Descriptions = ecgSampleRateOptions[0], Label = lblSampleRate, Control = cboSampleRate, Device = max30001};
darienf 3:36de8b9e4b1a 133 ecgChannelField.Add(ecgSampleRateField);
darienf 3:36de8b9e4b1a 134
darienf 3:36de8b9e4b1a 135 ecgDlpfField = new RegisterField { Name = "ECG_DLPF", Register = 0x15, Index = 12, Width = 2, Descriptions = dlpfOptions, Label = lblDlpf, Control = cboDlpf, Device = max30001};
darienf 3:36de8b9e4b1a 136 RegisterField dhpfField = new RegisterField { Name = "ECG_DHPF", Register = 0x15, Index = 14, Width = 1, Descriptions = dhpfOptions, Label = lblDhpf, Control = cboDhpf, Device = max30001};
darienf 3:36de8b9e4b1a 137 ecgChannelField.Add(ecgDlpfField);
darienf 3:36de8b9e4b1a 138 ecgChannelField.Add(dhpfField);
darienf 3:36de8b9e4b1a 139 }
darienf 3:36de8b9e4b1a 140
darienf 3:36de8b9e4b1a 141 void initalizeECGGlobalControls()
darienf 3:36de8b9e4b1a 142 {
darienf 3:36de8b9e4b1a 143 string[] fmstrDescription = { "32768 Hz (00)*", "32000 Hz (01)", "32000 Hz (10)", "31968 Hz (11)" };
darienf 3:36de8b9e4b1a 144 string[] enECGDescription = { "Disabled*", "Enabled" };
darienf 3:36de8b9e4b1a 145
darienf 3:36de8b9e4b1a 146 RegisterField fmstrField = new RegisterField { Name = "FMSTR", Register = 0x10, Index = 20, Width = 2, Descriptions = fmstrDescription, Control = cboMasterClock, Device = max30001};
darienf 3:36de8b9e4b1a 147 ecgGlobalField.Add(fmstrField);
darienf 3:36de8b9e4b1a 148
darienf 3:36de8b9e4b1a 149 //RegisterField enECGField = new RegisterField { Name = "EN_ECG", Register = 0x10, Index = 19, Width = 1, Descriptions = enECGDescription, Label = lblECGChannelEnable };
darienf 3:36de8b9e4b1a 150 //enECGField.Control = cboECGChannelEnable;
darienf 3:36de8b9e4b1a 151 //ecgGlobalField.Add(enECGField);
darienf 3:36de8b9e4b1a 152 RegisterField enECGField = new RegisterField { Name = "EN_ECG", Register = 0x10, Index = 19, Width = 1, Control = chkEnECG, Device = max30001};
darienf 3:36de8b9e4b1a 153 RegisterField enBioZField = new RegisterField { Name = "EN_BIOZ", Register = 0x10, Index = 18, Width = 1, Control = chkEnBioZ, Device = max30001};
darienf 3:36de8b9e4b1a 154 RegisterField enPaceField = new RegisterField { Name = "EN_PACE", Register = 0x10, Index = 17, Width = 1, Control = chkEnPace, Device = max30001};
darienf 3:36de8b9e4b1a 155 RegisterField enRtorField = new RegisterField { Name = "EN_RTOR", Register = 0x1d, Index = 15, Width = 1, Control = chkEnRtor, Device = max30001};
darienf 3:36de8b9e4b1a 156 channelEnableField.Add(enECGField);
darienf 3:36de8b9e4b1a 157 channelEnableField.Add(enBioZField);
darienf 3:36de8b9e4b1a 158 channelEnableField.Add(enPaceField);
darienf 3:36de8b9e4b1a 159 channelEnableField.Add(enRtorField);
darienf 3:36de8b9e4b1a 160 }
darienf 3:36de8b9e4b1a 161
darienf 3:36de8b9e4b1a 162 void initalizeRToRFields()
darienf 3:36de8b9e4b1a 163 {
darienf 3:36de8b9e4b1a 164 string[] wndwOptions = {"6 * 8ms", "8 * 8ms", "10 * 8ms", "12 * 8ms*", "14 * 8ms", "16 * 8ms", "18 * 8ms", "20 * 8ms",
darienf 3:36de8b9e4b1a 165 "22 * 8ms", "24 * 8ms", "26 * 8ms", "28 * 8ms"};
darienf 3:36de8b9e4b1a 166 string[] gainOptions = { "1", "2", "4", "8", "16", "32", "64", "128", "256", "512", "1024", "2048", "4096", "8192", "16384", "Auto-Scale*" };
darienf 3:36de8b9e4b1a 167 string[] enableOptions = { "Disable*", "Enable" };
darienf 3:36de8b9e4b1a 168 string[] pavgOptions = { "2", "4", "8*", "16" };
darienf 3:36de8b9e4b1a 169 string[] ptsfOptions = { "1/16", "2/16", "3/16", "4/16*", "5/16", "6/16", "7/16", "8/16",
darienf 3:36de8b9e4b1a 170 "9/16", "10/16", "11/16", "12/16", "13/16", "14/16", "15/16", "16/16"};
darienf 3:36de8b9e4b1a 171 string[] hoffOptions = new string[64];
darienf 3:36de8b9e4b1a 172 for(int i = 0; i < 64; i ++)
darienf 3:36de8b9e4b1a 173 {
darienf 3:36de8b9e4b1a 174 hoffOptions[i] = i.ToString();
darienf 3:36de8b9e4b1a 175 if (i == 32)
darienf 3:36de8b9e4b1a 176 hoffOptions[i] += "*";
darienf 3:36de8b9e4b1a 177 }
darienf 3:36de8b9e4b1a 178 string[] ravgOptions = { "2", "4", "8*", "16" };
darienf 3:36de8b9e4b1a 179 string[] rhsfOptions = { "0/8", "1/8", "2/8", "3/8", "4/8*", "5/8", "6/8", "7/8" };
darienf 3:36de8b9e4b1a 180
darienf 3:36de8b9e4b1a 181 RegisterField wndwField = new RegisterField { Name = "RTOR_WNDW", Register = 0x1d, Index = 20, Width = 4, Descriptions = wndwOptions, Control = cboRRWndw, Label = lblRRWndw, Device = max30001 };
darienf 3:36de8b9e4b1a 182 RegisterField gainField = new RegisterField { Name = "RTOR_GAIN", Register = 0x1d, Index = 16, Width = 4, Descriptions = gainOptions, Control = cboRRGain, Label = lblRRGain, Device = max30001 };
darienf 3:36de8b9e4b1a 183 RegisterField enableField = new RegisterField { Name = "EN_RTOR", Register = 0x1d, Index = 15, Width = 1, Descriptions = enableOptions, Control = cboEnRToR, Label = lblEnRToR, Device = max30001 };
darienf 3:36de8b9e4b1a 184 RegisterField pavgField = new RegisterField { Name = "RTOR_PAVG", Register = 0x1d, Index = 12, Width = 2, Descriptions = pavgOptions, Control = cboRRPavg, Label = lblRRPavg, Device = max30001 };
darienf 3:36de8b9e4b1a 185 RegisterField ptsfField = new RegisterField { Name = "RTOR_PTSF", Register = 0x1d, Index = 8, Width = 4, Descriptions = ptsfOptions, Control = cboRRPtsf, Label = lblRRPtsf, Device = max30001};
darienf 3:36de8b9e4b1a 186 RegisterField hoffField = new RegisterField { Name = "RTOR_HOFF", Register = 0x1e, Index = 16, Width = 6, Descriptions = hoffOptions, Control = cboRRHoff, Label = lblRRHoff, Device = max30001 };
darienf 3:36de8b9e4b1a 187 RegisterField ravgField = new RegisterField { Name = "RTOR_RAVG", Register = 0x1e, Index = 12, Width = 2, Descriptions = ravgOptions, Control = cboRRRavg, Label = lblRRRavg, Device = max30001 };
darienf 3:36de8b9e4b1a 188 RegisterField rhsfField = new RegisterField { Name = "RTOR_RHSF", Register = 0x1e, Index = 8, Width = 3, Descriptions = rhsfOptions, Control = cboRRRhsf, Label = lblRRRhsf, Device = max30001 };
darienf 3:36de8b9e4b1a 189
darienf 3:36de8b9e4b1a 190 rToRField.Add(wndwField);
darienf 3:36de8b9e4b1a 191 rToRField.Add(gainField);
darienf 3:36de8b9e4b1a 192 rToRField.Add(enableField);
darienf 3:36de8b9e4b1a 193 rToRField.Add(pavgField);
darienf 3:36de8b9e4b1a 194 rToRField.Add(ptsfField);
darienf 3:36de8b9e4b1a 195 rToRField.Add(hoffField);
darienf 3:36de8b9e4b1a 196 rToRField.Add(ravgField);
darienf 3:36de8b9e4b1a 197 rToRField.Add(rhsfField);
darienf 3:36de8b9e4b1a 198 }
darienf 3:36de8b9e4b1a 199
darienf 3:36de8b9e4b1a 200 /// <summary>
darienf 3:36de8b9e4b1a 201 /// Read register values and update GUI accordingly
darienf 3:36de8b9e4b1a 202 /// </summary>
darienf 3:36de8b9e4b1a 203 void ECGChannelUpdateRegisters()
darienf 3:36de8b9e4b1a 204 {
darienf 3:36de8b9e4b1a 205 internalUpdate = true;
darienf 3:36de8b9e4b1a 206 ReadComboBoxesRegisters(ecgChannelField);
darienf 3:36de8b9e4b1a 207 ReadComboBoxesRegisters(rToRField);
darienf 3:36de8b9e4b1a 208 internalUpdate = false;
darienf 3:36de8b9e4b1a 209 }
darienf 3:36de8b9e4b1a 210
darienf 3:36de8b9e4b1a 211 /// <summary>
darienf 3:36de8b9e4b1a 212 /// Read and update all the MAX30001 global GUI settings (enable bits and clock)
darienf 3:36de8b9e4b1a 213 /// </summary>
darienf 3:36de8b9e4b1a 214 void ECGGlobalUpdateRegisters()
darienf 3:36de8b9e4b1a 215 {
darienf 3:36de8b9e4b1a 216 internalUpdate = true;
darienf 3:36de8b9e4b1a 217 ReadComboBoxesRegisters(ecgGlobalField);
darienf 3:36de8b9e4b1a 218 ReadCheckBoxRegisters(channelEnableField);
darienf 3:36de8b9e4b1a 219 channelEnableMask(chkEnECG);
darienf 3:36de8b9e4b1a 220 internalUpdate = false;
darienf 3:36de8b9e4b1a 221
darienf 3:36de8b9e4b1a 222 // Update EcgView to maintain consistent state
darienf 3:36de8b9e4b1a 223 ecgView1.EnableBioZ = chkEnBioZ.Checked;
darienf 3:36de8b9e4b1a 224 ecgView1.EnableECG = chkEnECG.Checked;
darienf 3:36de8b9e4b1a 225 ecgView1.EnablePace = chkEnPace.Checked;
darienf 3:36de8b9e4b1a 226 ecgView1.EnableRToR = chkEnRtor.Checked;
darienf 3:36de8b9e4b1a 227 }
darienf 3:36de8b9e4b1a 228
darienf 3:36de8b9e4b1a 229 /// <summary>
darienf 3:36de8b9e4b1a 230 /// Mask enable bits for features which depend on EN_ECG = 1 and EN_BIOZ = 1
darienf 3:36de8b9e4b1a 231 /// </summary>
darienf 3:36de8b9e4b1a 232 /// <param name="enEcg">Checkbox representing EN_ECG bit</param>
darienf 3:36de8b9e4b1a 233 void channelEnableMask(MaximStyle.MaximCheckBox enEcg)
darienf 3:36de8b9e4b1a 234 {
darienf 3:36de8b9e4b1a 235 if (enEcg.Checked == false)
darienf 3:36de8b9e4b1a 236 {
darienf 3:36de8b9e4b1a 237 chkEnRtor.Enabled = false;
darienf 3:36de8b9e4b1a 238 chkEnPace.Enabled = false;
darienf 3:36de8b9e4b1a 239 }
darienf 3:36de8b9e4b1a 240 else
darienf 3:36de8b9e4b1a 241 {
darienf 3:36de8b9e4b1a 242 chkEnRtor.Enabled = true;
darienf 3:36de8b9e4b1a 243 if (max30001Model.PartID == Model.MAX30001Model.Part.MAX30001)
darienf 3:36de8b9e4b1a 244 chkEnPace.Enabled = true;
darienf 3:36de8b9e4b1a 245 }
darienf 3:36de8b9e4b1a 246
darienf 3:36de8b9e4b1a 247 /*if (chkEnBioZ.Checked == false)
darienf 3:36de8b9e4b1a 248 {
darienf 3:36de8b9e4b1a 249 chkEnPace.Enabled = false;
darienf 3:36de8b9e4b1a 250 }
darienf 3:36de8b9e4b1a 251 else
darienf 3:36de8b9e4b1a 252 {
darienf 3:36de8b9e4b1a 253 chkEnPace.Enabled = true;
darienf 3:36de8b9e4b1a 254 }*/
darienf 3:36de8b9e4b1a 255
darienf 3:36de8b9e4b1a 256 }
darienf 3:36de8b9e4b1a 257
darienf 3:36de8b9e4b1a 258 void ReadComboBoxesRegisters(List<RegisterField> fields)
darienf 3:36de8b9e4b1a 259 {
darienf 3:36de8b9e4b1a 260 int bitValue;
darienf 3:36de8b9e4b1a 261 MaximStyle.MaximComboBox cbox;
darienf 3:36de8b9e4b1a 262
darienf 3:36de8b9e4b1a 263 foreach (RegisterField rf in fields)
darienf 3:36de8b9e4b1a 264 {
darienf 3:36de8b9e4b1a 265 cbox = (MaximStyle.MaximComboBox)rf.Control;
darienf 3:36de8b9e4b1a 266
darienf 3:36de8b9e4b1a 267 if (rf.AutoUpdate == true)
darienf 3:36de8b9e4b1a 268 {
darienf 3:36de8b9e4b1a 269 //for (int i = 0; i < 3; i++)
darienf 3:36de8b9e4b1a 270 //{
darienf 3:36de8b9e4b1a 271 // try
darienf 3:36de8b9e4b1a 272 // {
darienf 3:36de8b9e4b1a 273 bitValue = rf.ReadField();
darienf 3:36de8b9e4b1a 274
darienf 3:36de8b9e4b1a 275
darienf 3:36de8b9e4b1a 276 if (bitValue < cbox.Items.Count && cbox.Items.Count != 0) // Bit setting matches combobox setting
darienf 3:36de8b9e4b1a 277 {
darienf 3:36de8b9e4b1a 278 cbox.SelectedItem = rf.Descriptions[bitValue];
darienf 3:36de8b9e4b1a 279 }
darienf 3:36de8b9e4b1a 280 else // Bit setting value outside of combobox item range
darienf 3:36de8b9e4b1a 281 {
darienf 3:36de8b9e4b1a 282 cbox.Text = "0b" + Convert.ToString(bitValue, 2);
darienf 3:36de8b9e4b1a 283 }
darienf 3:36de8b9e4b1a 284
darienf 3:36de8b9e4b1a 285 // }
darienf 3:36de8b9e4b1a 286 // catch (System.TimeoutException)
darienf 3:36de8b9e4b1a 287 // {
darienf 3:36de8b9e4b1a 288 // if (i == 2)
darienf 3:36de8b9e4b1a 289 // throw;
darienf 3:36de8b9e4b1a 290 // }
darienf 3:36de8b9e4b1a 291 //}
darienf 3:36de8b9e4b1a 292
darienf 3:36de8b9e4b1a 293 }
darienf 3:36de8b9e4b1a 294 }
darienf 3:36de8b9e4b1a 295
darienf 3:36de8b9e4b1a 296 }
darienf 3:36de8b9e4b1a 297
darienf 3:36de8b9e4b1a 298 void ReadComboBoxesRegister(RegisterField rf)
darienf 3:36de8b9e4b1a 299 {
darienf 3:36de8b9e4b1a 300 int bitValue;
darienf 3:36de8b9e4b1a 301 MaximStyle.MaximComboBox cbox;
darienf 3:36de8b9e4b1a 302
darienf 3:36de8b9e4b1a 303 cbox = (MaximStyle.MaximComboBox)rf.Control;
darienf 3:36de8b9e4b1a 304
darienf 3:36de8b9e4b1a 305 if (rf.AutoUpdate == true)
darienf 3:36de8b9e4b1a 306 {
darienf 3:36de8b9e4b1a 307 bitValue = rf.ReadField();
darienf 3:36de8b9e4b1a 308
darienf 3:36de8b9e4b1a 309 if (bitValue < cbox.Items.Count && cbox.Items.Count != 0) // Bit setting matches combobox setting
darienf 3:36de8b9e4b1a 310 {
darienf 3:36de8b9e4b1a 311 cbox.SelectedItem = rf.Descriptions[bitValue];
darienf 3:36de8b9e4b1a 312 }
darienf 3:36de8b9e4b1a 313 else // Bit setting value outside of combobox item range
darienf 3:36de8b9e4b1a 314 {
darienf 3:36de8b9e4b1a 315 cbox.Text = "0b" + Convert.ToString(bitValue, 2);
darienf 3:36de8b9e4b1a 316 }
darienf 3:36de8b9e4b1a 317 }
darienf 3:36de8b9e4b1a 318 }
darienf 3:36de8b9e4b1a 319
darienf 3:36de8b9e4b1a 320 void ReadCheckBoxRegisters(List<RegisterField> fields)
darienf 3:36de8b9e4b1a 321 {
darienf 3:36de8b9e4b1a 322 int bitValue;
darienf 3:36de8b9e4b1a 323 MaximStyle.MaximCheckBox chk;
darienf 3:36de8b9e4b1a 324
darienf 3:36de8b9e4b1a 325 foreach (RegisterField rf in fields)
darienf 3:36de8b9e4b1a 326 {
darienf 3:36de8b9e4b1a 327 chk = (MaximStyle.MaximCheckBox)rf.Control;
darienf 3:36de8b9e4b1a 328
darienf 3:36de8b9e4b1a 329 if (rf.AutoUpdate == true)
darienf 3:36de8b9e4b1a 330 {
darienf 3:36de8b9e4b1a 331 bitValue = rf.ReadField();
darienf 3:36de8b9e4b1a 332
darienf 3:36de8b9e4b1a 333 if (bitValue == 0)
darienf 3:36de8b9e4b1a 334 chk.Checked = false;
darienf 3:36de8b9e4b1a 335 else
darienf 3:36de8b9e4b1a 336 chk.Checked = true;
darienf 3:36de8b9e4b1a 337 }
darienf 3:36de8b9e4b1a 338 }
darienf 3:36de8b9e4b1a 339 }
darienf 3:36de8b9e4b1a 340
darienf 3:36de8b9e4b1a 341 /// <summary>
darienf 3:36de8b9e4b1a 342 /// Get bit value from register
darienf 3:36de8b9e4b1a 343 /// </summary>
darienf 3:36de8b9e4b1a 344 /// <param name="field"></param>
darienf 3:36de8b9e4b1a 345 /// <returns></returns>
darienf 3:36de8b9e4b1a 346 /*int BitValue(RegisterField field)
darienf 3:36de8b9e4b1a 347 {
darienf 3:36de8b9e4b1a 348 int registerData;
darienf 3:36de8b9e4b1a 349
darienf 3:36de8b9e4b1a 350 registerData = max30001.ReadReg((byte)field.Register);
darienf 3:36de8b9e4b1a 351
darienf 3:36de8b9e4b1a 352 return (registerData >> field.Index) & ((1 << field.Width) - 1);
darienf 3:36de8b9e4b1a 353 }*/
darienf 3:36de8b9e4b1a 354
darienf 3:36de8b9e4b1a 355 /// <summary>
darienf 3:36de8b9e4b1a 356 /// Add tool tips to combo boxes and event to write registers
darienf 3:36de8b9e4b1a 357 /// </summary>
darienf 3:36de8b9e4b1a 358 /// <param name="list"></param>
darienf 3:36de8b9e4b1a 359 void initalizeToolTipEvents(List<RegisterField> list)
darienf 3:36de8b9e4b1a 360 {
darienf 3:36de8b9e4b1a 361 MaximStyle.MaximComboBox cbox;
darienf 3:36de8b9e4b1a 362 Label lbl;
darienf 3:36de8b9e4b1a 363 StringBuilder strBuilder = new StringBuilder();
darienf 3:36de8b9e4b1a 364
darienf 3:36de8b9e4b1a 365 foreach (RegisterField field in list)
darienf 3:36de8b9e4b1a 366 {
darienf 3:36de8b9e4b1a 367 cbox = (MaximStyle.MaximComboBox)field.Control;
darienf 3:36de8b9e4b1a 368 lbl = field.Label;
darienf 3:36de8b9e4b1a 369
darienf 3:36de8b9e4b1a 370 // Tool Tip String
darienf 3:36de8b9e4b1a 371 strBuilder.Append("Bit ");
darienf 3:36de8b9e4b1a 372 strBuilder.Append(field.Name.Replace("\n", String.Empty));
darienf 3:36de8b9e4b1a 373 strBuilder.Append(" in Register 0x");
darienf 3:36de8b9e4b1a 374 strBuilder.Append(field.Register.ToString("X2"));
darienf 3:36de8b9e4b1a 375 toolTip1.SetToolTip(cbox, strBuilder.ToString());
darienf 3:36de8b9e4b1a 376 if (lbl != null)
darienf 3:36de8b9e4b1a 377 toolTip1.SetToolTip(lbl, strBuilder.ToString());
darienf 3:36de8b9e4b1a 378 strBuilder.Clear();
darienf 3:36de8b9e4b1a 379
darienf 3:36de8b9e4b1a 380 // Event to Write Registers
darienf 3:36de8b9e4b1a 381 if (cbox != cboMasterClock && cbox != cboSampleRate && cbox != cboBioZSampleRate) // cboMasterClock has a special handler to support repopulation of comboboxes
darienf 3:36de8b9e4b1a 382 cbox.SelectedIndexChanged += new System.EventHandler(cboECGChannel_SelectedIndexChanged);
darienf 3:36de8b9e4b1a 383 }
darienf 3:36de8b9e4b1a 384 }
darienf 3:36de8b9e4b1a 385
darienf 3:36de8b9e4b1a 386 /// <summary>
darienf 3:36de8b9e4b1a 387 /// Write corresponding register of cbox
darienf 3:36de8b9e4b1a 388 /// </summary>
darienf 3:36de8b9e4b1a 389 /// <param name="cbox"></param>
darienf 3:36de8b9e4b1a 390 void writeComboBox(MaximStyle.MaximComboBox cbox)
darienf 3:36de8b9e4b1a 391 {
darienf 3:36de8b9e4b1a 392 List<RegisterField>[] fieldLists = { ecgChannelField, ecgInputMuxField, ecgGlobalField, rToRField, bioZChannelField, bioZInputMuxField, bioZLoadField, paceChannelField};
darienf 3:36de8b9e4b1a 393 RegisterField field = null;
darienf 3:36de8b9e4b1a 394 //int val;
darienf 3:36de8b9e4b1a 395
darienf 3:36de8b9e4b1a 396 foreach (List<RegisterField> list in fieldLists)
darienf 3:36de8b9e4b1a 397 {
darienf 3:36de8b9e4b1a 398 foreach (RegisterField f in list)
darienf 3:36de8b9e4b1a 399 {
darienf 3:36de8b9e4b1a 400 if (f.Control == cbox)
darienf 3:36de8b9e4b1a 401 {
darienf 3:36de8b9e4b1a 402 field = f;
darienf 3:36de8b9e4b1a 403 break;
darienf 3:36de8b9e4b1a 404 }
darienf 3:36de8b9e4b1a 405 }
darienf 3:36de8b9e4b1a 406
darienf 3:36de8b9e4b1a 407 if (field != null)
darienf 3:36de8b9e4b1a 408 break;
darienf 3:36de8b9e4b1a 409 }
darienf 3:36de8b9e4b1a 410
darienf 3:36de8b9e4b1a 411 field.WriteField((((MaximStyle.MaximComboBox)field.Control).SelectedIndex));
darienf 3:36de8b9e4b1a 412 }
darienf 3:36de8b9e4b1a 413
darienf 3:36de8b9e4b1a 414 void writeCheckBox(MaximStyle.MaximCheckBox chk)
darienf 3:36de8b9e4b1a 415 {
darienf 3:36de8b9e4b1a 416 List<RegisterField>[] fieldLists = { channelEnableField };
darienf 3:36de8b9e4b1a 417 RegisterField field = null;
darienf 3:36de8b9e4b1a 418 //int val;
darienf 3:36de8b9e4b1a 419
darienf 3:36de8b9e4b1a 420 foreach (List<RegisterField> list in fieldLists)
darienf 3:36de8b9e4b1a 421 {
darienf 3:36de8b9e4b1a 422 foreach (RegisterField f in list)
darienf 3:36de8b9e4b1a 423 {
darienf 3:36de8b9e4b1a 424 if (f.Control == chk)
darienf 3:36de8b9e4b1a 425 {
darienf 3:36de8b9e4b1a 426 field = f;
darienf 3:36de8b9e4b1a 427 break;
darienf 3:36de8b9e4b1a 428 }
darienf 3:36de8b9e4b1a 429 }
darienf 3:36de8b9e4b1a 430
darienf 3:36de8b9e4b1a 431 if (field != null)
darienf 3:36de8b9e4b1a 432 break;
darienf 3:36de8b9e4b1a 433 }
darienf 3:36de8b9e4b1a 434
darienf 3:36de8b9e4b1a 435 field.WriteField(((MaximStyle.MaximCheckBox)field.Control).Checked == true ? 1 : 0);
darienf 3:36de8b9e4b1a 436 }
darienf 3:36de8b9e4b1a 437
darienf 3:36de8b9e4b1a 438 /// <summary>
darienf 3:36de8b9e4b1a 439 /// Event to handle when a new item is selected in the comboboxes for ECG Channel tabs
darienf 3:36de8b9e4b1a 440 /// </summary>
darienf 3:36de8b9e4b1a 441 /// <param name="sender"></param>
darienf 3:36de8b9e4b1a 442 /// <param name="e"></param>
darienf 3:36de8b9e4b1a 443 private void cboECGChannel_SelectedIndexChanged(object sender, EventArgs e)
darienf 3:36de8b9e4b1a 444 {
darienf 3:36de8b9e4b1a 445 MaximStyle.MaximComboBox cbox = (MaximStyle.MaximComboBox)sender;
darienf 3:36de8b9e4b1a 446
darienf 3:36de8b9e4b1a 447 if (connected && !internalUpdate)
darienf 3:36de8b9e4b1a 448 writeComboBox(cbox);
darienf 3:36de8b9e4b1a 449 }
darienf 3:36de8b9e4b1a 450
darienf 3:36de8b9e4b1a 451 /// <summary>
darienf 3:36de8b9e4b1a 452 /// Update sample rate for ECG View
darienf 3:36de8b9e4b1a 453 /// </summary>
darienf 3:36de8b9e4b1a 454 /// <param name="sender"></param>
darienf 3:36de8b9e4b1a 455 /// <param name="e"></param>
darienf 3:36de8b9e4b1a 456 private void cboSampleRate_SelectedIndexChanged(object sender, EventArgs e)
darienf 3:36de8b9e4b1a 457 {
darienf 3:36de8b9e4b1a 458 MaximStyle.MaximComboBox cbox = (MaximStyle.MaximComboBox)sender;
darienf 3:36de8b9e4b1a 459
darienf 3:36de8b9e4b1a 460 if (connected && !internalUpdate)
darienf 3:36de8b9e4b1a 461 writeComboBox(cbox);
darienf 3:36de8b9e4b1a 462
darienf 3:36de8b9e4b1a 463 if (cboMasterClock.SelectedIndex > -1)
darienf 3:36de8b9e4b1a 464 {
darienf 3:36de8b9e4b1a 465 // Set sample rate based on clock
darienf 3:36de8b9e4b1a 466 ecgView1.SampleRateEcg = ecgSampleRates[cboMasterClock.SelectedIndex][cbox.SelectedIndex];
darienf 3:36de8b9e4b1a 467
darienf 3:36de8b9e4b1a 468 // Set digital low pass filter
darienf 3:36de8b9e4b1a 469 cboDlpf.Items.Clear();
darienf 3:36de8b9e4b1a 470 ecgDlpfField.Descriptions = ecgDlpfOptions[cboMasterClock.SelectedIndex][cboSampleRate.SelectedIndex];
darienf 3:36de8b9e4b1a 471 ecgDlpfField.Control = cboDlpf; // Trigger updating of descriptions
darienf 3:36de8b9e4b1a 472
darienf 3:36de8b9e4b1a 473 //internalUpdate = true;
darienf 3:36de8b9e4b1a 474 if (connected)
darienf 3:36de8b9e4b1a 475 cboDlpf.SelectedIndex = ecgDlpfField.ReadField();
darienf 3:36de8b9e4b1a 476 //internalUpdate = false;
darienf 3:36de8b9e4b1a 477 //ReadComboBoxesRegisters(cboDlpf);
darienf 3:36de8b9e4b1a 478 }
darienf 3:36de8b9e4b1a 479
darienf 3:36de8b9e4b1a 480 }
darienf 3:36de8b9e4b1a 481
darienf 3:36de8b9e4b1a 482 private void cboChannelGain_SelectedIndexChanged(object sender, EventArgs e)
darienf 3:36de8b9e4b1a 483 {
darienf 3:36de8b9e4b1a 484 MaximStyle.MaximComboBox cbox = (MaximStyle.MaximComboBox)sender;
darienf 3:36de8b9e4b1a 485
darienf 3:36de8b9e4b1a 486 switch (cbox.SelectedIndex)
darienf 3:36de8b9e4b1a 487 {
darienf 3:36de8b9e4b1a 488 case 0:
darienf 3:36de8b9e4b1a 489 ecgView1.GainECG = 20;
darienf 3:36de8b9e4b1a 490 break;
darienf 3:36de8b9e4b1a 491 case 1:
darienf 3:36de8b9e4b1a 492 ecgView1.GainECG = 40;
darienf 3:36de8b9e4b1a 493 break;
darienf 3:36de8b9e4b1a 494 case 2:
darienf 3:36de8b9e4b1a 495 ecgView1.GainECG = 80;
darienf 3:36de8b9e4b1a 496 break;
darienf 3:36de8b9e4b1a 497 case 3:
darienf 3:36de8b9e4b1a 498 ecgView1.GainECG = 160;
darienf 3:36de8b9e4b1a 499 break;
darienf 3:36de8b9e4b1a 500 }
darienf 3:36de8b9e4b1a 501 }
darienf 3:36de8b9e4b1a 502
darienf 3:36de8b9e4b1a 503 private void chkChannelEnable_CheckedChanged(object sender, EventArgs e)
darienf 3:36de8b9e4b1a 504 {
darienf 3:36de8b9e4b1a 505 MaximStyle.MaximCheckBox chk = (MaximStyle.MaximCheckBox)sender;
darienf 3:36de8b9e4b1a 506
darienf 3:36de8b9e4b1a 507 // Write bit
darienf 3:36de8b9e4b1a 508 if (connected && !internalUpdate)
darienf 3:36de8b9e4b1a 509 {
darienf 3:36de8b9e4b1a 510 writeCheckBox(chk);
darienf 3:36de8b9e4b1a 511
darienf 3:36de8b9e4b1a 512 // Do not allow user to change masked enable bits
darienf 3:36de8b9e4b1a 513 channelEnableMask(chkEnECG);
darienf 3:36de8b9e4b1a 514
darienf 3:36de8b9e4b1a 515 // Tell ECG View the status
darienf 3:36de8b9e4b1a 516 if (chk == chkEnECG)
darienf 3:36de8b9e4b1a 517 {
darienf 3:36de8b9e4b1a 518 ecgView1.EnableECG = chk.Checked;
darienf 3:36de8b9e4b1a 519 }
darienf 3:36de8b9e4b1a 520 else if (chk == chkEnBioZ)
darienf 3:36de8b9e4b1a 521 {
darienf 3:36de8b9e4b1a 522 ecgView1.EnableBioZ = chk.Checked;
darienf 3:36de8b9e4b1a 523 }
darienf 3:36de8b9e4b1a 524 else if (chk == chkEnPace)
darienf 3:36de8b9e4b1a 525 {
darienf 3:36de8b9e4b1a 526 ecgView1.EnablePace = chk.Checked;
darienf 3:36de8b9e4b1a 527 }
darienf 3:36de8b9e4b1a 528 else if (chk == chkEnRtor)
darienf 3:36de8b9e4b1a 529 {
darienf 3:36de8b9e4b1a 530 ecgView1.EnableRToR = chk.Checked;
darienf 3:36de8b9e4b1a 531 }
darienf 3:36de8b9e4b1a 532
darienf 3:36de8b9e4b1a 533 // Read all enable bits
darienf 3:36de8b9e4b1a 534 internalUpdate = true;
darienf 3:36de8b9e4b1a 535 ReadCheckBoxRegisters(channelEnableField);
darienf 3:36de8b9e4b1a 536 internalUpdate = false;
darienf 3:36de8b9e4b1a 537 }
darienf 3:36de8b9e4b1a 538 }
darienf 3:36de8b9e4b1a 539
darienf 3:36de8b9e4b1a 540 private void cboMasterClock_SelectedIndexChanged(object sender, EventArgs e)
darienf 3:36de8b9e4b1a 541 {
darienf 3:36de8b9e4b1a 542 MaximStyle.MaximComboBox cbo = (MaximStyle.MaximComboBox)sender;
darienf 3:36de8b9e4b1a 543 int[] clock = { 32768, 32000, 32000, 31968 };
darienf 3:36de8b9e4b1a 544
darienf 3:36de8b9e4b1a 545 if (connected && !internalUpdate)
darienf 3:36de8b9e4b1a 546 writeComboBox(cbo);
darienf 3:36de8b9e4b1a 547
darienf 3:36de8b9e4b1a 548 ecgView1.FrequencyMasterField = cbo.SelectedIndex;
darienf 3:36de8b9e4b1a 549 //ecgView1.TimeResolution = 1.0/(2*clock[cbo.SelectedIndex]);
darienf 3:36de8b9e4b1a 550
darienf 3:36de8b9e4b1a 551 ecgSampleRateField.Descriptions = ecgSampleRateOptions[cbo.SelectedIndex];
darienf 3:36de8b9e4b1a 552 ecgSampleRateField.Control = cboSampleRate; // Trigger updating of descriptions
darienf 3:36de8b9e4b1a 553
darienf 3:36de8b9e4b1a 554 cboBioZSampleRate.Items.Clear();
darienf 3:36de8b9e4b1a 555 bioZSampleRateField.Descriptions = bioZSampleRateOptions[cbo.SelectedIndex];
darienf 3:36de8b9e4b1a 556 bioZSampleRateField.Control = cboBioZSampleRate; // Trigger updating of descriptions
darienf 3:36de8b9e4b1a 557
darienf 3:36de8b9e4b1a 558 // Trigger update of current selection to new description
darienf 3:36de8b9e4b1a 559 internalUpdate = true;
darienf 3:36de8b9e4b1a 560 if (connected)
darienf 3:36de8b9e4b1a 561 {
darienf 3:36de8b9e4b1a 562 cboSampleRate.SelectedIndex = ecgSampleRateField.ReadField();
darienf 3:36de8b9e4b1a 563 cboDlpf.SelectedIndex = ecgDlpfField.ReadField();
darienf 3:36de8b9e4b1a 564 cboBioZSampleRate.SelectedIndex = bioZSampleRateField.ReadField();
darienf 3:36de8b9e4b1a 565 cboBioZDigitalLpf.SelectedIndex = bioZDlpfField.ReadField();
darienf 3:36de8b9e4b1a 566 }
darienf 3:36de8b9e4b1a 567 internalUpdate = false;
darienf 3:36de8b9e4b1a 568 }
darienf 3:36de8b9e4b1a 569
darienf 3:36de8b9e4b1a 570 private void cboRRWndw_SelectedIndexChanged(object sender, EventArgs e)
darienf 3:36de8b9e4b1a 571 {
darienf 3:36de8b9e4b1a 572 MaximStyle.MaximComboBox cbo = (MaximStyle.MaximComboBox)sender;
darienf 3:36de8b9e4b1a 573 ecgView1.RToRWindowField = cbo.SelectedIndex;
darienf 3:36de8b9e4b1a 574 }
darienf 3:36de8b9e4b1a 575
darienf 3:36de8b9e4b1a 576 private CustomControls.InitArgs.RToRInitStart getRToRArgs()
darienf 3:36de8b9e4b1a 577 {
darienf 3:36de8b9e4b1a 578 CustomControls.InitArgs.RToRInitStart initArgs = new CustomControls.InitArgs.RToRInitStart();
darienf 3:36de8b9e4b1a 579
darienf 3:36de8b9e4b1a 580 initArgs.Wndw = cboRRWndw.SelectedIndex;
darienf 3:36de8b9e4b1a 581 initArgs.Gain = cboRRGain.SelectedIndex;
darienf 3:36de8b9e4b1a 582 initArgs.En_rtor = chkEnRtor.Checked == true ? 1 : 0;
darienf 3:36de8b9e4b1a 583 initArgs.Pavg = cboRRPavg.SelectedIndex;
darienf 3:36de8b9e4b1a 584 initArgs.Ptsf = cboRRPtsf.SelectedIndex;
darienf 3:36de8b9e4b1a 585 initArgs.Hoff = cboRRHoff.SelectedIndex;
darienf 3:36de8b9e4b1a 586 initArgs.Ravg = cboRRRavg.SelectedIndex;
darienf 3:36de8b9e4b1a 587 initArgs.Rhsf = cboRRRhsf.SelectedIndex;
darienf 3:36de8b9e4b1a 588 initArgs.Clr_rrint = 1; // Default from Jerry's GUI
darienf 3:36de8b9e4b1a 589
darienf 3:36de8b9e4b1a 590 return initArgs;
darienf 3:36de8b9e4b1a 591 }
darienf 3:36de8b9e4b1a 592
darienf 3:36de8b9e4b1a 593 private void setRToRArgs(CustomControls.InitArgs.RToRInitStart initArgs)
darienf 3:36de8b9e4b1a 594 {
darienf 3:36de8b9e4b1a 595 cboRRWndw.SelectedIndex = initArgs.Wndw;
darienf 3:36de8b9e4b1a 596 cboRRGain.SelectedIndex = initArgs.Gain;
darienf 3:36de8b9e4b1a 597 //initArgs.En_rtor = chkEnRtor.Checked == true ? 1 : 0; //cboEnRToR.SelectedIndex;
darienf 3:36de8b9e4b1a 598 cboRRPavg.SelectedIndex = initArgs.Pavg;
darienf 3:36de8b9e4b1a 599 cboRRPtsf.SelectedIndex = initArgs.Ptsf;
darienf 3:36de8b9e4b1a 600 cboRRHoff.SelectedIndex = initArgs.Hoff;
darienf 3:36de8b9e4b1a 601 cboRRRavg.SelectedIndex = initArgs.Ravg;
darienf 3:36de8b9e4b1a 602 cboRRRhsf.SelectedIndex = initArgs.Rhsf;
darienf 3:36de8b9e4b1a 603 //initArgs.Clr_rrint = 2; // Default from Jerry's GUI
darienf 3:36de8b9e4b1a 604 }
darienf 3:36de8b9e4b1a 605
darienf 3:36de8b9e4b1a 606 }
darienf 3:36de8b9e4b1a 607 }