MAX32620HSP (MAXREFDES100) RPC Example for Graphical User Interface

Dependencies:   USBDevice

Fork of HSP_Release by Jerry Bradshaw

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MAX30101_helper.cpp Source File

MAX30101_helper.cpp

00001 
00002 /*******************************************************************************
00003  * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
00004  *
00005  * Permission is hereby granted, free of charge, to any person obtaining a
00006  * copy of this software and associated documentation files (the "Software"),
00007  * to deal in the Software without restriction, including without limitation
00008  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00009  * and/or sell copies of the Software, and to permit persons to whom the
00010  * Software is furnished to do so, subject to the following conditions:
00011  *
00012  * The above copyright notice and this permission notice shall be included
00013  * in all copies or substantial portions of the Software.
00014  *
00015  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00016  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00017  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00018  * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
00019  * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00020  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00021  * OTHER DEALINGS IN THE SOFTWARE.
00022  *
00023  * Except as contained in this notice, the name of Maxim Integrated
00024  * Products, Inc. shall not be used except as stated in the Maxim Integrated
00025  * Products, Inc. Branding Policy.
00026  *
00027  * The mere transfer of this software does not imply any licenses
00028  * of trade secrets, proprietary technology, copyrights, patents,
00029  * trademarks, maskwork rights, or any other form of intellectual
00030  * property whatsoever. Maxim Integrated Products, Inc. retains all
00031  * ownership rights.
00032  *******************************************************************************
00033  */
00034 
00035 #include <stdint.h>
00036 #include "MAX30101_helper.h"
00037 #include "MAX30101.h"
00038 #include "Peripherals.h"
00039 
00040 static uint8_t flags[3];
00041 
00042 uint8_t MAX30101_Helper_IsStreaming(eMAX30101Flags flag) {
00043   return flags[(uint32_t)flag];
00044 }
00045 //******************************************************************************
00046 
00047 void MAX30101_Helper_SetStreamingFlag(eMAX30101Flags flag, uint8_t state) {
00048   flags[(uint32_t)flag] = state;
00049 }
00050 
00051 //******************************************************************************
00052 void MAX30101_Helper_Stop(void) {
00053   if (flags[(uint32_t)eStreaming_HR] == 1) {
00054     Peripherals::max30101()->HRmode_stop();
00055   }
00056   if (flags[(uint32_t)eStreaming_SPO2] == 1) {
00057     Peripherals::max30101()->SpO2mode_stop();
00058   }
00059   if (flags[(uint32_t)eStreaming_MULTI] == 1) {
00060     Peripherals::max30101()->Multimode_stop();
00061   }
00062   MAX30101_Helper_ClearStreamingFlags();
00063 }
00064 
00065 //******************************************************************************
00066 void MAX30101_Helper_ClearStreamingFlags(void) {
00067   uint32_t i;
00068   for (i = 0; i < 3; i++) {
00069     flags[i] = 0;
00070   }
00071 }
00072 
00073 //******************************************************************************
00074 void MAX30101_OnInterrupt(void) { I2CM_Init_Reset(2, 1); }