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
RegisterInfo.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 RPCSupport.DeviceSupport 00042 { 00043 public class RegisterInfo 00044 { 00045 public String name; 00046 public int address; 00047 public int[] data; 00048 public int numBytes = 1; 00049 public RegisterBitDescriptions description; 00050 public RegisterType type; 00051 public RegisterInfo(String name, int address, RegisterType type) 00052 { 00053 this.name = name; 00054 this.address = address; 00055 data = new int[numBytes]; 00056 description = new RegisterBitDescriptions(); 00057 this.type = type; 00058 } 00059 00060 public RegisterInfo(String name, int address) : this (name, address, RegisterType.None) 00061 { 00062 } 00063 00064 public RegisterInfo(String name, int address, int numBytes, RegisterType type) 00065 { 00066 this.name = name; 00067 this.address = address; 00068 this.numBytes = numBytes; 00069 data = new int[numBytes]; 00070 description = new RegisterBitDescriptions(); 00071 this.type = type; 00072 } 00073 00074 public RegisterInfo(String name, int address, int numBytes) : this (name, address, numBytes, RegisterType.None) 00075 { 00076 00077 } 00078 00079 public string detailedName 00080 { 00081 get 00082 { 00083 string longName = name; 00084 00085 if (type == RegisterType.ReadOnly) 00086 longName += " (Read Only)"; 00087 else if (type == RegisterType.WriteOnly) 00088 longName += " (Write Only)"; 00089 00090 return longName; 00091 } 00092 } 00093 00094 public int dataField 00095 { 00096 get 00097 { 00098 int val = 0; 00099 int temp; 00100 00101 // For Temperature Sensor and standard I2C device 00102 for (int i = 0; i < numBytes; i++) 00103 { 00104 temp = data[i] << ((numBytes - 1 - i) * 8); 00105 //temp = reg.data[i] << 8 * i; 00106 val |= temp; 00107 } 00108 00109 return val; 00110 } 00111 } 00112 00113 public enum RegisterType 00114 { 00115 ReadOnly, 00116 WriteOnly, 00117 None 00118 }; 00119 } 00120 }
Generated on Thu Jul 28 2022 18:07:15 by
1.7.2