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:
Sun May 02 23:09:04 2021 +0000
Revision:
5:bc128a16232f
Parent:
3:36de8b9e4b1a
This is the program that was last used, that has the working temperature and some comments

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.Linq;
darienf 3:36de8b9e4b1a 39 using System.Text;
darienf 3:36de8b9e4b1a 40
darienf 3:36de8b9e4b1a 41 namespace HealthSensorPlatform
darienf 3:36de8b9e4b1a 42 {
darienf 3:36de8b9e4b1a 43 public partial class HspForm
darienf 3:36de8b9e4b1a 44 {
darienf 3:36de8b9e4b1a 45 List<RegisterField> bioZLoadField = new List<RegisterField>();
darienf 3:36de8b9e4b1a 46
darienf 3:36de8b9e4b1a 47 void initalizeBioZLoadFields()
darienf 3:36de8b9e4b1a 48 {
darienf 3:36de8b9e4b1a 49 string[] enBistOptions = { "Disabled*", "Enabled" };
darienf 3:36de8b9e4b1a 50 string[] rmodOptions = { "SWMOD0 Switch Closed", "SWMOD1 Switch Closed", "SWMOD2 Switch Closed", "SWMOD3 Switch Closed", "Not Modulated*" };
darienf 3:36de8b9e4b1a 51 string[] fbistOptions = { "FMSTR/2^13 (~4 Hz)*", "FMSTR/2^15 (~1 Hz)", "FMSTR/2^17 (~1/4 Hz)", "FMSTR/2^19 (~1/16 Hz)" };
darienf 3:36de8b9e4b1a 52 string[] rnomOptions = { "5000 Ω*", "2500 Ω", "1667 Ω", "1250 Ω", "1000 Ω", "833 Ω", "714 Ω", "625 Ω" };
darienf 3:36de8b9e4b1a 53
darienf 3:36de8b9e4b1a 54 RegisterField enBistField = new RegisterField { Name = "BMUX_EN_BIST", Register = 0x17, Index = 11, Width = 1, Descriptions = enBistOptions, Label = lblBioZBmuxEnBist, Control = cboBioZBmuxEnBist, Device = max30001 };
darienf 3:36de8b9e4b1a 55 RegisterField rnomField = new RegisterField { Name = "BMUX_RNOM", Register = 0x17, Index = 8, Width = 3, Descriptions = rnomOptions, Label = lblBioZBmuxRnom, Control = cboBioZBmuxRnom, Device = max30001 };
darienf 3:36de8b9e4b1a 56 RegisterField rmodField = new RegisterField { Name = "BMUX_RMOD", Register = 0x17, Index = 4, Width = 3, Descriptions = rmodOptions, Label = lblBioZBmuxRmod, Control = cboBioZBmuxRmod, Device = max30001 };
darienf 3:36de8b9e4b1a 57 RegisterField fbistField = new RegisterField { Name = "BMUX_FBIST", Register = 0x17, Index = 0, Width = 2, Descriptions = fbistOptions, Label = lblBioZBmuxFbist, Control = cboBioZBmuxFbist, Device = max30001 };
darienf 3:36de8b9e4b1a 58
darienf 3:36de8b9e4b1a 59 bioZLoadField.Add(enBistField);
darienf 3:36de8b9e4b1a 60 bioZLoadField.Add(rmodField);
darienf 3:36de8b9e4b1a 61 bioZLoadField.Add(fbistField);
darienf 3:36de8b9e4b1a 62 bioZLoadField.Add(rnomField);
darienf 3:36de8b9e4b1a 63
darienf 3:36de8b9e4b1a 64
darienf 3:36de8b9e4b1a 65
darienf 3:36de8b9e4b1a 66 }
darienf 3:36de8b9e4b1a 67
darienf 3:36de8b9e4b1a 68 private void UpdateBioZLoadSwitches()
darienf 3:36de8b9e4b1a 69 {
darienf 3:36de8b9e4b1a 70 //BioZ Load tab switch state reflects the BioZMux tab switch state
darienf 3:36de8b9e4b1a 71
darienf 3:36de8b9e4b1a 72 //Lead Off Check
darienf 3:36de8b9e4b1a 73 if (picBioZLloff1.Image != null)
darienf 3:36de8b9e4b1a 74 picBioZLloff1.Image.Dispose();
darienf 3:36de8b9e4b1a 75 if (picBioZLloff2.Image != null)
darienf 3:36de8b9e4b1a 76 picBioZLloff2.Image.Dispose();
darienf 3:36de8b9e4b1a 77 if (picLoff1.Image != null)
darienf 3:36de8b9e4b1a 78 {
darienf 3:36de8b9e4b1a 79 picBioZLloff1.Image = Properties.Resources.bioz_loadloff1;
darienf 3:36de8b9e4b1a 80 }
darienf 3:36de8b9e4b1a 81 else
darienf 3:36de8b9e4b1a 82 {
darienf 3:36de8b9e4b1a 83 picBioZLloff1.Image = null;
darienf 3:36de8b9e4b1a 84 }
darienf 3:36de8b9e4b1a 85 if (picLoff2.Image != null)
darienf 3:36de8b9e4b1a 86 {
darienf 3:36de8b9e4b1a 87 picBioZLloff2.Image = Properties.Resources.bioz_loadloff2;
darienf 3:36de8b9e4b1a 88 }
darienf 3:36de8b9e4b1a 89 else
darienf 3:36de8b9e4b1a 90 {
darienf 3:36de8b9e4b1a 91 picBioZLloff2.Image = null;
darienf 3:36de8b9e4b1a 92 }
darienf 3:36de8b9e4b1a 93
darienf 3:36de8b9e4b1a 94 //Lead On Check
darienf 3:36de8b9e4b1a 95 if (picBioZLlon.Image != null)
darienf 3:36de8b9e4b1a 96 picBioZLlon.Image.Dispose();
darienf 3:36de8b9e4b1a 97 if (picLeadOn.Image != null)
darienf 3:36de8b9e4b1a 98 {
darienf 3:36de8b9e4b1a 99 picBioZLlon.Image = Properties.Resources.bioz_load_leadon;
darienf 3:36de8b9e4b1a 100 }
darienf 3:36de8b9e4b1a 101 else
darienf 3:36de8b9e4b1a 102 {
darienf 3:36de8b9e4b1a 103 picBioZLlon.Image = null;
darienf 3:36de8b9e4b1a 104 }
darienf 3:36de8b9e4b1a 105
darienf 3:36de8b9e4b1a 106 //Switches
darienf 3:36de8b9e4b1a 107 if (picBioZLsw1.Image != null)
darienf 3:36de8b9e4b1a 108 picBioZLsw1.Image.Dispose();
darienf 3:36de8b9e4b1a 109 if (picBioZLsw2.Image != null)
darienf 3:36de8b9e4b1a 110 picBioZLsw2.Image.Dispose();
darienf 3:36de8b9e4b1a 111 if (picBioZsw1.Image != null)
darienf 3:36de8b9e4b1a 112 {
darienf 3:36de8b9e4b1a 113 picBioZLsw1.Image = Properties.Resources.bioz_load_sw1;
darienf 3:36de8b9e4b1a 114 }
darienf 3:36de8b9e4b1a 115 else
darienf 3:36de8b9e4b1a 116 {
darienf 3:36de8b9e4b1a 117 picBioZLsw1.Image = null;
darienf 3:36de8b9e4b1a 118 }
darienf 3:36de8b9e4b1a 119 if (picBioZsw2.Image != null)
darienf 3:36de8b9e4b1a 120 {
darienf 3:36de8b9e4b1a 121 picBioZLsw2.Image = Properties.Resources.bioz_load_sw2;
darienf 3:36de8b9e4b1a 122 }
darienf 3:36de8b9e4b1a 123 else
darienf 3:36de8b9e4b1a 124 {
darienf 3:36de8b9e4b1a 125 picBioZLsw2.Image = null;
darienf 3:36de8b9e4b1a 126 }
darienf 3:36de8b9e4b1a 127
darienf 3:36de8b9e4b1a 128 //Lead Bias
darienf 3:36de8b9e4b1a 129 if (picBioZLlb1.Image != null)
darienf 3:36de8b9e4b1a 130 picBioZLlb1.Image.Dispose();
darienf 3:36de8b9e4b1a 131 if (picBioZLlb2.Image != null)
darienf 3:36de8b9e4b1a 132 picBioZLlb2.Image.Dispose();
darienf 3:36de8b9e4b1a 133 if (picLeadBias1.Image != null)
darienf 3:36de8b9e4b1a 134 {
darienf 3:36de8b9e4b1a 135 picBioZLlb1.Image = Properties.Resources.bioz_load_lb1;
darienf 3:36de8b9e4b1a 136 }
darienf 3:36de8b9e4b1a 137 else
darienf 3:36de8b9e4b1a 138 {
darienf 3:36de8b9e4b1a 139 picBioZLlb1.Image = null;
darienf 3:36de8b9e4b1a 140 }
darienf 3:36de8b9e4b1a 141 if (picLeadBias2.Image != null)
darienf 3:36de8b9e4b1a 142 {
darienf 3:36de8b9e4b1a 143 picBioZLlb2.Image = Properties.Resources.bioz_load_lb2;
darienf 3:36de8b9e4b1a 144 }
darienf 3:36de8b9e4b1a 145 else
darienf 3:36de8b9e4b1a 146 {
darienf 3:36de8b9e4b1a 147 picBioZLlb2.Image = null;
darienf 3:36de8b9e4b1a 148 }
darienf 3:36de8b9e4b1a 149
darienf 3:36de8b9e4b1a 150 //Calibration
darienf 3:36de8b9e4b1a 151 if (picBioZLcal1.Image != null)
darienf 3:36de8b9e4b1a 152 {
darienf 3:36de8b9e4b1a 153 picBioZLcal1.Image.Dispose();
darienf 3:36de8b9e4b1a 154 picBioZLcal1.Image = Properties.Resources.bioz_load_cal1;
darienf 3:36de8b9e4b1a 155 }
darienf 3:36de8b9e4b1a 156 else
darienf 3:36de8b9e4b1a 157 {
darienf 3:36de8b9e4b1a 158 picBioZLcal1.Image = null;
darienf 3:36de8b9e4b1a 159 }
darienf 3:36de8b9e4b1a 160 if (picBioZLcal2.Image != null)
darienf 3:36de8b9e4b1a 161 {
darienf 3:36de8b9e4b1a 162 picBioZLcal2.Image.Dispose();
darienf 3:36de8b9e4b1a 163 picBioZLcal2.Image = Properties.Resources.bioz_load_cal2;
darienf 3:36de8b9e4b1a 164 }
darienf 3:36de8b9e4b1a 165 else
darienf 3:36de8b9e4b1a 166 {
darienf 3:36de8b9e4b1a 167 picBioZLcal2.Image = null;
darienf 3:36de8b9e4b1a 168 }
darienf 3:36de8b9e4b1a 169
darienf 3:36de8b9e4b1a 170 //Resistive Load Enable Logic
darienf 3:36de8b9e4b1a 171 if (picBioZLresload.Image != null)
darienf 3:36de8b9e4b1a 172 picBioZLresload.Image.Dispose();
darienf 3:36de8b9e4b1a 173 if (cboBioZBmuxEnBist.SelectedIndex == 1)
darienf 3:36de8b9e4b1a 174 {
darienf 3:36de8b9e4b1a 175 picBioZLresload.Image = Properties.Resources.bioz_load_resload;
darienf 3:36de8b9e4b1a 176 }
darienf 3:36de8b9e4b1a 177 else
darienf 3:36de8b9e4b1a 178 {
darienf 3:36de8b9e4b1a 179 picBioZLresload.Image = null;
darienf 3:36de8b9e4b1a 180 }
darienf 3:36de8b9e4b1a 181 }
darienf 3:36de8b9e4b1a 182
darienf 3:36de8b9e4b1a 183 void BioZLoadUpdateRegisters()
darienf 3:36de8b9e4b1a 184 {
darienf 3:36de8b9e4b1a 185 internalUpdate = true;
darienf 3:36de8b9e4b1a 186 ReadComboBoxesRegisters(bioZLoadField);
darienf 3:36de8b9e4b1a 187 //UpdateBioZLoadSwitches(); moved to Form1.cs BioZLoad tab selection section
darienf 3:36de8b9e4b1a 188 internalUpdate = false;
darienf 3:36de8b9e4b1a 189 }
darienf 3:36de8b9e4b1a 190
darienf 3:36de8b9e4b1a 191 private void cboBioZBmuxEnBist_SelectedIndexChanged(object sender, EventArgs e)
darienf 3:36de8b9e4b1a 192 {
darienf 3:36de8b9e4b1a 193 UpdateBioZLoadSwitches();
darienf 3:36de8b9e4b1a 194 }
darienf 3:36de8b9e4b1a 195
darienf 3:36de8b9e4b1a 196 }
darienf 3:36de8b9e4b1a 197 }