Fork of the offical HSP_RPC_GUI firmware

Dependencies:   USBDevice

Fork of MAXREFDES100 firmware for MAX32620HSP

Revision:
1:9490836294ea
Parent:
0:e4a10ed6eb92
Child:
3:8e9b9f5818aa
--- a/HSP/main.cpp	Tue Oct 25 15:22:11 2016 +0000
+++ b/HSP/main.cpp	Fri Apr 21 12:12:30 2017 -0500
@@ -114,6 +114,7 @@
 
 /// HSP BluetoothLE specific functions
 HspBLE hspBLE(&ble);
+USBSerial *usbSerialPtr;
 
 int main() {
   // hold results for returning funtcoins
@@ -162,7 +163,7 @@
   Peripherals::setMAX30205_bottom(&MAX30205_bottom);
   Peripherals::setBMP280(&bmp280);
   Peripherals::setLIS2DH(&lis2dh);
-  Peripherals::setUSBSerial(&usbSerial);
+  //Peripherals::setUSBSerial(&usbSerial);
   Peripherals::setTimestampTimer(&timestampTimer);
   Peripherals::setHspLed(&hspLed);
   Peripherals::setMAX30101(&max30101);
@@ -173,6 +174,7 @@
   Peripherals::setMAX14720(&max14720);
   Peripherals::setMAX30001(&max30001);
   Peripherals::setHspBLE(&hspBLE);
+  usbSerialPtr = &usbSerial;
 
   // init the S25FS256 external flash device
   printf("Init S25FS512...\n");
@@ -200,7 +202,7 @@
   fflush(stdout);
   max30101.onInterrupt(&MAX30101_OnInterrupt);
   max30101.onDataAvailable(&StreamPacketUint32);
-  max30101_Interrupt.fall(&MAX30101MidIntHandler);
+  max30101_Interrupt.fall(&MAX30101::MidIntHandler);
 
   //
   // MAX30001
@@ -210,19 +212,20 @@
   max30001_InterruptB.disable_irq();
   max30001_Interrupt2B.disable_irq();
   max30001_InterruptB.mode(PullUp);
-  max30001_InterruptB.fall(&MAX30001Mid_IntB_Handler);
+  max30001_InterruptB.fall(&MAX30001::Mid_IntB_Handler);
   max30001_Interrupt2B.mode(PullUp);
-  max30001_Interrupt2B.fall(&MAX30001Mid_Int2B_Handler);
+  max30001_Interrupt2B.fall(&MAX30001::Mid_Int2B_Handler);
   max30001_InterruptB.enable_irq();
   max30001_Interrupt2B.enable_irq();
-  MAX30001_AllowInterrupts(1);
+  max30001.AllowInterrupts(1);
   // Configuring the FCLK for the ECG, set to 32.768KHZ
   printf("Init MAX30001 PWM...\n");
   fflush(stdout);
-  pwmout.period_us(31);
-  pwmout.write(0.5);          // 0-1 is 0-100%, 0.5 = 50% duty cycle.
-  max30001.max30001_sw_rst(); // Do a software reset of the MAX30001
-    max30001.max30001_INT_assignment(MAX30001::MAX30001_INT_B,    MAX30001::MAX30001_NO_INT,   MAX30001::MAX30001_NO_INT,  //  en_enint_loc,      en_eovf_loc,   en_fstint_loc,
+  //pwmout.period_us(31);      
+  //pwmout.write(0.5);          // 0-1 is 0-100%, 0.5 = 50% duty cycle.
+  max30001.FCLK_MaximOnly();    // mbed does not provide the resolution necessary, so for now we have a specific solution...
+  max30001.sw_rst(); // Do a software reset of the MAX30001
+  max30001.INT_assignment(MAX30001::MAX30001_INT_B,    MAX30001::MAX30001_NO_INT,   MAX30001::MAX30001_NO_INT,  //  en_enint_loc,      en_eovf_loc,   en_fstint_loc,
                                      MAX30001::MAX30001_INT_2B,   MAX30001::MAX30001_INT_2B,   MAX30001::MAX30001_NO_INT,  //  en_dcloffint_loc,  en_bint_loc,   en_bovf_loc,
                                      MAX30001::MAX30001_INT_2B,   MAX30001::MAX30001_INT_2B,   MAX30001::MAX30001_NO_INT,  //  en_bover_loc,      en_bundr_loc,  en_bcgmon_loc,
                                      MAX30001::MAX30001_INT_B,    MAX30001::MAX30001_NO_INT,   MAX30001::MAX30001_NO_INT,  //  en_pint_loc,       en_povf_loc,   en_pedge_loc,