Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nRF52_BLE_LED
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zet
nRF52_BLE_LED
Commits
0aa53ec5
Commit
0aa53ec5
authored
Apr 24, 2017
by
zet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean
parent
e0a457d3
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
18 additions
and
83 deletions
+18
-83
.gitignore
.gitignore
+1
-5
Makefile
Makefile
+1
-1
mbed-os
mbed-os
+0
-1
mbed_app.json
mbed_app.json
+0
-13
mbed_settings.py
mbed_settings.py
+0
-45
shields/TARGET_ST_BLUENRG
shields/TARGET_ST_BLUENRG
+0
-1
shields/TARGET_ST_BLUENRG.lib
shields/TARGET_ST_BLUENRG.lib
+0
-1
source/LEDService.h
source/LEDService.h
+1
-1
source/main.cpp
source/main.cpp
+15
-15
No files found.
.gitignore
View file @
0aa53ec5
...
...
@@ -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/
Makefile
View file @
0aa53ec5
...
...
@@ -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
mbed_app.json
deleted
100644 → 0
View file @
e0a457d3
{
"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_settings.py
deleted
100644 → 0
View file @
e0a457d3
"""
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
shields/TARGET_ST_BLUENRG.lib
deleted
100644 → 0
View file @
e0a457d3
https://github.com/ARMmbed/ble-x-nucleo-idb0xa1/#6670a4495aafe1601a105ec9f6606f70b4c3424c
source/LEDService.h
View file @
0aa53ec5
...
...
@@ -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
);
...
...
source/main.cpp
View file @
0aa53ec5
...
...
@@ -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
(
"
\r
Connected!
\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
)
{
p
c
.
p
rintf
(
"[*] Input passKey: "
);
printf
(
"[*] Input passKey: "
);
for
(
unsigned
i
=
0
;
i
<
Gap
::
ADDR_LEN
;
i
++
)
{
p
c
.
p
rintf
(
"%c "
,
passkey
[
i
]);
printf
(
"%c "
,
passkey
[
i
]);
}
p
c
.
p
rintf
(
"
\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
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment