share for RS

Fork of rbVectorIQ by Mark @RRVA

Committer:
MarkSPA
Date:
Tue Apr 18 17:00:37 2017 +0000
Revision:
13:047bbd59f351
Parent:
12:99c81e757506
Child:
14:459081f9f70b
Added code for buzzer and peizo

Who changed what in which revision?

UserRevisionLine numberNew contents of line
RedBearLab 1:f03072e32ed3 1 /*
RedBearLab 1:f03072e32ed3 2
MarkSPA 13:047bbd59f351 3 Copyright (c) 2017 Radiant RVA
RedBearLab 1:f03072e32ed3 4
MarkSPA 4:c8515fbd2e44 5 Permission is hereby granted, free of charge, to any person obtaining a copy of this software
MarkSPA 4:c8515fbd2e44 6 and associated documentation files (the "Software"), to deal in the Software without restriction,
MarkSPA 4:c8515fbd2e44 7 including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
MarkSPA 4:c8515fbd2e44 8 and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
RedBearLab 1:f03072e32ed3 9 subject to the following conditions:
RedBearLab 1:f03072e32ed3 10 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
RedBearLab 1:f03072e32ed3 11
MarkSPA 4:c8515fbd2e44 12 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
MarkSPA 4:c8515fbd2e44 13 INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
MarkSPA 4:c8515fbd2e44 14 PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
MarkSPA 4:c8515fbd2e44 15 FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
RedBearLab 1:f03072e32ed3 16 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
RedBearLab 1:f03072e32ed3 17
RedBearLab 1:f03072e32ed3 18 */
MarkSPA 13:047bbd59f351 19 #include "vector_iq.h"
RedBearLab 0:dfcebc1e442a 20
MarkSPA 4:c8515fbd2e44 21
MarkSPA 4:c8515fbd2e44 22 void connectionCallback(const Gap::ConnectionCallbackParams_t *params)
MarkSPA 4:c8515fbd2e44 23 {
MarkSPA 4:c8515fbd2e44 24 neopixel_init(&m_strip, dig_pin_num, NUM_LEDS);
MarkSPA 4:c8515fbd2e44 25 neopixel_clear(&m_strip);
MarkSPA 7:0db51a3107fc 26 LEDS_ON_FLAG = 0;
MarkSPA 4:c8515fbd2e44 27 }
RedBearLab 0:dfcebc1e442a 28
RedBearLab 3:823f105078c7 29 void disconnectionCallback(const Gap::DisconnectionCallbackParams_t *params)
RedBearLab 0:dfcebc1e442a 30 {
MarkSPA 4:c8515fbd2e44 31 //pc.printf("Disconnected \r\n");
MarkSPA 4:c8515fbd2e44 32 //pc.printf("Restart advertising \r\n");
MarkSPA 4:c8515fbd2e44 33 //clear and remove strip
MarkSPA 4:c8515fbd2e44 34 //neopixel_clear(&m_strip);
MarkSPA 4:c8515fbd2e44 35 //neopixel_destroy(&m_strip);
MarkSPA 7:0db51a3107fc 36 //strcpy(mDeviceName, "RRVA Cntd");
MarkSPA 7:0db51a3107fc 37 //setup_advertising();
MarkSPA 13:047bbd59f351 38 BLE::Instance(BLE::DEFAULT_INSTANCE).gap().startAdvertising(); // restart advertising
MarkSPA 13:047bbd59f351 39 //ble.startAdvertising();
RedBearLab 0:dfcebc1e442a 40 }
RedBearLab 0:dfcebc1e442a 41
RedBearLab 2:bbcdd23ba9ba 42 void WrittenHandler(const GattWriteCallbackParams *Handler)
MarkSPA 4:c8515fbd2e44 43 {
RedBearLab 0:dfcebc1e442a 44 uint8_t buf[TXRX_BUF_LEN];
MarkSPA 4:c8515fbd2e44 45 uint16_t bytesRead;
MarkSPA 4:c8515fbd2e44 46
MarkSPA 4:c8515fbd2e44 47 if (Handler->handle == txCharacteristic.getValueAttribute().getHandle()) {
RedBearLab 0:dfcebc1e442a 48 ble.readCharacteristicValue(txCharacteristic.getValueAttribute().getHandle(), buf, &bytesRead);
RedBearLab 0:dfcebc1e442a 49 memset(txPayload, 0, TXRX_BUF_LEN);
MarkSPA 4:c8515fbd2e44 50 memcpy(txPayload, buf, TXRX_BUF_LEN);
MarkSPA 4:c8515fbd2e44 51
MarkSPA 4:c8515fbd2e44 52 //for(index=0; index<bytesRead; index++)
MarkSPA 4:c8515fbd2e44 53 //pc.putc(buf[index]);
RedBearLab 0:dfcebc1e442a 54
MarkSPA 4:c8515fbd2e44 55 if(buf[0] == ONOFF_HEADER) {
MarkSPA 4:c8515fbd2e44 56 //pc.printf("LED value received \r\n");
MarkSPA 4:c8515fbd2e44 57 if(buf[1] == LEDS_ON) {
MarkSPA 4:c8515fbd2e44 58 LEDS_ON_FLAG = 1;
MarkSPA 4:c8515fbd2e44 59 } else if(buf[1] == LEDS_OFF) {
MarkSPA 4:c8515fbd2e44 60 LEDS_ON_FLAG = 0;
MarkSPA 4:c8515fbd2e44 61 neopixel_init(&m_strip, dig_pin_num, NUM_LEDS);
MarkSPA 4:c8515fbd2e44 62 neopixel_clear(&m_strip);
MarkSPA 4:c8515fbd2e44 63 }
MarkSPA 4:c8515fbd2e44 64 } else if(buf[0] == COLOR_HEADER) {
MarkSPA 4:c8515fbd2e44 65 red = buf[1];
MarkSPA 4:c8515fbd2e44 66 green = buf[2];
MarkSPA 4:c8515fbd2e44 67 blue = buf[3];
MarkSPA 4:c8515fbd2e44 68 pattern = buf[5];
MarkSPA 13:047bbd59f351 69 } else if(buf[0] == PIEZO_HEADER) {
MarkSPA 13:047bbd59f351 70 mPiezoOn = buf[1];
MarkSPA 13:047bbd59f351 71 } else if(buf[0] == HAPTIC_HEADER) {
MarkSPA 13:047bbd59f351 72 mHapticOn = buf[1];
MarkSPA 13:047bbd59f351 73 mHapticDur = buf[2];
MarkSPA 13:047bbd59f351 74 mHapticPattern = buf[3];
MarkSPA 13:047bbd59f351 75 }
MarkSPA 6:074f5ec7428c 76 else
MarkSPA 6:074f5ec7428c 77 {
MarkSPA 6:074f5ec7428c 78 LEDS_ON_FLAG = 1;
MarkSPA 6:074f5ec7428c 79 red = buf[1];
MarkSPA 6:074f5ec7428c 80 green = buf[2];
MarkSPA 6:074f5ec7428c 81 blue = buf[3];
MarkSPA 6:074f5ec7428c 82 pattern = buf[5];
MarkSPA 6:074f5ec7428c 83 }
RedBearLab 0:dfcebc1e442a 84 }
RedBearLab 0:dfcebc1e442a 85 }
MarkSPA 4:c8515fbd2e44 86
RedBearLab 0:dfcebc1e442a 87 void m_status_check_handle(void)
MarkSPA 4:c8515fbd2e44 88 {
MarkSPA 13:047bbd59f351 89 //uint8_t buf[3];
MarkSPA 4:c8515fbd2e44 90
MarkSPA 13:047bbd59f351 91 /* if (BUTTON == 1)
MarkSPA 13:047bbd59f351 92 LEDS_ON_FLAG = 0;
MarkSPA 13:047bbd59f351 93 else if (BUTTON == 0)
MarkSPA 13:047bbd59f351 94 LEDS_ON_FLAG = 1; */
MarkSPA 13:047bbd59f351 95
MarkSPA 13:047bbd59f351 96 /*if (BUTTON != old_state) {
RedBearLab 0:dfcebc1e442a 97 old_state = BUTTON;
MarkSPA 10:eb100af346bf 98 if (LEDS_ON_FLAG)
MarkSPA 13:047bbd59f351 99 LEDS_ON_FLAG = 0;
MarkSPA 10:eb100af346bf 100 else
MarkSPA 13:047bbd59f351 101 LEDS_ON_FLAG = 1;
MarkSPA 10:eb100af346bf 102
MarkSPA 4:c8515fbd2e44 103 if (BUTTON == 1) {
RedBearLab 0:dfcebc1e442a 104 buf[0] = (0x0A);
RedBearLab 0:dfcebc1e442a 105 buf[1] = (0x01);
MarkSPA 4:c8515fbd2e44 106 buf[2] = (0x00);
MarkSPA 4:c8515fbd2e44 107 ble.updateCharacteristicValue(rxCharacteristic.getValueAttribute().getHandle(), buf, 3);
MarkSPA 4:c8515fbd2e44 108 } else {
RedBearLab 0:dfcebc1e442a 109 buf[0] = (0x0A);
RedBearLab 0:dfcebc1e442a 110 buf[1] = (0x00);
RedBearLab 0:dfcebc1e442a 111 buf[2] = (0x00);
MarkSPA 4:c8515fbd2e44 112 ble.updateCharacteristicValue(rxCharacteristic.getValueAttribute().getHandle(), buf, 3);
MarkSPA 13:047bbd59f351 113 }
MarkSPA 13:047bbd59f351 114 } */
RedBearLab 0:dfcebc1e442a 115 }
RedBearLab 0:dfcebc1e442a 116
MarkSPA 4:c8515fbd2e44 117 void ble_on_radio_active_evt(bool radio_active)
MarkSPA 4:c8515fbd2e44 118 {
MarkSPA 13:047bbd59f351 119 if (radio_active == false) {
MarkSPA 13:047bbd59f351 120 if (mHapticOn == HAPTIC_ON) {
MarkSPA 13:047bbd59f351 121 BUZZER = 1;
MarkSPA 13:047bbd59f351 122 //wait_ms(1000);
MarkSPA 13:047bbd59f351 123 } else {
MarkSPA 13:047bbd59f351 124 BUZZER = 0;
MarkSPA 13:047bbd59f351 125 //wait_ms(1000);
MarkSPA 13:047bbd59f351 126 }
MarkSPA 13:047bbd59f351 127 if (mPiezoOn == PIEZO_ON) {
MarkSPA 13:047bbd59f351 128 for (int i = 0; i < (sizeof(freq_coll) / sizeof(int)); i++) {
MarkSPA 13:047bbd59f351 129 PIEZO.period(1.0 / freq_coll[i]);
MarkSPA 13:047bbd59f351 130 PIEZO.write(0.5);
MarkSPA 13:047bbd59f351 131 wait(1.0 / beat_coll[i]);
MarkSPA 13:047bbd59f351 132 PIEZO.write(0);
MarkSPA 13:047bbd59f351 133 wait(0.05);
MarkSPA 13:047bbd59f351 134 }
MarkSPA 13:047bbd59f351 135 } else {
MarkSPA 13:047bbd59f351 136 BUZZER = 0;
MarkSPA 13:047bbd59f351 137 //wait_ms(1000);
MarkSPA 4:c8515fbd2e44 138 }
MarkSPA 13:047bbd59f351 139 if (LEDS_ON_FLAG == 1) {
MarkSPA 13:047bbd59f351 140 if (pattern == PATTERN_ON) {
MarkSPA 13:047bbd59f351 141 for (uint8_t i = 0; i <= NUM_LEDS; i++)
MarkSPA 13:047bbd59f351 142 neopixel_set_color(&m_strip, i, red, green, blue);
MarkSPA 13:047bbd59f351 143 neopixel_show(&m_strip);
MarkSPA 13:047bbd59f351 144
MarkSPA 13:047bbd59f351 145 } else if (pattern == PATTERN_FAST) {
MarkSPA 13:047bbd59f351 146 //neopixel_clear(&m_strip);
MarkSPA 13:047bbd59f351 147 for (uint8_t i = 0; i <= NUM_LEDS; i++)
MarkSPA 13:047bbd59f351 148 neopixel_set_color(&m_strip, i, 0, 0, 0);
MarkSPA 13:047bbd59f351 149 if (led_to_enable > NUM_LEDS)
MarkSPA 13:047bbd59f351 150 led_to_enable = 0;
MarkSPA 13:047bbd59f351 151 neopixel_set_color(&m_strip, led_to_enable, red, green, blue);
MarkSPA 13:047bbd59f351 152 neopixel_show(&m_strip);
MarkSPA 13:047bbd59f351 153 led_to_enable++;
MarkSPA 13:047bbd59f351 154 } else if (pattern == PATTERN_SLOW) {
MarkSPA 13:047bbd59f351 155 for (uint8_t i = 0; i <= NUM_LEDS; i++)
MarkSPA 13:047bbd59f351 156 neopixel_set_color(&m_strip, i, 0, 0, 0);
MarkSPA 13:047bbd59f351 157 if (led_to_enable > NUM_LEDS)
MarkSPA 13:047bbd59f351 158 led_to_enable = 0;
MarkSPA 13:047bbd59f351 159 neopixel_set_color(&m_strip, led_to_enable, red, green, blue);
MarkSPA 13:047bbd59f351 160 neopixel_show(&m_strip);
MarkSPA 13:047bbd59f351 161 led_to_enable++;
MarkSPA 13:047bbd59f351 162 wait_ms(1000);
MarkSPA 13:047bbd59f351 163
MarkSPA 13:047bbd59f351 164 } else if (pattern == PATTERN_CHASE) {
MarkSPA 13:047bbd59f351 165 for (uint8_t i = 0; i < NUM_LEDS; i++)
MarkSPA 13:047bbd59f351 166 neopixel_set_color(&m_strip, i, red, green, blue);
MarkSPA 13:047bbd59f351 167 neopixel_show(&m_strip);
MarkSPA 13:047bbd59f351 168
MarkSPA 13:047bbd59f351 169 } else if (pattern == PATTERN_MRB) {
MarkSPA 13:047bbd59f351 170 //neopixel_clear(&m_strip);
MarkSPA 13:047bbd59f351 171 for (uint8_t i = 0; i <= NUM_LEDS; i++)
MarkSPA 13:047bbd59f351 172 neopixel_set_color(&m_strip, i, 0, 0, 0);
MarkSPA 13:047bbd59f351 173 led_to_enable = rand()%NUM_LEDS;
MarkSPA 13:047bbd59f351 174 neopixel_set_color(&m_strip, led_to_enable, red, green, blue);
MarkSPA 13:047bbd59f351 175 neopixel_show(&m_strip);
MarkSPA 13:047bbd59f351 176 }
MarkSPA 13:047bbd59f351 177
MarkSPA 13:047bbd59f351 178 else if (pattern == PATTERN_RAINBOW)
MarkSPA 13:047bbd59f351 179 rainbowCycle(20, NUM_LEDS, m_strip);
MarkSPA 13:047bbd59f351 180
MarkSPA 13:047bbd59f351 181 else if (pattern == PATTERN_CANDY)
MarkSPA 13:047bbd59f351 182 candyChase(100, NUM_LEDS, m_strip);
MarkSPA 13:047bbd59f351 183
MarkSPA 13:047bbd59f351 184 else if (pattern == PATTERN_SNOW)
MarkSPA 13:047bbd59f351 185 snowflakes(250, NUM_LEDS, m_strip);
MarkSPA 13:047bbd59f351 186
MarkSPA 13:047bbd59f351 187 else if (pattern == PATTERN_ICE)
MarkSPA 13:047bbd59f351 188 iceflakes(150, NUM_LEDS, m_strip);
MarkSPA 13:047bbd59f351 189
MarkSPA 13:047bbd59f351 190 else if (pattern == PATTERN_XMAS)
MarkSPA 13:047bbd59f351 191 xmas(200, NUM_LEDS, m_strip);
MarkSPA 13:047bbd59f351 192
MarkSPA 13:047bbd59f351 193 else if (pattern == PATTERN_COL)
MarkSPA 13:047bbd59f351 194 collegiate(100, NUM_LEDS, m_strip);
MarkSPA 13:047bbd59f351 195
MarkSPA 13:047bbd59f351 196 else if (pattern == PATTERN_IRON)
MarkSPA 13:047bbd59f351 197 irondude(250, NUM_LEDS, m_strip);
MarkSPA 13:047bbd59f351 198
MarkSPA 13:047bbd59f351 199 else if (pattern == PATTERN_EASTER)
MarkSPA 13:047bbd59f351 200 easter(250, NUM_LEDS, m_strip);
MarkSPA 13:047bbd59f351 201
MarkSPA 13:047bbd59f351 202 else if (pattern == PATTERN_SPRING)
MarkSPA 13:047bbd59f351 203 spring(250, NUM_LEDS, m_strip);
MarkSPA 13:047bbd59f351 204
MarkSPA 13:047bbd59f351 205 else if (pattern == PATTERN_MEM)
MarkSPA 13:047bbd59f351 206 memorial(250, NUM_LEDS, m_strip);
MarkSPA 13:047bbd59f351 207
MarkSPA 13:047bbd59f351 208 else
MarkSPA 13:047bbd59f351 209 neopixel_clear(&m_strip);
MarkSPA 13:047bbd59f351 210 }
MarkSPA 4:c8515fbd2e44 211 }
MarkSPA 4:c8515fbd2e44 212 }
MarkSPA 4:c8515fbd2e44 213
MarkSPA 4:c8515fbd2e44 214 static void radio_notification_init(void)
MarkSPA 4:c8515fbd2e44 215 {
MarkSPA 4:c8515fbd2e44 216 //uint32_t err_code;
MarkSPA 4:c8515fbd2e44 217 ble_radio_notification_init(NRF_APP_PRIORITY_LOW,
MarkSPA 4:c8515fbd2e44 218 NRF_RADIO_NOTIFICATION_DISTANCE_800US,
MarkSPA 4:c8515fbd2e44 219 ble_on_radio_active_evt);
MarkSPA 4:c8515fbd2e44 220 //APP_ERROR_CHECK(err_code);
MarkSPA 4:c8515fbd2e44 221 }
RedBearLab 0:dfcebc1e442a 222
MarkSPA 13:047bbd59f351 223 void bleInitComplete(BLE::InitializationCompleteCallbackContext *params)
MarkSPA 7:0db51a3107fc 224 {
MarkSPA 13:047bbd59f351 225 BLE &ble = params->ble;
MarkSPA 13:047bbd59f351 226 ble_error_t error = params->error;
MarkSPA 13:047bbd59f351 227
MarkSPA 13:047bbd59f351 228 if (error != BLE_ERROR_NONE) {
MarkSPA 13:047bbd59f351 229 return;
MarkSPA 13:047bbd59f351 230 }
MarkSPA 7:0db51a3107fc 231 int length = strlen(mDeviceName);
MarkSPA 13:047bbd59f351 232
MarkSPA 13:047bbd59f351 233 ble.gap().onDisconnection(disconnectionCallback);
MarkSPA 7:0db51a3107fc 234
MarkSPA 13:047bbd59f351 235 /* Setup primary (UART) service */
MarkSPA 13:047bbd59f351 236 ble.gattServer().addService(uartService);
MarkSPA 13:047bbd59f351 237
MarkSPA 13:047bbd59f351 238 /* Setup auxiliary service. */
MarkSPA 13:047bbd59f351 239 deviceInfo = new DeviceInformationService(ble, "RRVA", "VectorIQ", "SN1", "hw-rev1", "fw-rev1-1-0", "soft-rev1");
MarkSPA 13:047bbd59f351 240 //deviceInfo = new DeviceInformationService(ble, "RRVA", "VIQ", "", "", "1-0-0", "");
MarkSPA 13:047bbd59f351 241
MarkSPA 7:0db51a3107fc 242 // setup advertising
MarkSPA 13:047bbd59f351 243 ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED); // | GapAdvertisingData::LE_GENERAL_DISCOVERABLE);
MarkSPA 13:047bbd59f351 244 ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_16BIT_SERVICE_IDS,
MarkSPA 13:047bbd59f351 245 (uint8_t *)uuid16_list, sizeof(uuid16_list));
MarkSPA 13:047bbd59f351 246 ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_128BIT_SERVICE_IDS,
MarkSPA 13:047bbd59f351 247 (const uint8_t *)uart_base_uuid_rev, sizeof(uart_base_uuid));
MarkSPA 7:0db51a3107fc 248 ble.accumulateAdvertisingPayload(GapAdvertisingData::SHORTENED_LOCAL_NAME,
MarkSPA 13:047bbd59f351 249 (const uint8_t *)&mDeviceName, mLength);
MarkSPA 13:047bbd59f351 250 ble.gap().setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED);
MarkSPA 13:047bbd59f351 251 ble.gap().setAdvertisingInterval(500); /* ms */
MarkSPA 13:047bbd59f351 252 ble.gap().startAdvertising();
MarkSPA 13:047bbd59f351 253 //ble.startAdvertising();
MarkSPA 7:0db51a3107fc 254 //pc.printf("Advertising Start \r\n");
MarkSPA 7:0db51a3107fc 255 }
MarkSPA 7:0db51a3107fc 256
RedBearLab 0:dfcebc1e442a 257 int main(void)
MarkSPA 4:c8515fbd2e44 258 {
MarkSPA 4:c8515fbd2e44 259 //uint8_t led_error;
MarkSPA 13:047bbd59f351 260 //BUTTON.mode(PullNone);
RedBearLab 0:dfcebc1e442a 261 Ticker ticker;
RedBearLab 0:dfcebc1e442a 262 ticker.attach_us(m_status_check_handle, 200000);
MarkSPA 13:047bbd59f351 263
MarkSPA 13:047bbd59f351 264 strcpy(mDeviceName, "VIQ");
MarkSPA 13:047bbd59f351 265 mLength = strlen(mDeviceName);
MarkSPA 4:c8515fbd2e44 266
MarkSPA 4:c8515fbd2e44 267 //pc.printf("neoPixel Init \r\n");
MarkSPA 4:c8515fbd2e44 268 neopixel_init(&m_strip, dig_pin_num, NUM_LEDS);
MarkSPA 4:c8515fbd2e44 269 neopixel_clear(&m_strip);
MarkSPA 13:047bbd59f351 270
MarkSPA 13:047bbd59f351 271 BLE& ble = BLE::Instance(BLE::DEFAULT_INSTANCE);
MarkSPA 13:047bbd59f351 272 ble.init(bleInitComplete);
MarkSPA 13:047bbd59f351 273
MarkSPA 13:047bbd59f351 274 /* Explicitly enable over-the-air firmware updates. Instantiating DFUSservice introduces a
MarkSPA 13:047bbd59f351 275 * control characteristic which can be used to trigger the application to
MarkSPA 13:047bbd59f351 276 * handover control to a resident bootloader. */
MarkSPA 13:047bbd59f351 277 //DFUService dfu(ble);
MarkSPA 4:c8515fbd2e44 278
MarkSPA 13:047bbd59f351 279 //ble.init();
MarkSPA 13:047bbd59f351 280 //ble.onDisconnection(disconnectionCallback);
MarkSPA 4:c8515fbd2e44 281 ble.onConnection(connectionCallback);
MarkSPA 4:c8515fbd2e44 282 ble.onDataWritten(WrittenHandler);
MarkSPA 4:c8515fbd2e44 283 radio_notification_init();
MarkSPA 4:c8515fbd2e44 284 //pc.baud(9600);
MarkSPA 4:c8515fbd2e44 285 //pc.format(8, SerialBase::None, 1);
MarkSPA 4:c8515fbd2e44 286 //pc.printf("rbChromaBand Init \r\n");
MarkSPA 4:c8515fbd2e44 287 //pc.attach( uartCB , pc.RxIrq);
MarkSPA 7:0db51a3107fc 288
MarkSPA 13:047bbd59f351 289 /* SpinWait for initialization to complete. This is necessary because the
MarkSPA 13:047bbd59f351 290 * BLE object is used in the main loop below. */
MarkSPA 13:047bbd59f351 291 //while (ble.hasInitialized() == false) { /* spin loop */ }
RedBearLab 0:dfcebc1e442a 292
MarkSPA 13:047bbd59f351 293 //setup_advertising();
MarkSPA 4:c8515fbd2e44 294
MarkSPA 4:c8515fbd2e44 295 while(1) {
MarkSPA 4:c8515fbd2e44 296 //pc.putc(pc.getc());
MarkSPA 4:c8515fbd2e44 297 ble.waitForEvent();
RedBearLab 0:dfcebc1e442a 298 }
RedBearLab 0:dfcebc1e442a 299 }
RedBearLab 0:dfcebc1e442a 300
RedBearLab 0:dfcebc1e442a 301
RedBearLab 0:dfcebc1e442a 302
RedBearLab 0:dfcebc1e442a 303
RedBearLab 0:dfcebc1e442a 304
RedBearLab 0:dfcebc1e442a 305
RedBearLab 0:dfcebc1e442a 306
RedBearLab 0:dfcebc1e442a 307
RedBearLab 0:dfcebc1e442a 308
RedBearLab 0:dfcebc1e442a 309
RedBearLab 0:dfcebc1e442a 310
RedBearLab 0:dfcebc1e442a 311
RedBearLab 0:dfcebc1e442a 312
RedBearLab 0:dfcebc1e442a 313
RedBearLab 0:dfcebc1e442a 314
RedBearLab 0:dfcebc1e442a 315
RedBearLab 0:dfcebc1e442a 316
RedBearLab 0:dfcebc1e442a 317
RedBearLab 0:dfcebc1e442a 318
RedBearLab 0:dfcebc1e442a 319
RedBearLab 0:dfcebc1e442a 320
RedBearLab 0:dfcebc1e442a 321
RedBearLab 0:dfcebc1e442a 322
RedBearLab 0:dfcebc1e442a 323
RedBearLab 0:dfcebc1e442a 324
RedBearLab 0:dfcebc1e442a 325
RedBearLab 0:dfcebc1e442a 326
RedBearLab 0:dfcebc1e442a 327
RedBearLab 0:dfcebc1e442a 328
RedBearLab 0:dfcebc1e442a 329
RedBearLab 0:dfcebc1e442a 330
RedBearLab 0:dfcebc1e442a 331