Kris Scholte Lubberink
/
SSS_Ble
Ble for smart sOlutions
Diff: source/main.cpp
- Revision:
- 11:d6ed1437c2ee
- Parent:
- 10:d845189d146e
diff -r d845189d146e -r d6ed1437c2ee source/main.cpp --- a/source/main.cpp Fri Jun 14 10:24:57 2019 +0200 +++ b/source/main.cpp Thu Jun 20 13:20:24 2019 +0200 @@ -27,68 +27,6 @@ #define MBED_CONF_PLATFORM_ERROR_FILENAME_CAPTURE_ENABLED true MyStripSingleton* MyStripSingleton::instance = 0; -DigitalOut led1(LED1, 1); - -static EventQueue eventQueue(/* event count */ 16 * EVENTS_EVENT_SIZE); - - -void blinkCallback(void) -{ - //TODO: Every - led1 = !led1; /* Do blinky on LED1 while we're waiting for BLE events */ - BLE &ble = BLE::Instance(); - - - if (ble.gap().getState().connected) { - /* Hier kan je nog iets doen wanneer je verbonden bent */ -// eventQueue.call(updateSensorValue); - - } else { - ble.gap().startAdvertising(); - printf("Stopped advertisement"); - } -} - -void printMacAddress() -{ - /* Print out device MAC address to the console*/ - Gap::AddressType_t addr_type; - Gap::Address_t address; - BLE::Instance().gap().getAddress(&addr_type, address); - printf("DEVICE MAC ADDRESS: "); - for (int i = 5; i >= 1; i--){ - printf("%02x:", address[i]); - } - printf("%02x\r\n", address[0]); -} - -/** - * Callback triggered when the ble initialization process has finished - */ -void bleInitComplete(BLE::InitializationCompleteCallbackContext *params) -{ - -} - - -void scheduleBleEventsProcessing(BLE::OnEventsToProcessCallbackContext* context) { - BLE &ble = BLE::Instance(); - //TODO: Event handling; wel benieuwd naar wat er allemaal gebeurt - eventQueue.call(Callback<void()>(&ble, &BLE::processEvents)); -} - -uint32_t colorMaker(uint8_t r, uint8_t g, uint8_t b){ - uint32_t c; - c = r; - c <<= 8; - c |= g; - c <<= 8; - c |= b; - return c; -} - - - int main() { BLE& ble = BLE::Instance();