Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
card10
firmware
Commits
765a0fc4
Commit
765a0fc4
authored
4 years ago
by
schneider
Browse files
Options
Downloads
Patches
Plain Diff
change(ble): Better ble uart performance
parent
ee5e69a4
Branches
Branches containing commit
No related tags found
1 merge request
!446
Initial MicroPython BLE support (GATTS)
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
epicardium/ble/uart.c
+15
-10
15 additions, 10 deletions
epicardium/ble/uart.c
with
15 additions
and
10 deletions
epicardium/ble/uart.c
+
15
−
10
View file @
765a0fc4
...
...
@@ -125,11 +125,10 @@ static uint8_t UARTWriteCback(
return
ATT_SUCCESS
;
}
static
int
ble_uart_lasttick
=
0
;
static
bool
done
;
static
bool
again
;
void
ble_uart_flush
(
void
)
static
void
ble_uart_flush
(
void
)
{
if
(
ble_uart_buf_tx_fill
==
0
)
{
return
;
...
...
@@ -138,12 +137,11 @@ void ble_uart_flush(void)
dmConnId_t
connId
=
AppConnIsOpen
();
if
(
connId
!=
DM_CONN_ID_NONE
)
{
if
(
AttsCccEnabled
(
connId
,
UART_TX_CH_CCC_IDX
))
{
done
=
false
;
again
=
true
;
done
=
false
;
again
=
true
;
int
t0
=
xTaskGetTickCount
();
// TODO: Modify for no initial delay
while
(
!
done
&&
((
xTaskGetTickCount
()
-
ble_uart_lasttick
)
<
1000
))
{
while
(
!
done
&&
((
xTaskGetTickCount
()
-
t0
)
<
1000
))
{
if
(
again
)
{
again
=
false
;
AttsHandleValueNtf
(
...
...
@@ -153,15 +151,22 @@ void ble_uart_flush(void)
ble_uart_tx_buf
);
}
vTaskDelay
(
5
);
/* This function is supposed to only be called
* from the API scheduler with lowest priority.
*
* If that is not the case anymore, use a delay
* instead of the yield. Ideally refactor to avoid
* the delay.
*/
//vTaskDelay(5);
taskYIELD
();
}
ble_uart_lasttick
=
xTaskGetTickCount
();
}
}
ble_uart_buf_tx_fill
=
0
;
}
void
ble_uart_write_char
(
uint8_t
c
)
static
void
ble_uart_write_char
(
uint8_t
c
)
{
ble_uart_tx_buf
[
ble_uart_buf_tx_fill
]
=
c
;
ble_uart_buf_tx_fill
++
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment