Kris Scholte Lubberink
/
SSS_Ble
Ble for smart sOlutions
Diff: source/main.cpp
- Revision:
- 10:d845189d146e
- Parent:
- 9:92d861703f96
- Child:
- 11:d6ed1437c2ee
diff -r 92d861703f96 -r d845189d146e source/main.cpp --- a/source/main.cpp Tue Jun 11 11:16:55 2019 +0200 +++ b/source/main.cpp Fri Jun 14 10:24:57 2019 +0200 @@ -23,25 +23,14 @@ #include "ColorService.h" #include "BleDeviceCentral.h" #include "BleDevicePeripheral.h" +#include "MyStripSingleton.h" #define MBED_CONF_PLATFORM_ERROR_FILENAME_CAPTURE_ENABLED true -DigitalOut led1(LED1, 1); - -//const static char DEVICE_NAME[] = "SSS-Wearable"; -static const uint16_t uuid16_list[] = {0xF0C0FF}; +MyStripSingleton* MyStripSingleton::instance = 0; -int rainbow[] = {0xff00ff,0xff00cc,0xff0099,0xff0066,0xff0033,0xff0000,0xff3300,0xff6600, - 0xff9900,0xffcc00,0xffff00,0xccff00,0x99ff00,0x66ff00,0x33ff00,0x00ff00, - 0x00ff33,0x00ff66,0x00ff99,0x00ffcc}; - - -//static ColorService* colorServicePtr; +DigitalOut led1(LED1, 1); static EventQueue eventQueue(/* event count */ 16 * EVENTS_EVENT_SIZE); -void updateSensorValue() { -// printf("Right now, i should update sensor value. This runs only during connection \r\n"); -// colorServicePtr->updateColor((int[]){16711680, 16711682, 16711680, 16711680, 16711680, 16711680, 16711680, 16711680, 16711680, 16711680, 16711680, 16711680, 16711680, 16711680, 16711680, 16711680, 16711680, 16711680, 16711680, 16711680, 16711680, 16711680}); -} void blinkCallback(void) { @@ -51,7 +40,9 @@ if (ble.gap().getState().connected) { - eventQueue.call(updateSensorValue); + /* Hier kan je nog iets doen wanneer je verbonden bent */ +// eventQueue.call(updateSensorValue); + } else { ble.gap().startAdvertising(); printf("Stopped advertisement"); @@ -103,15 +94,17 @@ BLE& ble = BLE::Instance(); events::EventQueue queue; printf(" Is filename capture enabled? \t\t"); -// DigitalOut p = DigitalOut(p2); -// p = 1; #if MBED_CONF_PLATFORM_ERROR_FILENAME_CAPTURE_ENABLED printf(" Enabled filename capture"); #endif BleDevicePeripheral peripheral(ble, queue); BleDeviceCentral central(ble, queue); + MyStripSingleton* inst = MyStripSingleton::getInstance(); + MyStripSingleton::getInstance()->colorWipe(1, 0x00FF00); + MyStripSingleton::getInstance()->blink(10, 2); + MyStripSingleton::getInstance()->flash(1, 0xFFFF00); while(1) { printf("\r\n PERIPHERAL \r\n\r\n"); @@ -121,7 +114,6 @@ printf("\r\n CENTRAL \r\n\r\n"); central.run(10000); central.stop(); - } return 0; }