Wilson Tang
/
HSP_RPC_GUI
Fork of the offical HSP_RPC_GUI firmware
Fork of MAXREFDES100 firmware for MAX32620HSP
HSP/Devices/MAX30101/MAX30101_RPC.cpp@4:18155622d30a, 2020-01-28 (annotated)
- Committer:
- wt8008
- Date:
- Tue Jan 28 20:22:16 2020 +0000
- Revision:
- 4:18155622d30a
- Parent:
- 1:9490836294ea
Update Maxim's USBDevice project to the latest version
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jbradshaw | 0:e4a10ed6eb92 | 1 | /******************************************************************************* |
jbradshaw | 0:e4a10ed6eb92 | 2 | * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved. |
jbradshaw | 0:e4a10ed6eb92 | 3 | * |
jbradshaw | 0:e4a10ed6eb92 | 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
jbradshaw | 0:e4a10ed6eb92 | 5 | * copy of this software and associated documentation files (the "Software"), |
jbradshaw | 0:e4a10ed6eb92 | 6 | * to deal in the Software without restriction, including without limitation |
jbradshaw | 0:e4a10ed6eb92 | 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
jbradshaw | 0:e4a10ed6eb92 | 8 | * and/or sell copies of the Software, and to permit persons to whom the |
jbradshaw | 0:e4a10ed6eb92 | 9 | * Software is furnished to do so, subject to the following conditions: |
jbradshaw | 0:e4a10ed6eb92 | 10 | * |
jbradshaw | 0:e4a10ed6eb92 | 11 | * The above copyright notice and this permission notice shall be included |
jbradshaw | 0:e4a10ed6eb92 | 12 | * in all copies or substantial portions of the Software. |
jbradshaw | 0:e4a10ed6eb92 | 13 | * |
jbradshaw | 0:e4a10ed6eb92 | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
jbradshaw | 0:e4a10ed6eb92 | 15 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
jbradshaw | 0:e4a10ed6eb92 | 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
jbradshaw | 0:e4a10ed6eb92 | 17 | * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES |
jbradshaw | 0:e4a10ed6eb92 | 18 | * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
jbradshaw | 0:e4a10ed6eb92 | 19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
jbradshaw | 0:e4a10ed6eb92 | 20 | * OTHER DEALINGS IN THE SOFTWARE. |
jbradshaw | 0:e4a10ed6eb92 | 21 | * |
jbradshaw | 0:e4a10ed6eb92 | 22 | * Except as contained in this notice, the name of Maxim Integrated |
jbradshaw | 0:e4a10ed6eb92 | 23 | * Products, Inc. shall not be used except as stated in the Maxim Integrated |
jbradshaw | 0:e4a10ed6eb92 | 24 | * Products, Inc. Branding Policy. |
jbradshaw | 0:e4a10ed6eb92 | 25 | * |
jbradshaw | 0:e4a10ed6eb92 | 26 | * The mere transfer of this software does not imply any licenses |
jbradshaw | 0:e4a10ed6eb92 | 27 | * of trade secrets, proprietary technology, copyrights, patents, |
jbradshaw | 0:e4a10ed6eb92 | 28 | * trademarks, maskwork rights, or any other form of intellectual |
jbradshaw | 0:e4a10ed6eb92 | 29 | * property whatsoever. Maxim Integrated Products, Inc. retains all |
jbradshaw | 0:e4a10ed6eb92 | 30 | * ownership rights. |
jbradshaw | 0:e4a10ed6eb92 | 31 | ******************************************************************************* |
jbradshaw | 0:e4a10ed6eb92 | 32 | */ |
jbradshaw | 0:e4a10ed6eb92 | 33 | #include "MAX30101_RPC.h" |
jbradshaw | 0:e4a10ed6eb92 | 34 | #include "StringHelper.h" |
jbradshaw | 0:e4a10ed6eb92 | 35 | #include "MAX30101.h" |
jbradshaw | 0:e4a10ed6eb92 | 36 | #include "Streaming.h" |
jbradshaw | 0:e4a10ed6eb92 | 37 | #include "RpcFifo.h" |
jbradshaw | 0:e4a10ed6eb92 | 38 | #include "RpcServer.h" |
jbradshaw | 0:e4a10ed6eb92 | 39 | #include "StringInOut.h" |
jbradshaw | 0:e4a10ed6eb92 | 40 | #include "MAX30101_helper.h" |
jbradshaw | 0:e4a10ed6eb92 | 41 | #include "LIS2DH.h" |
jbradshaw | 0:e4a10ed6eb92 | 42 | #include "Peripherals.h" |
jbradshaw | 0:e4a10ed6eb92 | 43 | #include "DataLoggingService.h" |
jbradshaw | 0:e4a10ed6eb92 | 44 | |
jbradshaw | 0:e4a10ed6eb92 | 45 | //****************************************************************************** |
jbradshaw | 0:e4a10ed6eb92 | 46 | int MAX30101_WriteReg(char argStrs[32][32], char replyStrs[32][32]) { |
jbradshaw | 0:e4a10ed6eb92 | 47 | uint8_t args[2]; |
jbradshaw | 0:e4a10ed6eb92 | 48 | uint8_t reply[1]; |
jbradshaw | 0:e4a10ed6eb92 | 49 | ProcessArgs(argStrs, args, sizeof(args)); |
jbradshaw | 0:e4a10ed6eb92 | 50 | reply[0] = 0x80; |
jbradshaw | 0:e4a10ed6eb92 | 51 | FormatReply(reply, sizeof(reply), replyStrs); |
jbradshaw | 0:e4a10ed6eb92 | 52 | return 0; |
jbradshaw | 0:e4a10ed6eb92 | 53 | } |
jbradshaw | 0:e4a10ed6eb92 | 54 | |
jbradshaw | 0:e4a10ed6eb92 | 55 | //****************************************************************************** |
jbradshaw | 0:e4a10ed6eb92 | 56 | int MAX30101_ReadReg(char argStrs[32][32], char replyStrs[32][32]) { |
jbradshaw | 0:e4a10ed6eb92 | 57 | uint8_t args[1]; |
jbradshaw | 0:e4a10ed6eb92 | 58 | uint8_t reply[1]; |
jbradshaw | 1:9490836294ea | 59 | char value = 0; |
jbradshaw | 0:e4a10ed6eb92 | 60 | ProcessArgs(argStrs, args, sizeof(args)); |
jbradshaw | 0:e4a10ed6eb92 | 61 | reply[0] = (uint8_t)value; |
jbradshaw | 0:e4a10ed6eb92 | 62 | FormatReply(reply, sizeof(reply), replyStrs); |
jbradshaw | 0:e4a10ed6eb92 | 63 | return 0; |
jbradshaw | 0:e4a10ed6eb92 | 64 | } |
jbradshaw | 0:e4a10ed6eb92 | 65 | |
jbradshaw | 0:e4a10ed6eb92 | 66 | //****************************************************************************** |
jbradshaw | 0:e4a10ed6eb92 | 67 | int MAX30101_COMMinit(char argStrs[32][32], char replyStrs[32][32]) |
jbradshaw | 0:e4a10ed6eb92 | 68 | { |
jbradshaw | 0:e4a10ed6eb92 | 69 | uint8_t args[4]; |
jbradshaw | 1:9490836294ea | 70 | uint8_t return_value = 0; |
jbradshaw | 0:e4a10ed6eb92 | 71 | ProcessArgs(argStrs,args,sizeof(args)); |
jbradshaw | 0:e4a10ed6eb92 | 72 | |
jbradshaw | 0:e4a10ed6eb92 | 73 | strcpy(replyStrs[0],"80"); |
jbradshaw | 0:e4a10ed6eb92 | 74 | return return_value; |
jbradshaw | 0:e4a10ed6eb92 | 75 | } |
jbradshaw | 0:e4a10ed6eb92 | 76 | |
jbradshaw | 0:e4a10ed6eb92 | 77 | //****************************************************************************** |
jbradshaw | 0:e4a10ed6eb92 | 78 | int MAX30101_SpO2mode_stop(char argStrs[32][32], char replyStrs[32][32]) |
jbradshaw | 0:e4a10ed6eb92 | 79 | { |
jbradshaw | 0:e4a10ed6eb92 | 80 | uint8_t args[4]; |
jbradshaw | 1:9490836294ea | 81 | uint8_t return_value = 0; |
jbradshaw | 0:e4a10ed6eb92 | 82 | ProcessArgs(argStrs,args,sizeof(args)); |
jbradshaw | 0:e4a10ed6eb92 | 83 | |
jbradshaw | 0:e4a10ed6eb92 | 84 | Peripherals::max30101()->SpO2mode_stop(); |
jbradshaw | 0:e4a10ed6eb92 | 85 | |
jbradshaw | 0:e4a10ed6eb92 | 86 | strcpy(replyStrs[0],"80"); |
jbradshaw | 0:e4a10ed6eb92 | 87 | return return_value; |
jbradshaw | 0:e4a10ed6eb92 | 88 | } |
jbradshaw | 0:e4a10ed6eb92 | 89 | |
jbradshaw | 0:e4a10ed6eb92 | 90 | //****************************************************************************** |
jbradshaw | 0:e4a10ed6eb92 | 91 | int MAX30101_HRmode_stop(char argStrs[32][32], char replyStrs[32][32]) |
jbradshaw | 0:e4a10ed6eb92 | 92 | { |
jbradshaw | 0:e4a10ed6eb92 | 93 | uint8_t args[4]; |
jbradshaw | 0:e4a10ed6eb92 | 94 | ProcessArgs(argStrs,args,sizeof(args)); |
jbradshaw | 0:e4a10ed6eb92 | 95 | |
jbradshaw | 0:e4a10ed6eb92 | 96 | Peripherals::max30101()->HRmode_stop(); |
jbradshaw | 0:e4a10ed6eb92 | 97 | |
jbradshaw | 0:e4a10ed6eb92 | 98 | strcpy(replyStrs[0],"80"); |
jbradshaw | 0:e4a10ed6eb92 | 99 | return 0; |
jbradshaw | 0:e4a10ed6eb92 | 100 | } |
jbradshaw | 0:e4a10ed6eb92 | 101 | |
jbradshaw | 0:e4a10ed6eb92 | 102 | //****************************************************************************** |
jbradshaw | 0:e4a10ed6eb92 | 103 | int MAX30101_Multimode_stop(char argStrs[32][32], char replyStrs[32][32]) |
jbradshaw | 0:e4a10ed6eb92 | 104 | { |
jbradshaw | 0:e4a10ed6eb92 | 105 | uint8_t args[4]; |
jbradshaw | 0:e4a10ed6eb92 | 106 | ProcessArgs(argStrs,args,sizeof(args)); |
jbradshaw | 0:e4a10ed6eb92 | 107 | |
jbradshaw | 0:e4a10ed6eb92 | 108 | Peripherals::max30101()->Multimode_stop(); |
jbradshaw | 0:e4a10ed6eb92 | 109 | |
jbradshaw | 0:e4a10ed6eb92 | 110 | strcpy(replyStrs[0],"80"); |
jbradshaw | 0:e4a10ed6eb92 | 111 | return 0; |
jbradshaw | 0:e4a10ed6eb92 | 112 | } |
jbradshaw | 0:e4a10ed6eb92 | 113 | |
jbradshaw | 0:e4a10ed6eb92 | 114 | //****************************************************************************** |
jbradshaw | 0:e4a10ed6eb92 | 115 | void ClearInOutFifos() { |
jbradshaw | 1:9490836294ea | 116 | fifo_clear(GetStreamOutFifo()); ///< clear stream out fifo |
jbradshaw | 1:9490836294ea | 117 | fifo_clear(GetUSBIncomingFifo()); ///< clear USB serial incoming fifo |
jbradshaw | 0:e4a10ed6eb92 | 118 | } |
jbradshaw | 0:e4a10ed6eb92 | 119 | |
jbradshaw | 0:e4a10ed6eb92 | 120 | int highDataRate = 0; |
jbradshaw | 0:e4a10ed6eb92 | 121 | #define MAX30101_200HZ 2 |
jbradshaw | 0:e4a10ed6eb92 | 122 | #define MAX30101_400HZ 3 |
jbradshaw | 0:e4a10ed6eb92 | 123 | |
jbradshaw | 0:e4a10ed6eb92 | 124 | /** |
jbradshaw | 0:e4a10ed6eb92 | 125 | * Adjust the threshold of the Accel based on the data rate |
jbradshaw | 0:e4a10ed6eb92 | 126 | * @lis2dhDataRate Data rate of the accel to determine what would be a good threshold value |
jbradshaw | 0:e4a10ed6eb92 | 127 | */ |
jbradshaw | 0:e4a10ed6eb92 | 128 | static int adjustAccelThreshold(int lis2dhDataRate) { |
jbradshaw | 0:e4a10ed6eb92 | 129 | int lis2dhFifoThreshold; |
jbradshaw | 0:e4a10ed6eb92 | 130 | lis2dhFifoThreshold = 31; |
jbradshaw | 0:e4a10ed6eb92 | 131 | if (lis2dhDataRate <= LIS2DH_DATARATE_50HZ) lis2dhFifoThreshold = 4; |
jbradshaw | 0:e4a10ed6eb92 | 132 | if (lis2dhDataRate == LIS2DH_DATARATE_100HZ) lis2dhFifoThreshold = 8; |
jbradshaw | 0:e4a10ed6eb92 | 133 | return lis2dhFifoThreshold; |
jbradshaw | 0:e4a10ed6eb92 | 134 | } |
jbradshaw | 0:e4a10ed6eb92 | 135 | |
jbradshaw | 0:e4a10ed6eb92 | 136 | /** |
jbradshaw | 0:e4a10ed6eb92 | 137 | * Evaluate the data rate of the Accel to see if we should stream using a high data rate mode |
jbradshaw | 0:e4a10ed6eb92 | 138 | * @lis2dhDataRate Data rate of the accel to determine if this is a high data rate |
jbradshaw | 0:e4a10ed6eb92 | 139 | */ |
jbradshaw | 0:e4a10ed6eb92 | 140 | static void adjustHighDataRate(int lis2dhDataRate) { |
jbradshaw | 0:e4a10ed6eb92 | 141 | highDataRate = 0; |
jbradshaw | 0:e4a10ed6eb92 | 142 | if (lis2dhDataRate >= LIS2DH_DATARATE_200HZ) highDataRate = 1; |
jbradshaw | 0:e4a10ed6eb92 | 143 | } |
jbradshaw | 0:e4a10ed6eb92 | 144 | |
jbradshaw | 0:e4a10ed6eb92 | 145 | //****************************************************************************** |
jbradshaw | 0:e4a10ed6eb92 | 146 | int MAX30101_SpO2mode_init(char argStrs[32][32], char replyStrs[32][32]) |
jbradshaw | 0:e4a10ed6eb92 | 147 | { |
jbradshaw | 0:e4a10ed6eb92 | 148 | uint8_t args[7]; |
jbradshaw | 0:e4a10ed6eb92 | 149 | uint8_t lis2dhDataRate; |
jbradshaw | 0:e4a10ed6eb92 | 150 | uint8_t lis2dhFifoThreshold; |
jbradshaw | 0:e4a10ed6eb92 | 151 | ProcessArgs(argStrs, args, sizeof(args)); |
jbradshaw | 0:e4a10ed6eb92 | 152 | |
jbradshaw | 0:e4a10ed6eb92 | 153 | ClearInOutFifos(); |
jbradshaw | 0:e4a10ed6eb92 | 154 | MAX30101_Helper_SetStreamingFlag(eStreaming_SPO2,1); |
jbradshaw | 0:e4a10ed6eb92 | 155 | Peripherals::max30101()->SpO2mode_init(args[0], args[1], args[2], args[3], args[4], args[5]); |
jbradshaw | 0:e4a10ed6eb92 | 156 | |
jbradshaw | 0:e4a10ed6eb92 | 157 | lis2dhDataRate = args[6]; |
jbradshaw | 0:e4a10ed6eb92 | 158 | lis2dhFifoThreshold = adjustAccelThreshold(lis2dhDataRate); |
jbradshaw | 0:e4a10ed6eb92 | 159 | adjustHighDataRate(lis2dhDataRate); |
jbradshaw | 0:e4a10ed6eb92 | 160 | |
jbradshaw | 0:e4a10ed6eb92 | 161 | Peripherals::lis2dh()->initStart(lis2dhDataRate,lis2dhFifoThreshold); |
jbradshaw | 0:e4a10ed6eb92 | 162 | LoggingService_StartLoggingUsb(); |
jbradshaw | 0:e4a10ed6eb92 | 163 | |
jbradshaw | 0:e4a10ed6eb92 | 164 | strcpy(replyStrs[0],"80"); |
jbradshaw | 0:e4a10ed6eb92 | 165 | return 0; |
jbradshaw | 0:e4a10ed6eb92 | 166 | } |
jbradshaw | 0:e4a10ed6eb92 | 167 | |
jbradshaw | 0:e4a10ed6eb92 | 168 | //****************************************************************************** |
jbradshaw | 0:e4a10ed6eb92 | 169 | int MAX30101_SpO2mode_InitStart(char argStrs[32][32], char replyStrs[32][32]) |
jbradshaw | 0:e4a10ed6eb92 | 170 | { |
jbradshaw | 0:e4a10ed6eb92 | 171 | uint8_t args[6]; // Size |
jbradshaw | 0:e4a10ed6eb92 | 172 | ProcessArgs(argStrs, args, sizeof(args)); |
jbradshaw | 0:e4a10ed6eb92 | 173 | |
jbradshaw | 0:e4a10ed6eb92 | 174 | ClearInOutFifos(); |
jbradshaw | 0:e4a10ed6eb92 | 175 | MAX30101_Helper_SetStreamingFlag(eStreaming_SPO2,1); |
jbradshaw | 1:9490836294ea | 176 | if (args[2] >= MAX30101_200HZ) { |
jbradshaw | 1:9490836294ea | 177 | highDataRate = 1; |
jbradshaw | 1:9490836294ea | 178 | } |
jbradshaw | 0:e4a10ed6eb92 | 179 | Peripherals::max30101()->SpO2mode_init(args[0], args[1], args[2], args[3], args[4], args[5]); |
jbradshaw | 0:e4a10ed6eb92 | 180 | |
jbradshaw | 0:e4a10ed6eb92 | 181 | strcpy(replyStrs[0],"80"); |
jbradshaw | 0:e4a10ed6eb92 | 182 | return 0; |
jbradshaw | 0:e4a10ed6eb92 | 183 | } |
jbradshaw | 0:e4a10ed6eb92 | 184 | |
jbradshaw | 0:e4a10ed6eb92 | 185 | //****************************************************************************** |
jbradshaw | 0:e4a10ed6eb92 | 186 | int MAX30101_HRmode_init(char argStrs[32][32], char replyStrs[32][32]) |
jbradshaw | 0:e4a10ed6eb92 | 187 | { |
jbradshaw | 0:e4a10ed6eb92 | 188 | uint8_t args[6]; |
jbradshaw | 0:e4a10ed6eb92 | 189 | uint8_t lis2dhDataRate; |
jbradshaw | 0:e4a10ed6eb92 | 190 | uint8_t lis2dhFifoThreshold; |
jbradshaw | 0:e4a10ed6eb92 | 191 | ProcessArgs(argStrs, args, sizeof(args)); |
jbradshaw | 0:e4a10ed6eb92 | 192 | |
jbradshaw | 0:e4a10ed6eb92 | 193 | ClearInOutFifos(); |
jbradshaw | 0:e4a10ed6eb92 | 194 | MAX30101_Helper_SetStreamingFlag(eStreaming_HR,1); |
jbradshaw | 0:e4a10ed6eb92 | 195 | Peripherals::max30101()->HRmode_init(args[0], args[1], args[2], args[3], args[4]); |
jbradshaw | 0:e4a10ed6eb92 | 196 | |
jbradshaw | 0:e4a10ed6eb92 | 197 | lis2dhDataRate = args[5]; |
jbradshaw | 0:e4a10ed6eb92 | 198 | lis2dhFifoThreshold = adjustAccelThreshold(lis2dhDataRate); |
jbradshaw | 0:e4a10ed6eb92 | 199 | adjustHighDataRate(lis2dhDataRate); |
jbradshaw | 0:e4a10ed6eb92 | 200 | |
jbradshaw | 0:e4a10ed6eb92 | 201 | Peripherals::lis2dh()->initStart(lis2dhDataRate,lis2dhFifoThreshold); |
jbradshaw | 0:e4a10ed6eb92 | 202 | LoggingService_StartLoggingUsb(); |
jbradshaw | 0:e4a10ed6eb92 | 203 | strcpy(replyStrs[0],"80"); |
jbradshaw | 0:e4a10ed6eb92 | 204 | return 0; |
jbradshaw | 0:e4a10ed6eb92 | 205 | } |
jbradshaw | 0:e4a10ed6eb92 | 206 | |
jbradshaw | 0:e4a10ed6eb92 | 207 | //****************************************************************************** |
jbradshaw | 0:e4a10ed6eb92 | 208 | int MAX30101_HRmode_InitStart(char argStrs[32][32], char replyStrs[32][32]) |
jbradshaw | 0:e4a10ed6eb92 | 209 | { |
jbradshaw | 0:e4a10ed6eb92 | 210 | uint8_t args[5]; |
jbradshaw | 0:e4a10ed6eb92 | 211 | ProcessArgs(argStrs, args, sizeof(args)); |
jbradshaw | 0:e4a10ed6eb92 | 212 | |
jbradshaw | 0:e4a10ed6eb92 | 213 | ClearInOutFifos(); |
jbradshaw | 0:e4a10ed6eb92 | 214 | MAX30101_Helper_SetStreamingFlag(eStreaming_HR,1); |
jbradshaw | 1:9490836294ea | 215 | if (args[2] >= MAX30101_200HZ) { |
jbradshaw | 1:9490836294ea | 216 | highDataRate = 1; |
jbradshaw | 1:9490836294ea | 217 | } |
jbradshaw | 0:e4a10ed6eb92 | 218 | Peripherals::max30101()->HRmode_init(args[0], args[1], args[2], args[3], args[4]); |
jbradshaw | 0:e4a10ed6eb92 | 219 | strcpy(replyStrs[0],"80"); |
jbradshaw | 0:e4a10ed6eb92 | 220 | return 0; |
jbradshaw | 0:e4a10ed6eb92 | 221 | } |
jbradshaw | 0:e4a10ed6eb92 | 222 | |
jbradshaw | 0:e4a10ed6eb92 | 223 | //****************************************************************************** |
jbradshaw | 0:e4a10ed6eb92 | 224 | int MAX30101_Multimode_init(char argStrs[32][32], char replyStrs[32][32]) |
jbradshaw | 0:e4a10ed6eb92 | 225 | { |
jbradshaw | 0:e4a10ed6eb92 | 226 | uint8_t args[12]; |
jbradshaw | 0:e4a10ed6eb92 | 227 | uint8_t lis2dhDataRate; |
jbradshaw | 0:e4a10ed6eb92 | 228 | uint8_t lis2dhFifoThreshold; |
jbradshaw | 0:e4a10ed6eb92 | 229 | ProcessArgs(argStrs, args, sizeof(args)); |
jbradshaw | 0:e4a10ed6eb92 | 230 | |
jbradshaw | 0:e4a10ed6eb92 | 231 | ClearInOutFifos(); |
jbradshaw | 0:e4a10ed6eb92 | 232 | |
jbradshaw | 0:e4a10ed6eb92 | 233 | lis2dhDataRate = args[11]; |
jbradshaw | 0:e4a10ed6eb92 | 234 | lis2dhFifoThreshold = adjustAccelThreshold(lis2dhDataRate); |
jbradshaw | 0:e4a10ed6eb92 | 235 | adjustHighDataRate(lis2dhDataRate); |
jbradshaw | 0:e4a10ed6eb92 | 236 | |
jbradshaw | 0:e4a10ed6eb92 | 237 | Peripherals::lis2dh()->initStart(lis2dhDataRate,lis2dhFifoThreshold); |
jbradshaw | 0:e4a10ed6eb92 | 238 | |
jbradshaw | 0:e4a10ed6eb92 | 239 | wait(0.1f); |
jbradshaw | 0:e4a10ed6eb92 | 240 | MAX30101_Helper_SetStreamingFlag(eStreaming_MULTI, 1); |
jbradshaw | 0:e4a10ed6eb92 | 241 | Peripherals::max30101()->Multimode_init(args[0], args[1], args[2], |
jbradshaw | 0:e4a10ed6eb92 | 242 | args[3], args[4], args[5], args[6], |
jbradshaw | 0:e4a10ed6eb92 | 243 | args[7], args[8], args[9], args[10]); |
jbradshaw | 0:e4a10ed6eb92 | 244 | LoggingService_StartLoggingUsb(); |
jbradshaw | 0:e4a10ed6eb92 | 245 | |
jbradshaw | 0:e4a10ed6eb92 | 246 | strcpy(replyStrs[0],"80"); |
jbradshaw | 0:e4a10ed6eb92 | 247 | return 0; |
jbradshaw | 0:e4a10ed6eb92 | 248 | } |
jbradshaw | 0:e4a10ed6eb92 | 249 | |
jbradshaw | 0:e4a10ed6eb92 | 250 | //****************************************************************************** |
jbradshaw | 0:e4a10ed6eb92 | 251 | int MAX30101_Multimode_InitStart(char argStrs[32][32], char replyStrs[32][32]) |
jbradshaw | 0:e4a10ed6eb92 | 252 | { |
jbradshaw | 0:e4a10ed6eb92 | 253 | uint8_t args[11]; |
jbradshaw | 0:e4a10ed6eb92 | 254 | ProcessArgs(argStrs, args, sizeof(args)); |
jbradshaw | 0:e4a10ed6eb92 | 255 | |
jbradshaw | 0:e4a10ed6eb92 | 256 | ClearInOutFifos(); |
jbradshaw | 0:e4a10ed6eb92 | 257 | MAX30101_Helper_SetStreamingFlag(eStreaming_MULTI, 1); |
jbradshaw | 1:9490836294ea | 258 | if (args[2] >= MAX30101_200HZ) { |
jbradshaw | 1:9490836294ea | 259 | highDataRate = 1; |
jbradshaw | 1:9490836294ea | 260 | } |
jbradshaw | 0:e4a10ed6eb92 | 261 | Peripherals::max30101()->Multimode_init(args[0], args[1], args[2], |
jbradshaw | 0:e4a10ed6eb92 | 262 | args[3], args[4], args[5], args[6], |
jbradshaw | 0:e4a10ed6eb92 | 263 | args[7], args[8], args[9], args[10]); |
jbradshaw | 0:e4a10ed6eb92 | 264 | |
jbradshaw | 0:e4a10ed6eb92 | 265 | strcpy(replyStrs[0],"80"); |
jbradshaw | 0:e4a10ed6eb92 | 266 | return 0; |
jbradshaw | 0:e4a10ed6eb92 | 267 | } |
jbradshaw | 0:e4a10ed6eb92 | 268 | |
jbradshaw | 0:e4a10ed6eb92 | 269 | |
jbradshaw | 0:e4a10ed6eb92 | 270 |