Darien Figueroa / Mbed 2 deprecated repo3

Dependencies:   mbed MAX14720 MAX30205 USBDevice

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers BioZLoad.cs Source File

BioZLoad.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     public partial class HspForm
00044     {
00045         List<RegisterField> bioZLoadField = new List<RegisterField>();
00046 
00047         void initalizeBioZLoadFields()
00048         {
00049             string[] enBistOptions = { "Disabled*", "Enabled" };
00050             string[] rmodOptions = { "SWMOD0 Switch Closed", "SWMOD1 Switch Closed", "SWMOD2 Switch Closed", "SWMOD3 Switch Closed", "Not Modulated*" };
00051             string[] fbistOptions = { "FMSTR/2^13 (~4 Hz)*", "FMSTR/2^15 (~1 Hz)", "FMSTR/2^17 (~1/4 Hz)", "FMSTR/2^19 (~1/16 Hz)" };
00052             string[] rnomOptions = { "5000 Ω*", "2500 Ω", "1667 Ω", "1250 Ω", "1000 Ω", "833 Ω", "714 Ω", "625 Ω" };
00053 
00054             RegisterField enBistField = new RegisterField { Name = "BMUX_EN_BIST", Register = 0x17, Index = 11, Width = 1, Descriptions = enBistOptions, Label = lblBioZBmuxEnBist, Control = cboBioZBmuxEnBist, Device = max30001 };
00055             RegisterField rnomField = new RegisterField { Name = "BMUX_RNOM", Register = 0x17, Index = 8, Width = 3, Descriptions = rnomOptions, Label = lblBioZBmuxRnom, Control = cboBioZBmuxRnom, Device = max30001 };
00056             RegisterField rmodField = new RegisterField { Name = "BMUX_RMOD", Register = 0x17, Index = 4, Width = 3, Descriptions = rmodOptions, Label = lblBioZBmuxRmod, Control = cboBioZBmuxRmod, Device = max30001 };
00057             RegisterField fbistField = new RegisterField { Name = "BMUX_FBIST", Register = 0x17, Index = 0, Width = 2, Descriptions = fbistOptions, Label = lblBioZBmuxFbist, Control = cboBioZBmuxFbist, Device = max30001 };
00058 
00059             bioZLoadField.Add(enBistField);
00060             bioZLoadField.Add(rmodField);
00061             bioZLoadField.Add(fbistField);
00062             bioZLoadField.Add(rnomField);
00063 
00064             
00065 
00066         }
00067 
00068         private void UpdateBioZLoadSwitches()
00069         {
00070             //BioZ Load tab switch state reflects the BioZMux tab switch state
00071 
00072             //Lead Off Check
00073             if (picBioZLloff1.Image != null)
00074                 picBioZLloff1.Image.Dispose();
00075             if (picBioZLloff2.Image != null)
00076                 picBioZLloff2.Image.Dispose();
00077             if (picLoff1.Image != null)
00078             {
00079                 picBioZLloff1.Image = Properties.Resources.bioz_loadloff1;
00080             }
00081             else
00082             {
00083                 picBioZLloff1.Image = null;
00084             }
00085             if (picLoff2.Image != null)
00086             {
00087                 picBioZLloff2.Image = Properties.Resources.bioz_loadloff2;
00088             }
00089             else
00090             {
00091                 picBioZLloff2.Image = null;
00092             }
00093 
00094             //Lead On Check
00095             if (picBioZLlon.Image != null)
00096                 picBioZLlon.Image.Dispose();
00097             if (picLeadOn.Image != null)
00098             {
00099                 picBioZLlon.Image = Properties.Resources.bioz_load_leadon;
00100             }
00101             else
00102             {
00103                 picBioZLlon.Image = null;
00104             }
00105 
00106             //Switches
00107             if (picBioZLsw1.Image != null)
00108                 picBioZLsw1.Image.Dispose();
00109             if (picBioZLsw2.Image != null)
00110                 picBioZLsw2.Image.Dispose();
00111             if (picBioZsw1.Image != null)
00112             {
00113                 picBioZLsw1.Image = Properties.Resources.bioz_load_sw1;
00114             }
00115             else
00116             {
00117                 picBioZLsw1.Image = null;
00118             }
00119             if (picBioZsw2.Image != null)
00120             {
00121                 picBioZLsw2.Image = Properties.Resources.bioz_load_sw2;
00122             }
00123             else
00124             {
00125                 picBioZLsw2.Image = null;
00126             }
00127 
00128             //Lead Bias
00129             if (picBioZLlb1.Image != null)
00130                 picBioZLlb1.Image.Dispose();
00131             if (picBioZLlb2.Image != null)
00132                 picBioZLlb2.Image.Dispose();
00133             if (picLeadBias1.Image != null)
00134             {
00135                 picBioZLlb1.Image = Properties.Resources.bioz_load_lb1;
00136             }
00137             else
00138             {
00139                 picBioZLlb1.Image = null;
00140             }
00141             if (picLeadBias2.Image != null)
00142             {
00143                 picBioZLlb2.Image = Properties.Resources.bioz_load_lb2;
00144             }
00145             else
00146             {
00147                 picBioZLlb2.Image = null;
00148             }
00149 
00150             //Calibration
00151             if (picBioZLcal1.Image != null)
00152             {
00153                 picBioZLcal1.Image.Dispose();
00154                 picBioZLcal1.Image = Properties.Resources.bioz_load_cal1;
00155             }
00156             else
00157             {
00158                 picBioZLcal1.Image = null;
00159             }
00160             if (picBioZLcal2.Image != null)
00161             {
00162                 picBioZLcal2.Image.Dispose();
00163                 picBioZLcal2.Image = Properties.Resources.bioz_load_cal2;
00164             }
00165             else
00166             {
00167                 picBioZLcal2.Image = null;
00168             }
00169 
00170             //Resistive Load Enable Logic
00171             if (picBioZLresload.Image != null)
00172                 picBioZLresload.Image.Dispose();
00173             if (cboBioZBmuxEnBist.SelectedIndex == 1)
00174             {
00175                 picBioZLresload.Image = Properties.Resources.bioz_load_resload;
00176             }
00177             else
00178             {
00179                 picBioZLresload.Image = null;
00180             }
00181         }
00182 
00183         void BioZLoadUpdateRegisters()
00184         {
00185             internalUpdate = true;
00186             ReadComboBoxesRegisters(bioZLoadField);
00187             //UpdateBioZLoadSwitches(); moved to Form1.cs BioZLoad tab selection section
00188             internalUpdate = false;
00189         }
00190 
00191         private void cboBioZBmuxEnBist_SelectedIndexChanged(object sender, EventArgs e)
00192         {
00193             UpdateBioZLoadSwitches();
00194         }
00195 
00196     }
00197 }