MAX32620HSP (MAXREFDES100) RPC Example for Graphical User Interface

Dependencies:   USBDevice

Fork of HSP_Release by Jerry Bradshaw

This is an example program for the MAX32620HSP (MAXREFDES100 Health Sensor Platform). It demonstrates all the features of the platform and works with a companion graphical user interface (GUI) to help evaluate/configure/monitor the board. Go to the MAXREFDES100 product page and click on "design resources" to download the companion software. The GUI connects to the board through an RPC interface on a virtual serial port over the USB interface.

The RPC interface provides access to all the features of the board and is available to interface with other development environments such Matlab. This firmware provides realtime data streaming through the RPC interface over USB, and also provides the ability to log the data to flash for untethered battery operation. The data logging settings are configured through the GUI, and the GUI also provides the interface to download logged data.

Details on the RPC interface can be found here: HSP RPC Interface Documentation

Windows

With this program loaded, the MAX32620HSP will appear on your computer as a serial port. On Mac and Linux, this will happen by default. For Windows, you need to install a driver: HSP serial port windows driver

For more details about this platform and how to use it, see the MAXREFDES100 product page.

Revision:
1:9490836294ea
Parent:
0:e4a10ed6eb92
--- a/HSP/Devices/MAX30101/MAX30101_RPC.cpp	Tue Oct 25 15:22:11 2016 +0000
+++ b/HSP/Devices/MAX30101/MAX30101_RPC.cpp	Fri Apr 21 12:12:30 2017 -0500
@@ -47,7 +47,6 @@
 	uint8_t args[2];
 	uint8_t reply[1];
 	ProcessArgs(argStrs, args, sizeof(args));
-//	Peripherals::max30101()->writeReg(args[0] , args[1]);	// pass in the register address and the data
 	reply[0] = 0x80;
 	FormatReply(reply, sizeof(reply), replyStrs);
 	return 0;
@@ -57,9 +56,8 @@
 int MAX30101_ReadReg(char argStrs[32][32], char replyStrs[32][32]) {
 	uint8_t args[1];
 	uint8_t reply[1];
-	char value;
+	char value = 0;
 	ProcessArgs(argStrs, args, sizeof(args));
-//	Peripherals::max30101()->readReg(args[0] , &value, 1);
 	reply[0] = (uint8_t)value;
 	FormatReply(reply, sizeof(reply), replyStrs);
 	return 0;
@@ -69,11 +67,9 @@
 int MAX30101_COMMinit(char argStrs[32][32], char replyStrs[32][32])
 {
 	uint8_t args[4];
-	uint8_t return_value;
+	uint8_t return_value = 0;
 	ProcessArgs(argStrs,args,sizeof(args));
 
-	//return_value = max30101_COMMinit(args[0], args[1], args[2], args[3]);
-
 	strcpy(replyStrs[0],"80");
 	return return_value;
 }
@@ -82,11 +78,9 @@
 int MAX30101_SpO2mode_stop(char argStrs[32][32], char replyStrs[32][32])
 {
 	uint8_t args[4];
-	uint8_t return_value;
+	uint8_t return_value = 0;
 	ProcessArgs(argStrs,args,sizeof(args));
 
-	//lis2dh_Stop();
-	//max30101_SpO2mode_stop();
 	Peripherals::max30101()->SpO2mode_stop();
 
 	strcpy(replyStrs[0],"80");
@@ -99,7 +93,6 @@
 	uint8_t args[4];
 	ProcessArgs(argStrs,args,sizeof(args));
 
-	//lis2dh_Stop();
 	Peripherals::max30101()->HRmode_stop();
 
 	strcpy(replyStrs[0],"80");
@@ -112,7 +105,6 @@
 	uint8_t args[4];
 	ProcessArgs(argStrs,args,sizeof(args));
 
-	//lis2dh_Stop();
 	Peripherals::max30101()->Multimode_stop();
 
 	strcpy(replyStrs[0],"80");
@@ -121,8 +113,8 @@
 
 //******************************************************************************
 void ClearInOutFifos() {
-	fifo_clear(GetStreamOutFifo());		// clear stream out fifo
-	fifo_clear(GetUSBIncomingFifo());				// clear USB serial incoming fifo
+	fifo_clear(GetStreamOutFifo());	   ///< clear stream out fifo
+	fifo_clear(GetUSBIncomingFifo());  ///< clear USB serial incoming fifo
 }
 
 int highDataRate = 0;
@@ -181,7 +173,9 @@
 
 	ClearInOutFifos();
 	MAX30101_Helper_SetStreamingFlag(eStreaming_SPO2,1);
-	if (args[2] >= MAX30101_200HZ) highDataRate = 1;
+	if (args[2] >= MAX30101_200HZ) {
+      highDataRate = 1;
+    }
 	Peripherals::max30101()->SpO2mode_init(args[0], args[1], args[2], args[3], args[4], args[5]);
 
 	strcpy(replyStrs[0],"80");
@@ -218,7 +212,9 @@
 
 	ClearInOutFifos();
 	MAX30101_Helper_SetStreamingFlag(eStreaming_HR,1);
-	if (args[2] >= MAX30101_200HZ) highDataRate = 1;
+	if (args[2] >= MAX30101_200HZ) {
+      highDataRate = 1;
+    }
 	Peripherals::max30101()->HRmode_init(args[0], args[1], args[2], args[3], args[4]);
 	strcpy(replyStrs[0],"80");
 	return 0;
@@ -259,7 +255,9 @@
 
 	ClearInOutFifos();
 	MAX30101_Helper_SetStreamingFlag(eStreaming_MULTI, 1);
-	if (args[2] >= MAX30101_200HZ) highDataRate = 1;
+	if (args[2] >= MAX30101_200HZ) {
+      highDataRate = 1;
+    }
 	Peripherals::max30101()->Multimode_init(args[0], args[1], args[2],
 											args[3], args[4], args[5], args[6],
 											args[7], args[8], args[9], args[10]);