Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
micropython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
micropython
Commits
ab31e23f
Commit
ab31e23f
authored
Apr 12, 2023
by
Jim Mussared
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests/multi_bluetooth: Use multitest.broadcast instead of sleep.
Signed-off-by:
Jim Mussared
<
jim.mussared@gmail.com
>
parent
201f5df9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
+9
-3
tests/multi_bluetooth/ble_characteristic.py
tests/multi_bluetooth/ble_characteristic.py
+6
-2
tests/multi_bluetooth/ble_gap_device_name.py
tests/multi_bluetooth/ble_gap_device_name.py
+3
-1
No files found.
tests/multi_bluetooth/ble_characteristic.py
View file @
ab31e23f
...
...
@@ -90,10 +90,12 @@ def wait_for_event(event, timeout_ms):
def
instance0
():
multitest
.
globals
(
BDADDR
=
ble
.
config
(
"mac"
))
((
char_handle
,),)
=
ble
.
gatts_register_services
(
SERVICES
)
print
(
"gap_advertise"
)
ble
.
gap_advertise
(
20_000
,
b"
\x02\x01\x06\x04\xff
MPY"
)
multitest
.
next
()
try
:
print
(
"gap_advertise"
)
ble
.
gap_advertise
(
20_000
,
b"
\x02\x01\x06\x04\xff
MPY"
)
multitest
.
broadcast
(
"peripheral:adv"
)
# Write initial characteristic value.
ble
.
gatts_write
(
char_handle
,
"periph0"
)
...
...
@@ -146,6 +148,8 @@ def instance0():
def
instance1
():
multitest
.
next
()
try
:
multitest
.
wait
(
"peripheral:adv"
)
# Connect to peripheral and then disconnect.
print
(
"gap_connect"
)
ble
.
gap_connect
(
*
BDADDR
)
...
...
tests/multi_bluetooth/ble_gap_device_name.py
View file @
ab31e23f
...
...
@@ -75,6 +75,8 @@ def instance0():
print
(
ble
.
config
(
"gap_name"
))
ble
.
gap_advertise
(
20_000
)
multitest
.
broadcast
(
"peripheral:adv:{}"
.
format
(
iteration
))
# Wait for central to connect, then wait for it to disconnect.
wait_for_event
(
_IRQ_CENTRAL_CONNECT
,
TIMEOUT_MS
)
wait_for_event
(
_IRQ_CENTRAL_DISCONNECT
,
4
*
TIMEOUT_MS
)
...
...
@@ -89,7 +91,7 @@ def instance1():
value_handle
=
None
for
iteration
in
range
(
2
):
# Wait for peripheral to start advertising.
time
.
sleep_ms
(
500
)
multitest
.
wait
(
"peripheral:adv:{}"
.
format
(
iteration
)
)
# Connect to peripheral.
print
(
"gap_connect"
)
...
...
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