Fork of the offical HSP_RPC_GUI firmware

Dependencies:   USBDevice

Fork of MAXREFDES100 firmware for MAX32620HSP

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?

UserRevisionLine numberNew contents of line
jbradshaw 0:e4a10ed6eb92 1
jbradshaw 0:e4a10ed6eb92 2 /*******************************************************************************
jbradshaw 0:e4a10ed6eb92 3 * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
jbradshaw 0:e4a10ed6eb92 4 *
jbradshaw 0:e4a10ed6eb92 5 * Permission is hereby granted, free of charge, to any person obtaining a
jbradshaw 0:e4a10ed6eb92 6 * copy of this software and associated documentation files (the "Software"),
jbradshaw 0:e4a10ed6eb92 7 * to deal in the Software without restriction, including without limitation
jbradshaw 0:e4a10ed6eb92 8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
jbradshaw 0:e4a10ed6eb92 9 * and/or sell copies of the Software, and to permit persons to whom the
jbradshaw 0:e4a10ed6eb92 10 * Software is furnished to do so, subject to the following conditions:
jbradshaw 0:e4a10ed6eb92 11 *
jbradshaw 0:e4a10ed6eb92 12 * The above copyright notice and this permission notice shall be included
jbradshaw 0:e4a10ed6eb92 13 * in all copies or substantial portions of the Software.
jbradshaw 0:e4a10ed6eb92 14 *
jbradshaw 0:e4a10ed6eb92 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
jbradshaw 0:e4a10ed6eb92 16 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
jbradshaw 0:e4a10ed6eb92 17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
jbradshaw 0:e4a10ed6eb92 18 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
jbradshaw 0:e4a10ed6eb92 19 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
jbradshaw 0:e4a10ed6eb92 20 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
jbradshaw 0:e4a10ed6eb92 21 * OTHER DEALINGS IN THE SOFTWARE.
jbradshaw 0:e4a10ed6eb92 22 *
jbradshaw 0:e4a10ed6eb92 23 * Except as contained in this notice, the name of Maxim Integrated
jbradshaw 0:e4a10ed6eb92 24 * Products, Inc. shall not be used except as stated in the Maxim Integrated
jbradshaw 0:e4a10ed6eb92 25 * Products, Inc. Branding Policy.
jbradshaw 0:e4a10ed6eb92 26 *
jbradshaw 0:e4a10ed6eb92 27 * The mere transfer of this software does not imply any licenses
jbradshaw 0:e4a10ed6eb92 28 * of trade secrets, proprietary technology, copyrights, patents,
jbradshaw 0:e4a10ed6eb92 29 * trademarks, maskwork rights, or any other form of intellectual
jbradshaw 0:e4a10ed6eb92 30 * property whatsoever. Maxim Integrated Products, Inc. retains all
jbradshaw 0:e4a10ed6eb92 31 * ownership rights.
jbradshaw 0:e4a10ed6eb92 32 *******************************************************************************
jbradshaw 0:e4a10ed6eb92 33 */
jbradshaw 0:e4a10ed6eb92 34
jbradshaw 0:e4a10ed6eb92 35 #include <stdint.h>
jbradshaw 0:e4a10ed6eb92 36 #include "MAX30101_helper.h"
jbradshaw 0:e4a10ed6eb92 37 #include "MAX30101.h"
jbradshaw 0:e4a10ed6eb92 38 #include "Peripherals.h"
jbradshaw 0:e4a10ed6eb92 39
jbradshaw 0:e4a10ed6eb92 40 static uint8_t flags[3];
jbradshaw 0:e4a10ed6eb92 41
jbradshaw 0:e4a10ed6eb92 42 uint8_t MAX30101_Helper_IsStreaming(eMAX30101Flags flag) {
jbradshaw 0:e4a10ed6eb92 43 return flags[(uint32_t)flag];
jbradshaw 0:e4a10ed6eb92 44 }
jbradshaw 1:9490836294ea 45 //******************************************************************************
jbradshaw 0:e4a10ed6eb92 46
jbradshaw 0:e4a10ed6eb92 47 void MAX30101_Helper_SetStreamingFlag(eMAX30101Flags flag, uint8_t state) {
jbradshaw 0:e4a10ed6eb92 48 flags[(uint32_t)flag] = state;
jbradshaw 0:e4a10ed6eb92 49 }
jbradshaw 0:e4a10ed6eb92 50
jbradshaw 1:9490836294ea 51 //******************************************************************************
jbradshaw 0:e4a10ed6eb92 52 void MAX30101_Helper_Stop(void) {
jbradshaw 0:e4a10ed6eb92 53 if (flags[(uint32_t)eStreaming_HR] == 1) {
jbradshaw 0:e4a10ed6eb92 54 Peripherals::max30101()->HRmode_stop();
jbradshaw 0:e4a10ed6eb92 55 }
jbradshaw 0:e4a10ed6eb92 56 if (flags[(uint32_t)eStreaming_SPO2] == 1) {
jbradshaw 0:e4a10ed6eb92 57 Peripherals::max30101()->SpO2mode_stop();
jbradshaw 0:e4a10ed6eb92 58 }
jbradshaw 0:e4a10ed6eb92 59 if (flags[(uint32_t)eStreaming_MULTI] == 1) {
jbradshaw 0:e4a10ed6eb92 60 Peripherals::max30101()->Multimode_stop();
jbradshaw 0:e4a10ed6eb92 61 }
jbradshaw 0:e4a10ed6eb92 62 MAX30101_Helper_ClearStreamingFlags();
jbradshaw 0:e4a10ed6eb92 63 }
jbradshaw 0:e4a10ed6eb92 64
jbradshaw 1:9490836294ea 65 //******************************************************************************
jbradshaw 0:e4a10ed6eb92 66 void MAX30101_Helper_ClearStreamingFlags(void) {
jbradshaw 0:e4a10ed6eb92 67 uint32_t i;
jbradshaw 0:e4a10ed6eb92 68 for (i = 0; i < 3; i++) {
jbradshaw 0:e4a10ed6eb92 69 flags[i] = 0;
jbradshaw 0:e4a10ed6eb92 70 }
jbradshaw 0:e4a10ed6eb92 71 }
jbradshaw 0:e4a10ed6eb92 72
jbradshaw 1:9490836294ea 73 //******************************************************************************
jbradshaw 0:e4a10ed6eb92 74 void MAX30101_OnInterrupt(void) { I2CM_Init_Reset(2, 1); }