Commit 0aa53ec5 authored by zet's avatar zet

clean

parent e0a457d3
......@@ -2,9 +2,5 @@
*.pyc
*.swp
.netrwhist
vim/bundle/YouCompleteMe/
vim/bundle/vim-airline-themes/
vim/bundle/vim-airline/
vim/bundle/ultisnips/
vim/bundle/vim-snippets/
mbed-os/
venv/
......@@ -4,7 +4,7 @@ hello:
mbed compile -m NRF52_DK -t GCC_ARM
flash:
@echo Flashing: BLE_LED.hex
nrfjprog --program BUILD/NRF52_DK/GCC_ARM/BLE_LED.hex -f nrf52 --sectorerase
nrfjprog --program BUILD/NRF52_DK/GCC_ARM/nRF52_BLE_LED.hex -f nrf52 --sectorerase
nrfjprog --reset -f nrf52
clean:
rm -rf BUILD
mbed-os @ 50b3418e
Subproject commit 50b3418e45484ebf442b88cd935a2d5355402d7d
{
"target_overrides": {
"K64F": {
"target.features_add": ["BLE"],
"target.extra_labels_add": ["ST_BLUENRG"],
"target.macros_add": ["IDB0XA1_D13_PATCH"]
},
"NUCLEO_F401RE": {
"target.features_add": ["BLE"],
"target.extra_labels_add": ["ST_BLUENRG"]
}
}
}
"""
mbed SDK
Copyright (c) 2016 ARM Limited
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from os.path import join, abspath, dirname
#ROOT = abspath(join(dirname(__file__), "."))
##############################################################################
# Build System Settings
##############################################################################
#BUILD_DIR = abspath(join(ROOT, "build"))
# ARM
#ARM_PATH = "C:/Program Files/ARM"
# GCC ARM
#GCC_ARM_PATH = ""
# GCC CodeRed
#GCC_CR_PATH = "C:/code_red/RedSuite_4.2.0_349/redsuite/Tools/bin"
# IAR
#IAR_PATH = "C:/Program Files (x86)/IAR Systems/Embedded Workbench 7.0/arm"
# Goanna static analyser. Please overload it in private_settings.py
#GOANNA_PATH = "c:/Program Files (x86)/RedLizards/Goanna Central 3.2.3/bin"
#BUILD_OPTIONS = []
# mbed.org username
#MBED_ORG_USER = ""
TARGET_ST_BLUENRG @ 6670a449
Subproject commit 6670a4495aafe1601a105ec9f6606f70b4c3424c
https://github.com/ARMmbed/ble-x-nucleo-idb0xa1/#6670a4495aafe1601a105ec9f6606f70b4c3424c
......@@ -25,7 +25,7 @@ public:
LEDService(BLEDevice &_ble, bool initialValueForLEDCharacteristic) :
ble(_ble), ledState(LED_STATE_CHARACTERISTIC_UUID, &initialValueForLEDCharacteristic)
{
ledState.requireSecurity(SecurityManager::SECURITY_MODE_ENCRYPTION_WITH_MITM);
//ledState.requireSecurity(SecurityManager::SECURITY_MODE_ENCRYPTION_WITH_MITM);
GattCharacteristic *charTable[] = {&ledState};
GattService ledService(LED_SERVICE_UUID, charTable, sizeof(charTable) / sizeof(GattCharacteristic *));
ble.addService(ledService);
......
......@@ -20,7 +20,7 @@
#include "LEDService.h"
//debug output
Serial pc(USBTX, USBRX); // tx, rx
//Serial pc(USBTX, USBRX); // tx, rx
//設定輸出 LED1 and LED2
DigitalOut alivenessLED(LED1, 0);
......@@ -39,12 +39,12 @@ LEDService *ledServicePtr;
void connectionCallback(const Gap::ConnectionCallbackParams_t *params)
{
pc.printf("\rConnected!\r\n");
//printf("Connected!\r\n");
}
void disconnectionCallback(const Gap::DisconnectionCallbackParams_t *params)
{
pc.printf("Disconnected!\r\n");
//printf("Disconnected!\r\n");
(void) params;
BLE::Instance().gap().startAdvertising();
}
......@@ -56,19 +56,19 @@ void blinkCallback(void)
void passkeyDisplayCallback(Gap::Handle_t handle, const SecurityManager::Passkey_t passkey)
{
pc.printf("[*] Input passKey: ");
printf("[*] Input passKey: ");
for (unsigned i = 0; i < Gap::ADDR_LEN; i++) {
pc.printf("%c ", passkey[i]);
printf("%c ", passkey[i]);
}
pc.printf("\r\n");
printf("\r\n");
}
void securitySetupCompletedCallback(Gap::Handle_t handle, SecurityManager::SecurityCompletionStatus_t status)
{
if (status == SecurityManager::SEC_STATUS_SUCCESS) {
pc.printf("[+] Security success\r\n");
//printf("[+] Security success\r\n");
} else {
pc.printf("[!] Security failed\r\n");
//printf("[!] Security failed\r\n");
}
}
......@@ -82,7 +82,7 @@ void securitySetupCompletedCallback(Gap::Handle_t handle, SecurityManager::Secur
void onDataWrittenCallback(const GattWriteCallbackParams *params) {
if ((params->handle == ledServicePtr->getValueHandle()) && (params->len == 1)) {
actuatedLED = *(params->data);
pc.printf("read data: %d\r\n",*(params->data));
//printf("read data: %d\r\n",*(params->data));
}
}
......@@ -114,15 +114,15 @@ void bleInitComplete(BLE::InitializationCompleteCallbackContext *params)
}
/* Initialize BLE security */
bool enableBonding = true;
bool requireMITM = true;
ble.securityManager().init(enableBonding, requireMITM, SecurityManager::IO_CAPS_DISPLAY_ONLY);
//bool enableBonding = true;
//bool requireMITM = true;
//ble.securityManager().init(enableBonding, requireMITM, SecurityManager::IO_CAPS_DISPLAY_ONLY);
/* Set callback functions */
ble.gap().onConnection(connectionCallback);
ble.gap().onDisconnection(disconnectionCallback);
ble.securityManager().onPasskeyDisplay(passkeyDisplayCallback);
ble.securityManager().onSecuritySetupCompleted(securitySetupCompletedCallback);
//ble.securityManager().onPasskeyDisplay(passkeyDisplayCallback);
//ble.securityManager().onSecuritySetupCompleted(securitySetupCompletedCallback);
ble.gattServer().onDataWritten(onDataWrittenCallback);
bool initialValueForLEDCharacteristic = false;
......@@ -149,7 +149,7 @@ int main()
BLE &ble = BLE::Instance();
ble.onEventsToProcess(scheduleBleEventsProcessing);
ble.init(bleInitComplete);
pc.printf("[*] system start ..... \r\n");
//printf("[*] system start ..... \r\n");
eventQueue.dispatch_forever();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment