This is the latest working repository used in our demo video for the Maxim to display temperature readings on Bluetooth

Dependencies:   USBDevice

Files at this revision

API Documentation at this revision

Comitter:
darienf
Date:
Sun May 02 23:09:04 2021 +0000
Parent:
4:1fcd660d72fe
Commit message:
This is the program that was last used, that has the working temperature and some comments

Changed in this revision

MAXREFDES100FW300/e4a10ed6eb92/HSP/Devices/MAX30001/MAX30001/MAX30001.cpp Show annotated file Show diff for this revision Revisions of this file
MAXREFDES100FW300/e4a10ed6eb92/HSP/Devices/MAX30001/MAX30001/MAX30001.h Show annotated file Show diff for this revision Revisions of this file
MAXREFDES100FW300/e4a10ed6eb92/HSP/Hsp_BLE/HspBLE.cpp Show annotated file Show diff for this revision Revisions of this file
MAXREFDES100FW300/e4a10ed6eb92/HSP/Hsp_BLE/HspBLE.h Show annotated file Show diff for this revision Revisions of this file
MAXREFDES100FW300/e4a10ed6eb92/HSP/main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 1fcd660d72fe -r bc128a16232f MAXREFDES100FW300/e4a10ed6eb92/HSP/Devices/MAX30001/MAX30001/MAX30001.cpp
--- a/MAXREFDES100FW300/e4a10ed6eb92/HSP/Devices/MAX30001/MAX30001/MAX30001.cpp	Sat Apr 10 07:51:22 2021 +0000
+++ b/MAXREFDES100FW300/e4a10ed6eb92/HSP/Devices/MAX30001/MAX30001/MAX30001.cpp	Sun May 02 23:09:04 2021 +0000
@@ -1060,14 +1060,17 @@
       return -1;
     }
 
+	// i tried   max30001_RtoR_data = (0x0042f581 & max30001_RtoR_data) >> 10;
     max30001_RtoR_data = (0x00FFFFFF & max30001_RtoR_data) >> 10;
-    //ours
-    //max30001_ECG_FIFO_buffer = (0xFF447799 & max30001_RtoR_data) >> 10;
+    
+    //ours SHOULD WE INCLUDE?
+    max30001_ECG_FIFO_buffer[32] = (0xFF447799 & max30001_ECG_FIFO_buffer[32]) >> 10;
 
     hspValMax30001.R2R = (uint16_t)max30001_RtoR_data;
     hspValMax30001.fmstr = (uint16_t)max30001_cnfg_gen.bit.fmstr;
-    hspValMax30001.ecgDat = (uint16_t)max30001_ECG_FIFO_buffer[32];
-    //hspValMax30001.ecgDat = (uint16_t)max30001_cnfg_ecg.bit.gain;
+    //ayo5data choose your own adventure  (buffer vs bit._(gain))   chose gain
+    //hspValMax30001.ecgDat = (uint16_t)max30001_ECG_FIFO_buffer[32];
+    hspValMax30001.ecgDat = (uint16_t)max30001_cnfg_ecg.bit.gain;
 
     dataAvailable(MAX30001_DATA_RTOR, &max30001_RtoR_data, 1);
   }
@@ -1278,13 +1281,13 @@
 void MAX30001::max30001_ReadHeartrateData(max30001_t *_hspValMax30001) {
   _hspValMax30001->R2R = hspValMax30001.R2R;
   _hspValMax30001->fmstr = hspValMax30001.fmstr;
-  // ayooooooooooooooooooo2, put data stream here possibly??????????????
 }
 
 //******************************************************************************
+
 void MAX30001::max30001_ReadECGData(max30001_t *_hspValMax30001) {
   _hspValMax30001->ecgDat = hspValMax30001.ecgDat;
-  // ayooooooooooooooooooo2, put data stream here possibly??????????????
+  // ayo6, put data stream here possibly??????????????
 }
 
 //******************************************************************************
diff -r 1fcd660d72fe -r bc128a16232f MAXREFDES100FW300/e4a10ed6eb92/HSP/Devices/MAX30001/MAX30001/MAX30001.h
--- a/MAXREFDES100FW300/e4a10ed6eb92/HSP/Devices/MAX30001/MAX30001/MAX30001.h	Sat Apr 10 07:51:22 2021 +0000
+++ b/MAXREFDES100FW300/e4a10ed6eb92/HSP/Devices/MAX30001/MAX30001/MAX30001.h	Sun May 02 23:09:04 2021 +0000
@@ -613,7 +613,7 @@
   typedef struct { // Creating a structure for BLE data
     int16_t R2R;
     int16_t fmstr;
-    //ayooooooooooooo1, do we add buffer for data here????????
+    //ayo3 do we add buffer for data here????????
     int16_t ecgDat;
   } max30001_t;
   // name of struct
@@ -1023,7 +1023,7 @@
   void max30001_ReadHeartrateData(max30001_t *_hspValMax30001);
   //OUR ECG READ FUNCTION
   void max30001_ReadECGData(max30001_t *_hspValMax30001);
-
+	//ayo4
   /**
    * @brief type definition for data interrupt
    */
diff -r 1fcd660d72fe -r bc128a16232f MAXREFDES100FW300/e4a10ed6eb92/HSP/Hsp_BLE/HspBLE.cpp
--- a/MAXREFDES100FW300/e4a10ed6eb92/HSP/Hsp_BLE/HspBLE.cpp	Sat Apr 10 07:51:22 2021 +0000
+++ b/MAXREFDES100FW300/e4a10ed6eb92/HSP/Hsp_BLE/HspBLE.cpp	Sun May 02 23:09:04 2021 +0000
@@ -41,6 +41,7 @@
 uint8_t HspBLE::temperatureTopCharUUID[] = {0x35,0x44,0x53,0x1b,0x00,0xc3,0x43,0x42,0x97,0x55,0xb5,0x6a,0xbe,0x8e,0x6c,0x67};
 uint8_t HspBLE::temperatureBottomCharUUID[] = {0x35,0x44,0x53,0x1b,0x00,0xc3,0x43,0x42,0x97,0x55,0xb5,0x6a,0xbe,0x8e,0x6a,0x66};
 uint8_t HspBLE::accelerometerCharUUID[] = {0xe6,0xc9,0xda,0x1a,0x80,0x96,0x48,0xbc,0x83,0xa4,0x3f,0xca,0x38,0x37,0x05,0xaf};
+// new uint8_t HspBLE::heartrateCharUUID[] = {0x44,0xa3,0xa3,0x44,0xb0,0x93,0x41,0x3c,0x57,0xab,0x3b,0xe4,0xc6,0x48,0xc5,0xd3};
 uint8_t HspBLE::heartrateCharUUID[] = {0x62,0x1a,0x00,0xe3,0xb0,0x93,0x46,0xbf,0xaa,0xdc,0xab,0xe4,0xc6,0x48,0xc5,0x69};
 uint8_t HspBLE::pressureCharUUID[] = {0x1d,0x8a,0x19,0x32,0xda,0x49,0x49,0xad,0x91,0xd8,0x80,0x08,0x32,0xe7,0xe9,0x40};
 uint8_t HspBLE::dataCharUUID[] = {0xaa,0x8a,0x19,0x32,0xda,0x49,0x49,0xad,0x91,0xd8,0x80,0x08,0x32,0xe7,0xe9,0x40};
@@ -90,7 +91,7 @@
   printf("BLE DeviceID = %02X:%02X:%02X:%02X:%02X:%02X...\n",
          serialNumberPtr[0], serialNumberPtr[1], serialNumberPtr[2],
          serialNumberPtr[3], serialNumberPtr[4], serialNumberPtr[5]);
-
+ printf("Hello2");
     bluetoothLE->addCharacteristic(new Characteristic(2 /* number of bytes */,temperatureTopCharUUID,GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY));
     bluetoothLE->addCharacteristic(new Characteristic(2 /* number of bytes */,temperatureBottomCharUUID,GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY));
     bluetoothLE->addCharacteristic(new Characteristic(6 /* number of bytes */,accelerometerCharUUID,GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY));
@@ -99,6 +100,7 @@
     bluetoothLE->addCharacteristic(new Characteristic(32 /* number of bytes */,dataCharUUID,GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE));
     bluetoothLE->addCharacteristic(new Characteristic(32 /* number of bytes */,ecgCharUUID,GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY));
     //^that's our boy
+    //ayo8
     bluetoothLE->addCharacteristic(new Characteristic(1 /* number of bytes */,commandCharUUID,GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE));
 
     bluetoothLE->initService(serialNumberPtr, deviceName, sizeof(deviceName),envServiceUUID);
@@ -131,13 +133,14 @@
 }
 
 void HspBLE::pollSensor(int sensorId, uint8_t *data) {
-
+printf("entering switch....");
   switch (sensorId) {
   case CHARACTERISTIC_TEMP_TOP: {
     uint16_t uShort;
     Peripherals::max30205_top()->readTemperature(&uShort);
     data[0] = HIGH_BYTE(uShort);
     data[1] = LOW_BYTE(uShort);
+    //printf("%u",data[0]);
   } break;
   case CHARACTERISTIC_TEMP_BOTTOM: {
     uint16_t uShort;
@@ -177,6 +180,8 @@
     for (i = 0; i < sizeof(MAX30001::max30001_t); i++)
       data[i] = bytePtr[i];
   } break;
+  
+  //ayo7
   case CHARACTERISTIC_ECG: {
   	int i;
   	uint8_t *bytePtr;
@@ -209,5 +214,6 @@
     bluetoothLE->notifyCharacteristic(CHARACTERISTIC_PRESSURE, data);
     pollSensor(CHARACTERISTIC_ECG, data);
     bluetoothLE->notifyCharacteristic(CHARACTERISTIC_ECG, data);
+    //ayo2
   }
 }
diff -r 1fcd660d72fe -r bc128a16232f MAXREFDES100FW300/e4a10ed6eb92/HSP/Hsp_BLE/HspBLE.h
--- a/MAXREFDES100FW300/e4a10ed6eb92/HSP/Hsp_BLE/HspBLE.h	Sat Apr 10 07:51:22 2021 +0000
+++ b/MAXREFDES100FW300/e4a10ed6eb92/HSP/Hsp_BLE/HspBLE.h	Sun May 02 23:09:04 2021 +0000
@@ -87,7 +87,7 @@
   static uint8_t deviceName[];
   static uint8_t serialNumber[];
   static uint8_t ecgCharUUID[];
-
+//ayo1
 
   /// application specific
   bool startDataLogging;
diff -r 1fcd660d72fe -r bc128a16232f MAXREFDES100FW300/e4a10ed6eb92/HSP/main.cpp
--- a/MAXREFDES100FW300/e4a10ed6eb92/HSP/main.cpp	Sat Apr 10 07:51:22 2021 +0000
+++ b/MAXREFDES100FW300/e4a10ed6eb92/HSP/main.cpp	Sun May 02 23:09:04 2021 +0000
@@ -247,6 +247,7 @@
 
   // start main loop
   printf("Start main loop...\n");
+  printf("Hello");
   fflush(stdout);
   while (1) {
     // get a RPC string if one is available