USonicLibに対応したMSC

Dependencies:   BLE_API mbed nRF51822

Fork of nRF51822_SimpleChat by RedBearLab

Committer:
ke_ix1
Date:
Thu Dec 08 13:53:36 2016 +0000
Revision:
5:29b82cc045b6
Parent:
4:ddf414d64ea9
Child:
6:1331ef9ec5cc
???????TxPower????

Who changed what in which revision?

UserRevisionLine numberNew contents of line
RedBearLab 1:1c058e553423 1 /*
RedBearLab 0:cffe8ac1bdf0 2
RedBearLab 1:1c058e553423 3 Copyright (c) 2012-2014 RedBearLab
RedBearLab 1:1c058e553423 4
RedBearLab 1:1c058e553423 5 Permission is hereby granted, free of charge, to any person obtaining a copy of this software
RedBearLab 1:1c058e553423 6 and associated documentation files (the "Software"), to deal in the Software without restriction,
RedBearLab 1:1c058e553423 7 including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
RedBearLab 1:1c058e553423 8 and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
RedBearLab 1:1c058e553423 9 subject to the following conditions:
RedBearLab 1:1c058e553423 10 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
RedBearLab 1:1c058e553423 11
RedBearLab 1:1c058e553423 12 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
RedBearLab 1:1c058e553423 13 INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
RedBearLab 1:1c058e553423 14 PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
RedBearLab 1:1c058e553423 15 FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
RedBearLab 1:1c058e553423 16 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
RedBearLab 1:1c058e553423 17
RedBearLab 1:1c058e553423 18 */
RedBearLab 1:1c058e553423 19
RedBearLab 1:1c058e553423 20 /*
RedBearLab 1:1c058e553423 21 * The application works with the BLEController iOS/Android App.
RedBearLab 1:1c058e553423 22 * Type something from the Terminal to send
RedBearLab 1:1c058e553423 23 * to the BLEController App or vice verse.
RedBearLab 1:1c058e553423 24 * Characteristics received from App will print on Terminal.
RedBearLab 1:1c058e553423 25 */
RedBearLab 1:1c058e553423 26
RedBearLab 0:cffe8ac1bdf0 27 #include "mbed.h"
RedBearLab 2:4b66b69c7ecb 28 #include "ble/BLE.h"
ke_ix1 3:175ba3a059cb 29 #include <string.h>
ke_ix1 4:ddf414d64ea9 30
ke_ix1 5:29b82cc045b6 31 // TX POWER用
ke_ix1 5:29b82cc045b6 32 #include "ble_gap.h"
ke_ix1 5:29b82cc045b6 33 #define TX_POWER -40
RedBearLab 0:cffe8ac1bdf0 34
RedBearLab 0:cffe8ac1bdf0 35 #define BLE_UUID_TXRX_SERVICE 0x0000 /**< The UUID of the Nordic UART Service. */
RedBearLab 0:cffe8ac1bdf0 36 #define BLE_UUID_TX_CHARACTERISTIC 0x0002 /**< The UUID of the TX Characteristic. */
RedBearLab 0:cffe8ac1bdf0 37 #define BLE_UUIDS_RX_CHARACTERISTIC 0x0003 /**< The UUID of the RX Characteristic. */
RedBearLab 0:cffe8ac1bdf0 38
RedBearLab 0:cffe8ac1bdf0 39 #define TXRX_BUF_LEN 20
RedBearLab 0:cffe8ac1bdf0 40
RedBearLab 2:4b66b69c7ecb 41 BLE ble;
RedBearLab 0:cffe8ac1bdf0 42
RedBearLab 0:cffe8ac1bdf0 43 Serial pc(USBTX, USBRX);
ke_ix1 3:175ba3a059cb 44 Ticker steper;
ke_ix1 5:29b82cc045b6 45 DigitalOut ledori1(LED1);
RedBearLab 0:cffe8ac1bdf0 46
RedBearLab 0:cffe8ac1bdf0 47
RedBearLab 0:cffe8ac1bdf0 48 // The Nordic UART Service
ke_ix1 4:ddf414d64ea9 49 //static const uint8_t uart_base_uuid[] = {0x71, 0x3D, 0, 0, 0x50, 0x3E, 0x4C, 0x75, 0xBA, 0x94, 0x31, 0x48, 0xF1, 0x8D, 0x94, 0x1E};
ke_ix1 4:ddf414d64ea9 50 //static const uint8_t uart_tx_uuid[] = {0x71, 0x3D, 0, 3, 0x50, 0x3E, 0x4C, 0x75, 0xBA, 0x94, 0x31, 0x48, 0xF1, 0x8D, 0x94, 0x1E};
ke_ix1 4:ddf414d64ea9 51 //static const uint8_t uart_rx_uuid[] = {0x71, 0x3D, 0, 2, 0x50, 0x3E, 0x4C, 0x75, 0xBA, 0x94, 0x31, 0x48, 0xF1, 0x8D, 0x94, 0x1E};
ke_ix1 4:ddf414d64ea9 52 //static const uint8_t uart_base_uuid_rev[] = {0x1E, 0x94, 0x8D, 0xF1, 0x48, 0x31, 0x94, 0xBA, 0x75, 0x4C, 0x3E, 0x50, 0, 0, 0x3D, 0x71};
RedBearLab 0:cffe8ac1bdf0 53
ke_ix1 4:ddf414d64ea9 54 // Send One CLK Service
ke_ix1 4:ddf414d64ea9 55 static const uint8_t uart_base_uuid[] = {0x53, 0xF3, 0xF5, 0x38, 0x8D, 0x11, 0x48, 0x02, 0xB6, 0xFC, 0xFB, 0x66, 0x16, 0xD4, 0xCD, 0x7C}; //Service
ke_ix1 4:ddf414d64ea9 56 static const uint8_t uart_tx_uuid[] = {0x71, 0x3D, 0, 3, 0x50, 0x3E, 0x4C, 0x75, 0xBA, 0x94, 0x31, 0x48, 0xF1, 0x8D, 0x94, 0x1E}; //central_送信用
ke_ix1 4:ddf414d64ea9 57 static const uint8_t uart_rx_uuid[] = {0x71, 0x3D, 0, 2, 0x50, 0x3E, 0x4C, 0x75, 0xBA, 0x94, 0x31, 0x48, 0xF1, 0x8D, 0x94, 0x1E}; //central_受信用
ke_ix1 4:ddf414d64ea9 58 static const uint8_t uart_base_uuid_rev[] = {0x7C, 0xCD, 0xD4, 0x16, 0x66, 0xFB, 0xFC, 0xB6, 0x02, 0x48, 0x11, 0x8D, 0x38, 0xF5, 0xF3, 0x53};
ke_ix1 4:ddf414d64ea9 59
ke_ix1 5:29b82cc045b6 60
ke_ix1 5:29b82cc045b6 61 // TX POWER用
ke_ix1 5:29b82cc045b6 62 static const uint8_t power_level_uuid[] = {0x71, 0x3D, 0, 4, 0x50, 0x3E, 0x4C, 0x75, 0xBA, 0x94, 0x31, 0x48, 0xF1, 0x8D, 0x94, 0x1E}; //central_TxPower受信用
ke_ix1 5:29b82cc045b6 63 uint8_t powerPayload[TXRX_BUF_LEN] = {0,};
ke_ix1 5:29b82cc045b6 64 static uint8_t power_buf[TXRX_BUF_LEN];
ke_ix1 5:29b82cc045b6 65 static uint8_t power_len=0;
ke_ix1 5:29b82cc045b6 66 GattCharacteristic txPowerCharacteristic (power_level_uuid, powerPayload, 1, TXRX_BUF_LEN, GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY); //tx power characteristic
ke_ix1 5:29b82cc045b6 67 Ticker txSteper;
RedBearLab 0:cffe8ac1bdf0 68
RedBearLab 0:cffe8ac1bdf0 69 uint8_t txPayload[TXRX_BUF_LEN] = {0,};
RedBearLab 0:cffe8ac1bdf0 70 uint8_t rxPayload[TXRX_BUF_LEN] = {0,};
RedBearLab 0:cffe8ac1bdf0 71
RedBearLab 0:cffe8ac1bdf0 72 static uint8_t rx_buf[TXRX_BUF_LEN];
RedBearLab 0:cffe8ac1bdf0 73 static uint8_t rx_len=0;
ke_ix1 3:175ba3a059cb 74 static uint8_t rx_buf_st[20];
ke_ix1 4:ddf414d64ea9 75
ke_ix1 4:ddf414d64ea9 76 int8_t buf_before[40];
ke_ix1 4:ddf414d64ea9 77
ke_ix1 4:ddf414d64ea9 78 static int st = 0;
ke_ix1 4:ddf414d64ea9 79
RedBearLab 0:cffe8ac1bdf0 80
RedBearLab 0:cffe8ac1bdf0 81 GattCharacteristic txCharacteristic (uart_tx_uuid, txPayload, 1, TXRX_BUF_LEN, GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE_WITHOUT_RESPONSE);
RedBearLab 0:cffe8ac1bdf0 82
RedBearLab 0:cffe8ac1bdf0 83 GattCharacteristic rxCharacteristic (uart_rx_uuid, rxPayload, 1, TXRX_BUF_LEN, GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY);
ke_ix1 5:29b82cc045b6 84
ke_ix1 5:29b82cc045b6 85 GattCharacteristic *uartChars[] = {&txCharacteristic, &rxCharacteristic, &txPowerCharacteristic};
RedBearLab 0:cffe8ac1bdf0 86
RedBearLab 0:cffe8ac1bdf0 87 GattService uartService(uart_base_uuid, uartChars, sizeof(uartChars) / sizeof(GattCharacteristic *));
RedBearLab 0:cffe8ac1bdf0 88
ke_ix1 5:29b82cc045b6 89 // TX POWER用
ke_ix1 5:29b82cc045b6 90 void txPowerUpdate(int newTxPower) {
ke_ix1 5:29b82cc045b6 91 sd_ble_gap_tx_power_set(newTxPower);
ke_ix1 5:29b82cc045b6 92 //ここから-------------
ke_ix1 5:29b82cc045b6 93 char bufbuf_c[20];
ke_ix1 5:29b82cc045b6 94 uint8_t bufbuf[40];
ke_ix1 5:29b82cc045b6 95 sprintf(bufbuf_c, "%d", newTxPower);
ke_ix1 5:29b82cc045b6 96 int a;
ke_ix1 5:29b82cc045b6 97 for(a=0; bufbuf_c[a] != '\0'; a++) {
ke_ix1 5:29b82cc045b6 98 bufbuf[a] = bufbuf_c[a];
ke_ix1 5:29b82cc045b6 99 }
ke_ix1 5:29b82cc045b6 100 ble.updateCharacteristicValue(txPowerCharacteristic.getValueAttribute().getHandle(), bufbuf, a);
ke_ix1 5:29b82cc045b6 101 //ここまで-------------
ke_ix1 5:29b82cc045b6 102 //をこぴればデータを送信可能
ke_ix1 5:29b82cc045b6 103 }
ke_ix1 5:29b82cc045b6 104
ke_ix1 5:29b82cc045b6 105 void txStep() {
ke_ix1 5:29b82cc045b6 106 //ここから-------------
ke_ix1 5:29b82cc045b6 107 char bufbuf_c[20];
ke_ix1 5:29b82cc045b6 108 uint8_t bufbuf[40];
ke_ix1 5:29b82cc045b6 109 sprintf(bufbuf_c, "%d", TX_POWER);
ke_ix1 5:29b82cc045b6 110 int a;
ke_ix1 5:29b82cc045b6 111 for(a=0; bufbuf_c[a] != '\0'; a++) {
ke_ix1 5:29b82cc045b6 112 bufbuf[a] = bufbuf_c[a];
ke_ix1 5:29b82cc045b6 113 }
ke_ix1 5:29b82cc045b6 114 ble.updateCharacteristicValue(txPowerCharacteristic.getValueAttribute().getHandle(), bufbuf, a);
ke_ix1 5:29b82cc045b6 115 }
ke_ix1 5:29b82cc045b6 116 //-------------------
ke_ix1 5:29b82cc045b6 117
RedBearLab 0:cffe8ac1bdf0 118 void disconnectionCallback(Gap::Handle_t handle, Gap::DisconnectionReason_t reason)
RedBearLab 0:cffe8ac1bdf0 119 {
RedBearLab 0:cffe8ac1bdf0 120 pc.printf("Disconnected \r\n");
RedBearLab 0:cffe8ac1bdf0 121 pc.printf("Restart advertising \r\n");
RedBearLab 0:cffe8ac1bdf0 122 ble.startAdvertising();
RedBearLab 0:cffe8ac1bdf0 123 }
RedBearLab 0:cffe8ac1bdf0 124
ke_ix1 3:175ba3a059cb 125
ke_ix1 3:175ba3a059cb 126 void onScanCallback(const Gap::AdvertisementCallbackParams_t *params)
ke_ix1 3:175ba3a059cb 127 {
ke_ix1 4:ddf414d64ea9 128 //printf("onScanNau\n");
ke_ix1 4:ddf414d64ea9 129
ke_ix1 4:ddf414d64ea9 130 // printf("adv peerAddr[%d %d %d %d %d %d] rssi %d, isScanResponse %u, AdvertisementType %u\r\n",
ke_ix1 3:175ba3a059cb 131
ke_ix1 4:ddf414d64ea9 132 //だいじ
ke_ix1 4:ddf414d64ea9 133 /*
ke_ix1 3:175ba3a059cb 134 printf("adv peerAddr[%02x %02x %02x %02x %02x %02x] rssi %d, isScanResponse %u, AdvertisementType %u\r\n",
ke_ix1 3:175ba3a059cb 135 params->peerAddr[5], params->peerAddr[4], params->peerAddr[3], params->peerAddr[2], params->peerAddr[1], params->peerAddr[0],
ke_ix1 3:175ba3a059cb 136 params->rssi, params->isScanResponse, params->type);
ke_ix1 3:175ba3a059cb 137 printf("\n");
ke_ix1 3:175ba3a059cb 138 printf("Len:%d\n",params->advertisingDataLen);
ke_ix1 3:175ba3a059cb 139 printf("Data:");
ke_ix1 3:175ba3a059cb 140 for (int i=0; i< params->advertisingDataLen; i++){
ke_ix1 3:175ba3a059cb 141 printf("%02x,",params->advertisingData[i]);
ke_ix1 3:175ba3a059cb 142 }
ke_ix1 4:ddf414d64ea9 143 */
ke_ix1 4:ddf414d64ea9 144
ke_ix1 3:175ba3a059cb 145 // for (int i=0; i<params->advertisingDataLen; i++){
ke_ix1 3:175ba3a059cb 146 // printf("%02x,",params->advertisingData[i]);
ke_ix1 3:175ba3a059cb 147 // }
ke_ix1 3:175ba3a059cb 148
ke_ix1 3:175ba3a059cb 149 printf("\n");
ke_ix1 3:175ba3a059cb 150
ke_ix1 3:175ba3a059cb 151 // DEBUG(" \n\r");
ke_ix1 3:175ba3a059cb 152 //#endif
ke_ix1 4:ddf414d64ea9 153
ke_ix1 4:ddf414d64ea9 154
ke_ix1 3:175ba3a059cb 155 }
ke_ix1 3:175ba3a059cb 156
ke_ix1 3:175ba3a059cb 157
RedBearLab 2:4b66b69c7ecb 158 void WrittenHandler(const GattWriteCallbackParams *Handler)
RedBearLab 0:cffe8ac1bdf0 159 {
RedBearLab 0:cffe8ac1bdf0 160 uint8_t buf[TXRX_BUF_LEN];
RedBearLab 0:cffe8ac1bdf0 161 uint16_t bytesRead, index;
RedBearLab 0:cffe8ac1bdf0 162
RedBearLab 2:4b66b69c7ecb 163 if (Handler->handle == txCharacteristic.getValueAttribute().getHandle())
RedBearLab 0:cffe8ac1bdf0 164 {
RedBearLab 0:cffe8ac1bdf0 165 ble.readCharacteristicValue(txCharacteristic.getValueAttribute().getHandle(), buf, &bytesRead);
RedBearLab 0:cffe8ac1bdf0 166 memset(txPayload, 0, TXRX_BUF_LEN);
ke_ix1 3:175ba3a059cb 167 memcpy(txPayload, buf, TXRX_BUF_LEN);
RedBearLab 0:cffe8ac1bdf0 168 pc.printf("WriteHandler \r\n");
RedBearLab 0:cffe8ac1bdf0 169 pc.printf("Length: ");
RedBearLab 0:cffe8ac1bdf0 170 pc.putc(bytesRead);
RedBearLab 0:cffe8ac1bdf0 171 pc.printf("\r\n");
RedBearLab 0:cffe8ac1bdf0 172 pc.printf("Data: ");
RedBearLab 0:cffe8ac1bdf0 173 for(index=0; index<bytesRead; index++)
RedBearLab 0:cffe8ac1bdf0 174 {
RedBearLab 0:cffe8ac1bdf0 175 pc.putc(txPayload[index]);
RedBearLab 0:cffe8ac1bdf0 176 }
RedBearLab 0:cffe8ac1bdf0 177 pc.printf("\r\n");
RedBearLab 0:cffe8ac1bdf0 178 }
RedBearLab 0:cffe8ac1bdf0 179 }
RedBearLab 0:cffe8ac1bdf0 180
RedBearLab 0:cffe8ac1bdf0 181 void uartCB(void)
RedBearLab 0:cffe8ac1bdf0 182 {
RedBearLab 0:cffe8ac1bdf0 183 while(pc.readable())
RedBearLab 0:cffe8ac1bdf0 184 {
ke_ix1 3:175ba3a059cb 185 rx_buf[rx_len++] = pc.getc();
RedBearLab 0:cffe8ac1bdf0 186 if(rx_len>=20 || rx_buf[rx_len-1]=='\0' || rx_buf[rx_len-1]=='\n')
RedBearLab 0:cffe8ac1bdf0 187 {
RedBearLab 0:cffe8ac1bdf0 188 ble.updateCharacteristicValue(rxCharacteristic.getValueAttribute().getHandle(), rx_buf, rx_len);
RedBearLab 0:cffe8ac1bdf0 189 pc.printf("RecHandler \r\n");
RedBearLab 0:cffe8ac1bdf0 190 pc.printf("Length: ");
RedBearLab 0:cffe8ac1bdf0 191 pc.putc(rx_len);
RedBearLab 0:cffe8ac1bdf0 192 pc.printf("\r\n");
RedBearLab 0:cffe8ac1bdf0 193 rx_len = 0;
RedBearLab 0:cffe8ac1bdf0 194 break;
RedBearLab 0:cffe8ac1bdf0 195 }
RedBearLab 0:cffe8ac1bdf0 196 }
RedBearLab 0:cffe8ac1bdf0 197 }
RedBearLab 0:cffe8ac1bdf0 198
ke_ix1 3:175ba3a059cb 199
ke_ix1 3:175ba3a059cb 200 // 1++していく
ke_ix1 3:175ba3a059cb 201 void step() {
ke_ix1 4:ddf414d64ea9 202 ++st;
ke_ix1 4:ddf414d64ea9 203 //ここから-------------
ke_ix1 4:ddf414d64ea9 204 char bufbuf_c[20];
ke_ix1 4:ddf414d64ea9 205 uint8_t bufbuf[40];
ke_ix1 4:ddf414d64ea9 206 sprintf(bufbuf_c, "%d", st);
ke_ix1 4:ddf414d64ea9 207
ke_ix1 4:ddf414d64ea9 208 int a;
ke_ix1 4:ddf414d64ea9 209 for(a=0; bufbuf_c[a] != '\0'; a++) {
ke_ix1 4:ddf414d64ea9 210 bufbuf[a] = bufbuf_c[a];
ke_ix1 4:ddf414d64ea9 211 }
ke_ix1 4:ddf414d64ea9 212
ke_ix1 4:ddf414d64ea9 213 // ble.updateCharacteristicValue(rxCharacteristic.getValueAttribute().getHandle(), rx_buf, rx_len);
ke_ix1 4:ddf414d64ea9 214 ble.updateCharacteristicValue(rxCharacteristic.getValueAttribute().getHandle(), bufbuf, a);
ke_ix1 4:ddf414d64ea9 215 //ここまで-------------
ke_ix1 4:ddf414d64ea9 216 //をこぴればデータを送信可能
ke_ix1 4:ddf414d64ea9 217
ke_ix1 4:ddf414d64ea9 218 pc.printf("%d", st);
ke_ix1 4:ddf414d64ea9 219 pc.printf("step! \r\n");
ke_ix1 3:175ba3a059cb 220 }
ke_ix1 3:175ba3a059cb 221
ke_ix1 3:175ba3a059cb 222
ke_ix1 3:175ba3a059cb 223
ke_ix1 5:29b82cc045b6 224
RedBearLab 0:cffe8ac1bdf0 225 int main(void)
RedBearLab 0:cffe8ac1bdf0 226 {
ke_ix1 5:29b82cc045b6 227 ledori1 = 0;
RedBearLab 0:cffe8ac1bdf0 228 ble.init();
RedBearLab 0:cffe8ac1bdf0 229 ble.onDisconnection(disconnectionCallback);
RedBearLab 0:cffe8ac1bdf0 230 ble.onDataWritten(WrittenHandler);
ke_ix1 3:175ba3a059cb 231
RedBearLab 0:cffe8ac1bdf0 232 pc.baud(9600);
RedBearLab 0:cffe8ac1bdf0 233 pc.printf("SimpleChat Init \r\n");
RedBearLab 0:cffe8ac1bdf0 234
RedBearLab 0:cffe8ac1bdf0 235 pc.attach( uartCB , pc.RxIrq);
RedBearLab 0:cffe8ac1bdf0 236 // setup advertising
RedBearLab 0:cffe8ac1bdf0 237 ble.accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED);
RedBearLab 0:cffe8ac1bdf0 238 ble.setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED);
RedBearLab 0:cffe8ac1bdf0 239 ble.accumulateAdvertisingPayload(GapAdvertisingData::SHORTENED_LOCAL_NAME,
ke_ix1 4:ddf414d64ea9 240 (const uint8_t *)"KEI_SEND", sizeof("KEI_SEND") - 1);
RedBearLab 0:cffe8ac1bdf0 241 ble.accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_128BIT_SERVICE_IDS,
RedBearLab 0:cffe8ac1bdf0 242 (const uint8_t *)uart_base_uuid_rev, sizeof(uart_base_uuid));
RedBearLab 0:cffe8ac1bdf0 243 // 100ms; in multiples of 0.625ms.
RedBearLab 0:cffe8ac1bdf0 244 ble.setAdvertisingInterval(160);
RedBearLab 0:cffe8ac1bdf0 245
RedBearLab 0:cffe8ac1bdf0 246 ble.addService(uartService);
RedBearLab 0:cffe8ac1bdf0 247
ke_ix1 3:175ba3a059cb 248 ble.setScanParams(GapScanningParams::SCAN_INTERVAL_MIN,
ke_ix1 3:175ba3a059cb 249 GapScanningParams::SCAN_WINDOW_MIN,
ke_ix1 3:175ba3a059cb 250 0);
ke_ix1 3:175ba3a059cb 251
ke_ix1 3:175ba3a059cb 252 ble.startScan(&onScanCallback);
ke_ix1 3:175ba3a059cb 253
RedBearLab 0:cffe8ac1bdf0 254 ble.startAdvertising();
RedBearLab 0:cffe8ac1bdf0 255 pc.printf("Advertising Start \r\n");
RedBearLab 0:cffe8ac1bdf0 256
ke_ix1 3:175ba3a059cb 257 steper.attach(&step, 1.0);
ke_ix1 5:29b82cc045b6 258
ke_ix1 5:29b82cc045b6 259 //TX POWER用
ke_ix1 5:29b82cc045b6 260 txPowerUpdate(TX_POWER);
ke_ix1 5:29b82cc045b6 261 txSteper.attach(&txStep, 2.0);
ke_ix1 5:29b82cc045b6 262
RedBearLab 0:cffe8ac1bdf0 263 while(1)
RedBearLab 0:cffe8ac1bdf0 264 {
ke_ix1 4:ddf414d64ea9 265 ble.waitForEvent();
RedBearLab 0:cffe8ac1bdf0 266 }
RedBearLab 0:cffe8ac1bdf0 267 }
RedBearLab 0:cffe8ac1bdf0 268
ke_ix1 5:29b82cc045b6 269