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
99998e7d
Commit
99998e7d
authored
4 years ago
by
schneider
Browse files
Options
Downloads
Patches
Plain Diff
change(ble): Go back to standard adv set when resetting hardware
parent
b7f11c05
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!449
BLE advertisement support for MicroPython
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
epicardium/ble/ble_adv.c
+18
-10
18 additions, 10 deletions
epicardium/ble/ble_adv.c
epicardium/modules/hardware.c
+6
-0
6 additions, 0 deletions
epicardium/modules/hardware.c
with
24 additions
and
10 deletions
epicardium/ble/ble_adv.c
+
18
−
10
View file @
99998e7d
...
...
@@ -137,11 +137,6 @@ void ble_adv_proc_msg(bleMsg_t *pMsg)
}
void
ble_adv_init
(
void
)
{
pAppAdvCfg
=
(
appAdvCfg_t
*
)
&
bleAdvCfg
;
}
void
ble_adv_setup
(
void
)
{
char
buf
[
32
];
char
a
,
b
,
c
,
d
,
e
,
f
,
K
;
...
...
@@ -163,6 +158,11 @@ void ble_adv_setup(void)
}
/* clang-format on */
pAppAdvCfg
=
(
appAdvCfg_t
*
)
&
bleAdvCfg
;
}
void
ble_adv_setup
(
void
)
{
/* set advertising and scan response data for discoverable mode */
if
(
config_get_boolean_with_default
(
"ble_hid_enable"
,
false
))
{
AppAdvSetData
(
...
...
@@ -202,7 +202,7 @@ void ble_adv_stop(void)
}
}
void
ble_
adv_start
(
uint8_t
mode
)
static
void
adv_start
(
uint8_t
mode
)
{
if
(
advertising_mode
!=
APP_MODE_NONE
)
{
/* We need to stop advertising in between or the
...
...
@@ -219,21 +219,29 @@ void ble_adv_start(uint8_t mode)
advertising_mode_target
=
mode
;
AppAdvStart
(
advertising_mode
);
}
tainted
=
false
;
}
void
ble_adv_start
(
uint8_t
mode
)
{
adv_start
(
mode
);
tainted
=
true
;
}
void
ble_adv_discoverable
(
bool
discoverable
)
{
if
(
discoverable
)
{
if
(
advertising_mode
!=
APP_MODE_DISCOVERABLE
)
{
if
(
advertising_mode
!=
APP_MODE_DISCOVERABLE
||
tainted
)
{
LOG_INFO
(
"ble"
,
"Making bondable and discoverable"
);
ble_
adv_start
(
APP_MODE_DISCOVERABLE
);
adv_start
(
APP_MODE_DISCOVERABLE
);
}
}
else
{
/* TODO: This does way more than the function name indicates */
if
(
AppDbCheckBonded
())
{
if
(
advertising_mode
!=
APP_MODE_CONNECTABLE
)
{
if
(
advertising_mode
!=
APP_MODE_CONNECTABLE
||
tainted
)
{
LOG_INFO
(
"ble"
,
"Bonded. Making connectable"
);
ble_
adv_start
(
APP_MODE_CONNECTABLE
);
adv_start
(
APP_MODE_CONNECTABLE
);
}
}
else
{
LOG_INFO
(
"ble"
,
"Not bonded. Stop advertising"
);
...
...
This diff is collapsed.
Click to expand it.
epicardium/modules/hardware.c
+
6
−
0
View file @
99998e7d
...
...
@@ -14,6 +14,7 @@
#include
"pmic.h"
#include
"portexpander.h"
#include
"max86150.h"
#include
"ble/ble_api.h"
#include
"gpio.h"
#include
"i2c.h"
...
...
@@ -288,6 +289,11 @@ int hardware_reset(void)
/*
* BLE
*/
/* Reset advertisement data */
ble_adv_setup
();
/* Start advertising again if needed */
epic_ble_set_mode
(
false
,
false
);
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