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
1aa04cf5
Commit
1aa04cf5
authored
4 years ago
by
schneider
Browse files
Options
Downloads
Patches
Plain Diff
feat(ble): Give pycardium a connection event if a connection is already open
parent
866d5133
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!461
BLE: Re-use open connection in pycardium
Pipeline
#5167
passed
4 years ago
Stage: build
Stage: test
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
epicardium/ble/epic_ble_api.c
+30
-1
30 additions, 1 deletion
epicardium/ble/epic_ble_api.c
with
30 additions
and
1 deletion
epicardium/ble/epic_ble_api.c
+
30
−
1
View file @
1aa04cf5
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
#include
"FreeRTOS.h"
#include
"FreeRTOS.h"
#include
"queue.h"
#include
"queue.h"
#include
"timers.h"
#include
<stdint.h>
#include
<stdint.h>
#include
<string.h>
#include
<string.h>
...
@@ -24,8 +25,11 @@ static StaticQueue_t ble_event_queue_data;
...
@@ -24,8 +25,11 @@ static StaticQueue_t ble_event_queue_data;
static
uint8_t
adv_data_buf
[
HCI_ADV_DATA_LEN
];
static
uint8_t
adv_data_buf
[
HCI_ADV_DATA_LEN
];
static
uint8_t
sr_data_buf
[
HCI_ADV_DATA_LEN
];
static
uint8_t
sr_data_buf
[
HCI_ADV_DATA_LEN
];
static
dmEvt_t
connection_open_event
;
static
TimerHandle_t
dm_timer
;
static
StaticTimer_t
dm_timer_data
;
static
dmEvt_t
connection_open_event
;
static
bool
connection_open
;
static
bool
connection_open
;
int
epic_ble_free_event
(
struct
epic_ble_event
*
e
)
int
epic_ble_free_event
(
struct
epic_ble_event
*
e
)
...
@@ -147,14 +151,39 @@ int epic_ble_is_connection_open(void)
...
@@ -147,14 +151,39 @@ int epic_ble_is_connection_open(void)
return
AppConnIsOpen
();
return
AppConnIsOpen
();
}
}
void
vDmTimerCallback
()
{
send_dm_event
(
&
connection_open_event
);
}
int
epic_ble_init
(
void
)
int
epic_ble_init
(
void
)
{
{
if
(
dm_timer
==
NULL
)
{
dm_timer
=
xTimerCreateStatic
(
"dmtimer"
,
1
,
pdFALSE
,
/* one-shot */
0
,
vDmTimerCallback
,
&
dm_timer_data
);
}
epic_interrupt_enable
(
EPIC_INT_BLE
);
epic_interrupt_enable
(
EPIC_INT_BLE
);
if
(
connection_open
)
{
// Give pycardium a bit of time and then let it
// know that there already is an open connection
int
millis
=
100
;
int
ticks
=
millis
*
(
configTICK_RATE_HZ
/
1000
);
xTimerChangePeriod
(
dm_timer
,
ticks
,
0
);
}
return
0
;
return
0
;
}
}
int
epic_ble_deinit
(
void
)
int
epic_ble_deinit
(
void
)
{
{
xTimerStop
(
dm_timer
,
0
);
epic_interrupt_disable
(
EPIC_INT_BLE
);
epic_interrupt_disable
(
EPIC_INT_BLE
);
return
0
;
return
0
;
}
}
...
...
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