Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
F23-BLE
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caroline.axelsen@duke.edu
F23-BLE
Commits
f9f6dbaf
Commit
f9f6dbaf
authored
1 year ago
by
Caroline Axelsen
Browse files
Options
Downloads
Patches
Plain Diff
answered last question of the analysis
parent
3173fd9f
Branches
main
No related tags found
No related merge requests found
Pipeline
#459890
passed
1 year ago
Stage: build
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.ipynb
+14
-9
14 additions, 9 deletions
.ipynb
.vscode/settings.json
+5
-0
5 additions, 0 deletions
.vscode/settings.json
src/main.c
+10
-3
10 additions, 3 deletions
src/main.c
with
29 additions
and
12 deletions
.ipynb
+
14
−
9
View file @
f9f6dbaf
Source diff could not be displayed: it is too large. Options to address this:
view the blob
.
This diff is collapsed.
Click to expand it.
.vscode/settings.json
0 → 100644
+
5
−
0
View file @
f9f6dbaf
{
"files.associations"
:
{
"bluetooth.h"
:
"c"
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/main.c
+
10
−
3
View file @
f9f6dbaf
...
...
@@ -62,7 +62,8 @@ int i = 0;
int
j
=
0
;
int
err
;
int
error_type
;
//if error_type is 1 its a VBUS error if its 2 is a pressure sensor error
int
battery_level
;
float
battery_percent
;
float
battery_level
;
int
normalized_battery_level
;
float
raw_data_array1
[
DATA_ARRAY
]
=
{};
float
max_data_array1
[
PERIOD_ARRAY
]
=
{};
...
...
@@ -312,9 +313,7 @@ int bluetooth_init(struct bt_conn_cb *bt_cb, struct bt_remote_srv_cb *remote_cb)
LOG_ERR
(
"Could not start advertising (ret = %d)"
,
ret
);
return
ret
;
}
return
ret
;
}
/* Setup Callbacks */
...
...
@@ -504,6 +503,14 @@ void button2_callback(const struct device *dev, struct gpio_callback*cb, uint32_
k_work_submit
(
&
button2_callback_work
);
}
void
button2_callback_work_handler
(
struct
k_work
*
button2_callback_work
){
battery_percent
=
((
100
*
val_mv
)
/
3600
);
LOG_INF
(
"Battery_percent: %f"
,
battery_percent
);
int
battery_err
=
bt_bas_set_battery_level
((
int
)
battery_level
);
if
(
battery_err
)
{
LOG_ERR
(
"BAS set error (err = %d)"
,
battery_err
);
}
battery_level
=
bt_bas_get_battery_level
();
err
=
send_data_notification
(
current_conn
,
bluetooth_outputs
,
3
);
if
(
err
)
{
...
...
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