Code supports writing to the SD card as well as working with the Volckens group smartphone apps for the mbed HRM1017

Dependencies:   ADS1115 BLE_API BME280 Calibration CronoDot EEPROM LSM303 MCP40D17 NCP5623BMUTBG SDFileSystem SI1145 STC3100 mbed nRF51822

Fork of UPAS_BLE_and_USB by Volckens Group Sensors

Committer:
caseyquinn
Date:
Sat Mar 05 21:14:28 2016 +0000
Revision:
124:15466d0f04ab
Parent:
104:c57913399e79
"Fixed" the digital pot cutout issue by not allow large digital pot jumps while the boost is turned on. Also limited the lowest digital pot setting to 5.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jelord 94:c57720890e76 1 //CODE BY JAKE LORD
jelord 94:c57720890e76 2 //ALL RIGHTS RESERVED BY VOLCKENS GROUP, FORT COLLINS CO
jelord 94:c57720890e76 3
jelord 94:c57720890e76 4 #ifndef __BLE_UPAS_SERVICE_H__
jelord 94:c57720890e76 5 #define __BLE_UPAS_SERVICE_H__
jelord 94:c57720890e76 6
jelord 94:c57720890e76 7 class UPAS_Service {
jelord 94:c57720890e76 8 public:
jelord 94:c57720890e76 9 //All Characteristics shall have a read/write counterpart protocol. This should prevent corruption of data.
jelord 94:c57720890e76 10 const static uint16_t UPAS_SERVICE_UUID = 0xA000; //UUID of Service.
jelord 94:c57720890e76 11
jelord 94:c57720890e76 12 const static uint16_t RTC_CHARACTERISTIC_UUID = 0xA002; //UUID for characteristic to write the RTC to
jelord 94:c57720890e76 13 GattCharacteristic rtcCharacteristic;
jelord 94:c57720890e76 14
jelord 94:c57720890e76 15 const static uint16_t SAMPLETIME_CHARACTERISTIC_UUID = 0xA003; //UUID of variable that app will read from
jelord 94:c57720890e76 16 GattCharacteristic sampleTimeCharacteristic;
jelord 94:c57720890e76 17
jelord 94:c57720890e76 18 const static uint16_t SUBJECTLABEL_CHARACTERISTIC_UUID = 0xA004; //UUID of variable that app will read from
jelord 94:c57720890e76 19 GattCharacteristic subjectLabelCharacteristic;
jelord 94:c57720890e76 20
jelord 94:c57720890e76 21 const static uint16_t RUNREADY_CHARACTERISTIC_UUID = 0xA005; //UUID of variable that app will read from
jelord 94:c57720890e76 22 GattCharacteristic runReadyCharacteristic;
jelord 94:c57720890e76 23
jelord 96:03106adb45c9 24 const static uint16_t LOGINTERVAL_CHARACTERISTIC_UUID = 0xA006; //UUID of variable that app will read from
jelord 96:03106adb45c9 25 GattCharacteristic logIntevalCharacteristic;
jelord 96:03106adb45c9 26
jelord 96:03106adb45c9 27 const static uint16_t FLOWRATE_CHARACTERISTIC_UUID = 0xA007; //UUID of variable that app will read from
jelord 96:03106adb45c9 28 GattCharacteristic flowRateCharacteristic;
jelord 99:229435dd4cfb 29
jelord 104:c57913399e79 30 const static uint16_t SERIALNUMBER_CHARACTERISTIC_UUID = 0xA008; //UUID of variable that app will read from
jelord 104:c57913399e79 31 GattCharacteristic serialNumCharacteristic;
jelord 104:c57913399e79 32
jelord 100:da71436aa52a 33
jelord 100:da71436aa52a 34
jelord 94:c57720890e76 35
jelord 94:c57720890e76 36
jelord 102:d25eab697fe0 37 UPAS_Service(BLEDevice &_ble, bool placeholder, uint8_t *rtc, uint8_t *sampleTime, uint8_t *subjectLabel, uint8_t *logInterval, uint8_t *flowRate ) :
jelord 94:c57720890e76 38
jelord 94:c57720890e76 39 rtcCharacteristic(RTC_CHARACTERISTIC_UUID, rtc,6,20, GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY ),
jelord 94:c57720890e76 40 sampleTimeCharacteristic(SAMPLETIME_CHARACTERISTIC_UUID, sampleTime,12,20,GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY),
jelord 102:d25eab697fe0 41 subjectLabelCharacteristic(SUBJECTLABEL_CHARACTERISTIC_UUID, subjectLabel,8,20,GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY),
jelord 102:d25eab697fe0 42 runReadyCharacteristic(RUNREADY_CHARACTERISTIC_UUID,0,0,20,GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ |GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY),
jelord 96:03106adb45c9 43 logIntevalCharacteristic(LOGINTERVAL_CHARACTERISTIC_UUID,logInterval,1,20,GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ |GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY),
jelord 96:03106adb45c9 44 flowRateCharacteristic(FLOWRATE_CHARACTERISTIC_UUID,flowRate,4,20,GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ |GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY),
jelord 104:c57913399e79 45 serialNumCharacteristic(SERIALNUMBER_CHARACTERISTIC_UUID,0,0,20,GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ |GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY),
jelord 94:c57720890e76 46 ble(_ble)
jelord 94:c57720890e76 47 {
jelord 94:c57720890e76 48
jelord 104:c57913399e79 49 GattCharacteristic *charTable[] = {&rtcCharacteristic, &sampleTimeCharacteristic, &subjectLabelCharacteristic, &runReadyCharacteristic, &logIntevalCharacteristic, &flowRateCharacteristic, &serialNumCharacteristic}; //Set up characteristics to be broadcasted with the UPAS service
jelord 94:c57720890e76 50 GattService upasService(UPAS_Service::UPAS_SERVICE_UUID, charTable, sizeof(charTable) / sizeof(GattCharacteristic *)); //Finally, construct the service
jelord 94:c57720890e76 51 ble.addService(upasService);
jelord 94:c57720890e76 52 }
jelord 94:c57720890e76 53
jelord 94:c57720890e76 54 private:
jelord 94:c57720890e76 55 BLEDevice &ble;
jelord 94:c57720890e76 56
jelord 94:c57720890e76 57 };
jelord 94:c57720890e76 58
jelord 94:c57720890e76 59 #endif /* #ifndef __BLE_UPAS_SERVICE_H__ */