repo time
Dependencies: mbed MAX14720 MAX30205 USBDevice
HspGuiSourceV301/GuiDLLs/RPCSupport/RPCClient.cs@20:6d2af70c92ab, 2021-04-06 (annotated)
- Committer:
- darienf
- Date:
- Tue Apr 06 06:41:40 2021 +0000
- Revision:
- 20:6d2af70c92ab
another repo
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
darienf | 20:6d2af70c92ab | 1 | /******************************************************************************* |
darienf | 20:6d2af70c92ab | 2 | * Copyright (C) 2016 Maxim Integrated Products, Inc., All rights Reserved. |
darienf | 20:6d2af70c92ab | 3 | * |
darienf | 20:6d2af70c92ab | 4 | * This software is protected by copyright laws of the United States and |
darienf | 20:6d2af70c92ab | 5 | * of foreign countries. This material may also be protected by patent laws |
darienf | 20:6d2af70c92ab | 6 | * and technology transfer regulations of the United States and of foreign |
darienf | 20:6d2af70c92ab | 7 | * countries. This software is furnished under a license agreement and/or a |
darienf | 20:6d2af70c92ab | 8 | * nondisclosure agreement and may only be used or reproduced in accordance |
darienf | 20:6d2af70c92ab | 9 | * with the terms of those agreements. Dissemination of this information to |
darienf | 20:6d2af70c92ab | 10 | * any party or parties not specified in the license agreement and/or |
darienf | 20:6d2af70c92ab | 11 | * nondisclosure agreement is expressly prohibited. |
darienf | 20:6d2af70c92ab | 12 | * |
darienf | 20:6d2af70c92ab | 13 | * The above copyright notice and this permission notice shall be included |
darienf | 20:6d2af70c92ab | 14 | * in all copies or substantial portions of the Software. |
darienf | 20:6d2af70c92ab | 15 | * |
darienf | 20:6d2af70c92ab | 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
darienf | 20:6d2af70c92ab | 17 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
darienf | 20:6d2af70c92ab | 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
darienf | 20:6d2af70c92ab | 19 | * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES |
darienf | 20:6d2af70c92ab | 20 | * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
darienf | 20:6d2af70c92ab | 21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
darienf | 20:6d2af70c92ab | 22 | * OTHER DEALINGS IN THE SOFTWARE. |
darienf | 20:6d2af70c92ab | 23 | * |
darienf | 20:6d2af70c92ab | 24 | * Except as contained in this notice, the name of Maxim Integrated |
darienf | 20:6d2af70c92ab | 25 | * Products, Inc. shall not be used except as stated in the Maxim Integrated |
darienf | 20:6d2af70c92ab | 26 | * Products, Inc. Branding Policy. |
darienf | 20:6d2af70c92ab | 27 | * |
darienf | 20:6d2af70c92ab | 28 | * The mere transfer of this software does not imply any licenses |
darienf | 20:6d2af70c92ab | 29 | * of trade secrets, proprietary technology, copyrights, patents, |
darienf | 20:6d2af70c92ab | 30 | * trademarks, maskwork rights, or any other form of intellectual |
darienf | 20:6d2af70c92ab | 31 | * property whatsoever. Maxim Integrated Products, Inc. retains all |
darienf | 20:6d2af70c92ab | 32 | * ownership rights. |
darienf | 20:6d2af70c92ab | 33 | ******************************************************************************* |
darienf | 20:6d2af70c92ab | 34 | */ |
darienf | 20:6d2af70c92ab | 35 | |
darienf | 20:6d2af70c92ab | 36 | using System; |
darienf | 20:6d2af70c92ab | 37 | using System.Collections.Generic; |
darienf | 20:6d2af70c92ab | 38 | using System.Linq; |
darienf | 20:6d2af70c92ab | 39 | using System.Text; |
darienf | 20:6d2af70c92ab | 40 | using RPCSupport.Pipelines; |
darienf | 20:6d2af70c92ab | 41 | using RPCSupport.Devices; |
darienf | 20:6d2af70c92ab | 42 | using RPCSupport.Dialogs; |
darienf | 20:6d2af70c92ab | 43 | |
darienf | 20:6d2af70c92ab | 44 | namespace RPCSupport |
darienf | 20:6d2af70c92ab | 45 | { |
darienf | 20:6d2af70c92ab | 46 | public class RPCClient |
darienf | 20:6d2af70c92ab | 47 | { |
darienf | 20:6d2af70c92ab | 48 | public enum ePipeline |
darienf | 20:6d2af70c92ab | 49 | { |
darienf | 20:6d2af70c92ab | 50 | eHid, |
darienf | 20:6d2af70c92ab | 51 | eSerial, |
darienf | 20:6d2af70c92ab | 52 | eHttp, |
darienf | 20:6d2af70c92ab | 53 | eSerialWrap |
darienf | 20:6d2af70c92ab | 54 | } |
darienf | 20:6d2af70c92ab | 55 | |
darienf | 20:6d2af70c92ab | 56 | //SerialPipeline serialPipeline; |
darienf | 20:6d2af70c92ab | 57 | const string SPINAME = "Spi"; |
darienf | 20:6d2af70c92ab | 58 | I2cDevice i2cDevice; |
darienf | 20:6d2af70c92ab | 59 | SpiDevice spiDevice; |
darienf | 20:6d2af70c92ab | 60 | bool rpcLogShown = false; |
darienf | 20:6d2af70c92ab | 61 | public RPCSupport.Streaming.Streaming streaming; |
darienf | 20:6d2af70c92ab | 62 | |
darienf | 20:6d2af70c92ab | 63 | public Pipeline pipeline; |
darienf | 20:6d2af70c92ab | 64 | |
darienf | 20:6d2af70c92ab | 65 | public Pipeline Pipeline |
darienf | 20:6d2af70c92ab | 66 | { |
darienf | 20:6d2af70c92ab | 67 | get { return pipeline; } |
darienf | 20:6d2af70c92ab | 68 | } |
darienf | 20:6d2af70c92ab | 69 | |
darienf | 20:6d2af70c92ab | 70 | LIS2HD lis2hd; |
darienf | 20:6d2af70c92ab | 71 | public LIS2HD LIS2HD |
darienf | 20:6d2af70c92ab | 72 | { |
darienf | 20:6d2af70c92ab | 73 | get { return lis2hd; } |
darienf | 20:6d2af70c92ab | 74 | set { lis2hd = value; } |
darienf | 20:6d2af70c92ab | 75 | } |
darienf | 20:6d2af70c92ab | 76 | |
darienf | 20:6d2af70c92ab | 77 | public I2cDevice I2cDevice |
darienf | 20:6d2af70c92ab | 78 | { |
darienf | 20:6d2af70c92ab | 79 | get { return i2cDevice; } |
darienf | 20:6d2af70c92ab | 80 | set { i2cDevice = value; } |
darienf | 20:6d2af70c92ab | 81 | } |
darienf | 20:6d2af70c92ab | 82 | public SpiDevice SpiDevice |
darienf | 20:6d2af70c92ab | 83 | { |
darienf | 20:6d2af70c92ab | 84 | get { return spiDevice; } |
darienf | 20:6d2af70c92ab | 85 | set { spiDevice = value; } |
darienf | 20:6d2af70c92ab | 86 | } |
darienf | 20:6d2af70c92ab | 87 | |
darienf | 20:6d2af70c92ab | 88 | MAX30101 max30101; |
darienf | 20:6d2af70c92ab | 89 | public MAX30101 MAX30101 |
darienf | 20:6d2af70c92ab | 90 | { |
darienf | 20:6d2af70c92ab | 91 | get { return max30101; } |
darienf | 20:6d2af70c92ab | 92 | set { max30101 = value; } |
darienf | 20:6d2af70c92ab | 93 | } |
darienf | 20:6d2af70c92ab | 94 | |
darienf | 20:6d2af70c92ab | 95 | MAX30001 max30001; |
darienf | 20:6d2af70c92ab | 96 | public MAX30001 MAX30001 |
darienf | 20:6d2af70c92ab | 97 | { |
darienf | 20:6d2af70c92ab | 98 | get { return max30001; } |
darienf | 20:6d2af70c92ab | 99 | set { max30001 = value; } |
darienf | 20:6d2af70c92ab | 100 | } |
darienf | 20:6d2af70c92ab | 101 | |
darienf | 20:6d2af70c92ab | 102 | MAX30205 max30205; |
darienf | 20:6d2af70c92ab | 103 | public MAX30205 MAX30205 |
darienf | 20:6d2af70c92ab | 104 | { |
darienf | 20:6d2af70c92ab | 105 | get { return max30205; } |
darienf | 20:6d2af70c92ab | 106 | set { max30205 = value; } |
darienf | 20:6d2af70c92ab | 107 | } |
darienf | 20:6d2af70c92ab | 108 | |
darienf | 20:6d2af70c92ab | 109 | DataLogging.DataLogging dataLogging; |
darienf | 20:6d2af70c92ab | 110 | public DataLogging.DataLogging DataLogging |
darienf | 20:6d2af70c92ab | 111 | { |
darienf | 20:6d2af70c92ab | 112 | get { return dataLogging; } |
darienf | 20:6d2af70c92ab | 113 | set { dataLogging = value; } |
darienf | 20:6d2af70c92ab | 114 | } |
darienf | 20:6d2af70c92ab | 115 | |
darienf | 20:6d2af70c92ab | 116 | Devices.Led led; |
darienf | 20:6d2af70c92ab | 117 | public Devices.Led Led |
darienf | 20:6d2af70c92ab | 118 | { |
darienf | 20:6d2af70c92ab | 119 | get { return led; } |
darienf | 20:6d2af70c92ab | 120 | set { led = value; } |
darienf | 20:6d2af70c92ab | 121 | } |
darienf | 20:6d2af70c92ab | 122 | |
darienf | 20:6d2af70c92ab | 123 | Devices.Testing testing; |
darienf | 20:6d2af70c92ab | 124 | public Devices.Testing Testing |
darienf | 20:6d2af70c92ab | 125 | { |
darienf | 20:6d2af70c92ab | 126 | get { return testing; } |
darienf | 20:6d2af70c92ab | 127 | set { testing = value; } |
darienf | 20:6d2af70c92ab | 128 | } |
darienf | 20:6d2af70c92ab | 129 | |
darienf | 20:6d2af70c92ab | 130 | Devices.S25FS512 s25FS512; |
darienf | 20:6d2af70c92ab | 131 | public Devices.S25FS512 S25FS512 |
darienf | 20:6d2af70c92ab | 132 | { |
darienf | 20:6d2af70c92ab | 133 | get { return s25FS512; } |
darienf | 20:6d2af70c92ab | 134 | set { s25FS512 = value; } |
darienf | 20:6d2af70c92ab | 135 | } |
darienf | 20:6d2af70c92ab | 136 | |
darienf | 20:6d2af70c92ab | 137 | public RPCClient(ePipeline pipelineType) |
darienf | 20:6d2af70c92ab | 138 | { |
darienf | 20:6d2af70c92ab | 139 | switch (pipelineType) |
darienf | 20:6d2af70c92ab | 140 | { |
darienf | 20:6d2af70c92ab | 141 | case ePipeline.eHid: |
darienf | 20:6d2af70c92ab | 142 | pipeline = new HidPipeline(); |
darienf | 20:6d2af70c92ab | 143 | break; |
darienf | 20:6d2af70c92ab | 144 | case ePipeline.eSerial: |
darienf | 20:6d2af70c92ab | 145 | pipeline = new SerialPipeline(); |
darienf | 20:6d2af70c92ab | 146 | break; |
darienf | 20:6d2af70c92ab | 147 | case ePipeline.eHttp: |
darienf | 20:6d2af70c92ab | 148 | break; |
darienf | 20:6d2af70c92ab | 149 | case ePipeline.eSerialWrap: |
darienf | 20:6d2af70c92ab | 150 | pipeline = new SerialWrapPipeline(); |
darienf | 20:6d2af70c92ab | 151 | break; |
darienf | 20:6d2af70c92ab | 152 | } |
darienf | 20:6d2af70c92ab | 153 | ShowRpcLog(false); |
darienf | 20:6d2af70c92ab | 154 | LogCallback(new RPCSupport.Pipelines.Pipeline.RawRpcRequest(LogRpcRequest), new RPCSupport.Pipelines.Pipeline.RawRpcReply(LogRpcReply), new RPCSupport.Pipelines.Pipeline.RawRpcStream(LogRpcStream)); |
darienf | 20:6d2af70c92ab | 155 | streaming = new Streaming.Streaming(); |
darienf | 20:6d2af70c92ab | 156 | } |
darienf | 20:6d2af70c92ab | 157 | |
darienf | 20:6d2af70c92ab | 158 | void LogRpcRequest(string request) |
darienf | 20:6d2af70c92ab | 159 | { |
darienf | 20:6d2af70c92ab | 160 | rpcLog.LogRpcRequest(request); |
darienf | 20:6d2af70c92ab | 161 | } |
darienf | 20:6d2af70c92ab | 162 | |
darienf | 20:6d2af70c92ab | 163 | void LogRpcReply(string reply) |
darienf | 20:6d2af70c92ab | 164 | { |
darienf | 20:6d2af70c92ab | 165 | rpcLog.LogRpcReply(reply); |
darienf | 20:6d2af70c92ab | 166 | } |
darienf | 20:6d2af70c92ab | 167 | |
darienf | 20:6d2af70c92ab | 168 | void LogRpcStream(string stream) |
darienf | 20:6d2af70c92ab | 169 | { |
darienf | 20:6d2af70c92ab | 170 | rpcLog.LogRpcStream(stream); |
darienf | 20:6d2af70c92ab | 171 | } |
darienf | 20:6d2af70c92ab | 172 | |
darienf | 20:6d2af70c92ab | 173 | public void LogCallback(RPCSupport.Pipelines.Pipeline.RawRpcRequest request, RPCSupport.Pipelines.Pipeline.RawRpcReply reply, RPCSupport.Pipelines.Pipeline.RawRpcStream stream) |
darienf | 20:6d2af70c92ab | 174 | { |
darienf | 20:6d2af70c92ab | 175 | pipeline.LogCallback(request, reply, stream); |
darienf | 20:6d2af70c92ab | 176 | } |
darienf | 20:6d2af70c92ab | 177 | |
darienf | 20:6d2af70c92ab | 178 | public void Connect(string param) { |
darienf | 20:6d2af70c92ab | 179 | pipeline.Connect(param); |
darienf | 20:6d2af70c92ab | 180 | } |
darienf | 20:6d2af70c92ab | 181 | |
darienf | 20:6d2af70c92ab | 182 | public void Disconnect() |
darienf | 20:6d2af70c92ab | 183 | { |
darienf | 20:6d2af70c92ab | 184 | pipeline.Disconnect(); |
darienf | 20:6d2af70c92ab | 185 | } |
darienf | 20:6d2af70c92ab | 186 | |
darienf | 20:6d2af70c92ab | 187 | public string[] ScanAvailablePortNames() { |
darienf | 20:6d2af70c92ab | 188 | return pipeline.ScanAvailablePortNames(); |
darienf | 20:6d2af70c92ab | 189 | } |
darienf | 20:6d2af70c92ab | 190 | |
darienf | 20:6d2af70c92ab | 191 | public bool InitPipeline() |
darienf | 20:6d2af70c92ab | 192 | { |
darienf | 20:6d2af70c92ab | 193 | bool ret = pipeline.Init(); |
darienf | 20:6d2af70c92ab | 194 | return ret; |
darienf | 20:6d2af70c92ab | 195 | } |
darienf | 20:6d2af70c92ab | 196 | |
darienf | 20:6d2af70c92ab | 197 | public bool IsConnected() |
darienf | 20:6d2af70c92ab | 198 | { |
darienf | 20:6d2af70c92ab | 199 | return pipeline.IsConnected(); |
darienf | 20:6d2af70c92ab | 200 | } |
darienf | 20:6d2af70c92ab | 201 | |
darienf | 20:6d2af70c92ab | 202 | public String RawRpcCall(String request, bool reply) |
darienf | 20:6d2af70c92ab | 203 | { |
darienf | 20:6d2af70c92ab | 204 | return pipeline.RawRpcCall(request, reply); |
darienf | 20:6d2af70c92ab | 205 | } |
darienf | 20:6d2af70c92ab | 206 | |
darienf | 20:6d2af70c92ab | 207 | public Devices.MAX30101 Init_MAX30101(int slaveAddress) |
darienf | 20:6d2af70c92ab | 208 | { |
darienf | 20:6d2af70c92ab | 209 | MAX30101 = new RPCSupport.Devices.MAX30101(this, slaveAddress); |
darienf | 20:6d2af70c92ab | 210 | return MAX30101; |
darienf | 20:6d2af70c92ab | 211 | } |
darienf | 20:6d2af70c92ab | 212 | |
darienf | 20:6d2af70c92ab | 213 | public Devices.MAX30001 Init_MAX30001() |
darienf | 20:6d2af70c92ab | 214 | { |
darienf | 20:6d2af70c92ab | 215 | MAX30001 = new RPCSupport.Devices.MAX30001(this); |
darienf | 20:6d2af70c92ab | 216 | return MAX30001; |
darienf | 20:6d2af70c92ab | 217 | } |
darienf | 20:6d2af70c92ab | 218 | |
darienf | 20:6d2af70c92ab | 219 | public Devices.MAX30205 Init_MAX30205(int slaveAddress) |
darienf | 20:6d2af70c92ab | 220 | { |
darienf | 20:6d2af70c92ab | 221 | MAX30205 = new RPCSupport.Devices.MAX30205(this, slaveAddress); |
darienf | 20:6d2af70c92ab | 222 | return MAX30205; |
darienf | 20:6d2af70c92ab | 223 | } |
darienf | 20:6d2af70c92ab | 224 | |
darienf | 20:6d2af70c92ab | 225 | public Devices.LIS2HD Init_LIS2HD(int slaveAddress) |
darienf | 20:6d2af70c92ab | 226 | { |
darienf | 20:6d2af70c92ab | 227 | LIS2HD = new RPCSupport.Devices.LIS2HD(this, slaveAddress); |
darienf | 20:6d2af70c92ab | 228 | return LIS2HD; |
darienf | 20:6d2af70c92ab | 229 | } |
darienf | 20:6d2af70c92ab | 230 | |
darienf | 20:6d2af70c92ab | 231 | public Devices.I2cDevice Init_I2cDevice() |
darienf | 20:6d2af70c92ab | 232 | { |
darienf | 20:6d2af70c92ab | 233 | I2cDevice = new RPCSupport.Devices.I2cDevice(this); |
darienf | 20:6d2af70c92ab | 234 | return I2cDevice; |
darienf | 20:6d2af70c92ab | 235 | } |
darienf | 20:6d2af70c92ab | 236 | |
darienf | 20:6d2af70c92ab | 237 | public Devices.SpiDevice Init_SpiDevice() |
darienf | 20:6d2af70c92ab | 238 | { |
darienf | 20:6d2af70c92ab | 239 | SpiDevice = new RPCSupport.Devices.SpiDevice(this); |
darienf | 20:6d2af70c92ab | 240 | return SpiDevice; |
darienf | 20:6d2af70c92ab | 241 | } |
darienf | 20:6d2af70c92ab | 242 | |
darienf | 20:6d2af70c92ab | 243 | public DataLogging.DataLogging Init_Logging() |
darienf | 20:6d2af70c92ab | 244 | { |
darienf | 20:6d2af70c92ab | 245 | dataLogging = new RPCSupport.DataLogging.DataLogging(this); |
darienf | 20:6d2af70c92ab | 246 | return dataLogging; |
darienf | 20:6d2af70c92ab | 247 | } |
darienf | 20:6d2af70c92ab | 248 | |
darienf | 20:6d2af70c92ab | 249 | public RPCSupport.Devices.Led Init_Led() |
darienf | 20:6d2af70c92ab | 250 | { |
darienf | 20:6d2af70c92ab | 251 | led = new RPCSupport.Devices.Led(this); |
darienf | 20:6d2af70c92ab | 252 | return led; |
darienf | 20:6d2af70c92ab | 253 | } |
darienf | 20:6d2af70c92ab | 254 | |
darienf | 20:6d2af70c92ab | 255 | public RPCSupport.Devices.Testing Init_Testing() |
darienf | 20:6d2af70c92ab | 256 | { |
darienf | 20:6d2af70c92ab | 257 | testing = new RPCSupport.Devices.Testing(this); |
darienf | 20:6d2af70c92ab | 258 | return testing; |
darienf | 20:6d2af70c92ab | 259 | } |
darienf | 20:6d2af70c92ab | 260 | |
darienf | 20:6d2af70c92ab | 261 | public RPCSupport.Devices.S25FS512 Init_S25FS512() |
darienf | 20:6d2af70c92ab | 262 | { |
darienf | 20:6d2af70c92ab | 263 | s25FS512 = new RPCSupport.Devices.S25FS512(this); |
darienf | 20:6d2af70c92ab | 264 | return s25FS512; |
darienf | 20:6d2af70c92ab | 265 | } |
darienf | 20:6d2af70c92ab | 266 | |
darienf | 20:6d2af70c92ab | 267 | |
darienf | 20:6d2af70c92ab | 268 | public void ReadRegister(DeviceSupport.DeviceDetails deviceDetails, DeviceSupport.RegisterInfo reg) |
darienf | 20:6d2af70c92ab | 269 | { |
darienf | 20:6d2af70c92ab | 270 | int hex; |
darienf | 20:6d2af70c92ab | 271 | |
darienf | 20:6d2af70c92ab | 272 | switch (deviceDetails.type) |
darienf | 20:6d2af70c92ab | 273 | { |
darienf | 20:6d2af70c92ab | 274 | case DeviceSupport.DeviceDetails.eType.eI2c: |
darienf | 20:6d2af70c92ab | 275 | i2cDevice.ReadReg(deviceDetails, reg); |
darienf | 20:6d2af70c92ab | 276 | break; |
darienf | 20:6d2af70c92ab | 277 | case DeviceSupport.DeviceDetails.eType.eSpi: |
darienf | 20:6d2af70c92ab | 278 | spiDevice.ReadReg(deviceDetails, reg); |
darienf | 20:6d2af70c92ab | 279 | break; |
darienf | 20:6d2af70c92ab | 280 | case DeviceSupport.DeviceDetails.eType.eMAX30001: |
darienf | 20:6d2af70c92ab | 281 | //reg.data[0] = max30001.ReadReg((byte)reg.address); |
darienf | 20:6d2af70c92ab | 282 | hex = max30001.ReadReg((byte)reg.address); |
darienf | 20:6d2af70c92ab | 283 | reg.data[0] = (hex >> 16) & 0xFF; |
darienf | 20:6d2af70c92ab | 284 | reg.data[1] = (hex >> 8) & 0xFF; |
darienf | 20:6d2af70c92ab | 285 | reg.data[2] = hex & 0xFF; |
darienf | 20:6d2af70c92ab | 286 | break; |
darienf | 20:6d2af70c92ab | 287 | case DeviceSupport.DeviceDetails.eType.eMAX30205: |
darienf | 20:6d2af70c92ab | 288 | //reg.data[0] = max30001.ReadReg((byte)reg.address); |
darienf | 20:6d2af70c92ab | 289 | hex = max30205.ReadReg((byte)reg.address); |
darienf | 20:6d2af70c92ab | 290 | reg.data[0] = (hex >> 8) & 0xFF; |
darienf | 20:6d2af70c92ab | 291 | reg.data[1] = hex & 0xFF; |
darienf | 20:6d2af70c92ab | 292 | break; |
darienf | 20:6d2af70c92ab | 293 | } |
darienf | 20:6d2af70c92ab | 294 | } |
darienf | 20:6d2af70c92ab | 295 | |
darienf | 20:6d2af70c92ab | 296 | public void WriteRegister(DeviceSupport.DeviceDetails deviceDetails, DeviceSupport.RegisterInfo reg) |
darienf | 20:6d2af70c92ab | 297 | { |
darienf | 20:6d2af70c92ab | 298 | switch (deviceDetails.type) |
darienf | 20:6d2af70c92ab | 299 | { |
darienf | 20:6d2af70c92ab | 300 | case DeviceSupport.DeviceDetails.eType.eI2c: |
darienf | 20:6d2af70c92ab | 301 | i2cDevice.WriteReg(deviceDetails, reg); |
darienf | 20:6d2af70c92ab | 302 | break; |
darienf | 20:6d2af70c92ab | 303 | case DeviceSupport.DeviceDetails.eType.eSpi: |
darienf | 20:6d2af70c92ab | 304 | spiDevice.WriteReg(deviceDetails, reg); |
darienf | 20:6d2af70c92ab | 305 | break; |
darienf | 20:6d2af70c92ab | 306 | case DeviceSupport.DeviceDetails.eType.eMAX30001: |
darienf | 20:6d2af70c92ab | 307 | //max30001.WriteReg((byte)reg.address, reg.data[0]); |
darienf | 20:6d2af70c92ab | 308 | max30001.WriteReg((byte)reg.address, reg.data[2] | reg.data[1] << 8 | reg.data[0] << 16); |
darienf | 20:6d2af70c92ab | 309 | break; |
darienf | 20:6d2af70c92ab | 310 | case DeviceSupport.DeviceDetails.eType.eMAX30205: |
darienf | 20:6d2af70c92ab | 311 | max30001.WriteReg((byte)reg.address, reg.data[1] | reg.data[0] << 8); |
darienf | 20:6d2af70c92ab | 312 | break; |
darienf | 20:6d2af70c92ab | 313 | } |
darienf | 20:6d2af70c92ab | 314 | } |
darienf | 20:6d2af70c92ab | 315 | |
darienf | 20:6d2af70c92ab | 316 | RpcLog rpcLog; |
darienf | 20:6d2af70c92ab | 317 | public void ShowRpcLog(bool state) |
darienf | 20:6d2af70c92ab | 318 | { |
darienf | 20:6d2af70c92ab | 319 | if (rpcLog == null) |
darienf | 20:6d2af70c92ab | 320 | { |
darienf | 20:6d2af70c92ab | 321 | rpcLog = new RpcLog(); |
darienf | 20:6d2af70c92ab | 322 | } |
darienf | 20:6d2af70c92ab | 323 | rpcLogShown = state; |
darienf | 20:6d2af70c92ab | 324 | if (state == true) |
darienf | 20:6d2af70c92ab | 325 | rpcLog.Show(); |
darienf | 20:6d2af70c92ab | 326 | else |
darienf | 20:6d2af70c92ab | 327 | rpcLog.Hide(); |
darienf | 20:6d2af70c92ab | 328 | } |
darienf | 20:6d2af70c92ab | 329 | |
darienf | 20:6d2af70c92ab | 330 | public bool IsRpcLogShown() |
darienf | 20:6d2af70c92ab | 331 | { |
darienf | 20:6d2af70c92ab | 332 | return rpcLogShown; |
darienf | 20:6d2af70c92ab | 333 | } |
darienf | 20:6d2af70c92ab | 334 | |
darienf | 20:6d2af70c92ab | 335 | public string Version() |
darienf | 20:6d2af70c92ab | 336 | { |
darienf | 20:6d2af70c92ab | 337 | return RawRpcCall("/System/ReadVer\r\n", true); |
darienf | 20:6d2af70c92ab | 338 | } |
darienf | 20:6d2af70c92ab | 339 | } |
darienf | 20:6d2af70c92ab | 340 | } |