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

Dependencies:   USBDevice

Revision:
4:1fcd660d72fe
Parent:
3:36de8b9e4b1a
Child:
5:bc128a16232f
--- a/MAXREFDES100FW300/e4a10ed6eb92/HSP/Hsp_BLE/HspBLE.cpp	Sat Apr 10 03:05:42 2021 +0000
+++ b/MAXREFDES100FW300/e4a10ed6eb92/HSP/Hsp_BLE/HspBLE.cpp	Sat Apr 10 07:51:22 2021 +0000
@@ -45,7 +45,9 @@
 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};
 uint8_t HspBLE::commandCharUUID[] = {0x36,0xe5,0x5e,0x37,0x6b,0x5b,0x42,0x0b,0x91,0x07,0x0d,0x34,0xa0,0xe8,0x67,0x5a};
-
+//our ECG data characteristic
+uint8_t HspBLE::ecgCharUUID[] = {0x30,0xc1,0x3a,0x49,0x5d,0x2d,0x42,0x1b,0x8a,0x30,0x7f,0x21,0xb7,0x0f,0x8a,0x94};
+                                         //   "30c13a49-5d2d-421b-8a30-7f21b70f8a94"
 
 /// define the BLE device name
 uint8_t HspBLE::deviceName[] = "MAXREFDES100";
@@ -95,9 +97,12 @@
     bluetoothLE->addCharacteristic(new Characteristic(4 /* number of bytes */,heartrateCharUUID,GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY));
     bluetoothLE->addCharacteristic(new Characteristic(8 /* number of bytes */,pressureCharUUID,GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY));
     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
     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);
-
+    
   bluetoothLE->onDataWritten(&HspBLE::_onDataWritten);
   ticker.attach(this, &HspBLE::tickerHandler, 1);
 }
@@ -172,6 +177,15 @@
     for (i = 0; i < sizeof(MAX30001::max30001_t); i++)
       data[i] = bytePtr[i];
   } break;
+  case CHARACTERISTIC_ECG: {
+  	int i;
+  	uint8_t *bytePtr;
+  	MAX30001::max30001_t hopeData;
+  	Peripherals::max30001()->max30001_ReadECGData(&hopeData);
+  	bytePtr = reinterpret_cast<uint8_t *>(&hopeData);
+  	for (i = 0; i < sizeof(MAX30001::max30001_t); i++)
+      data[i] = bytePtr[i];
+  } break;
   }
 }
 
@@ -193,5 +207,7 @@
     bluetoothLE->notifyCharacteristic(CHARACTERISTIC_HEARTRATE, data);
     pollSensor(CHARACTERISTIC_PRESSURE, data);
     bluetoothLE->notifyCharacteristic(CHARACTERISTIC_PRESSURE, data);
+    pollSensor(CHARACTERISTIC_ECG, data);
+    bluetoothLE->notifyCharacteristic(CHARACTERISTIC_ECG, data);
   }
 }