Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
D4-Embedded
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
D4-Furlough
D4-Embedded
Commits
430b4088
Commit
430b4088
authored
4 years ago
by
Denis Bobrovskiy
Browse files
Options
Downloads
Patches
Plain Diff
Modified code to add walking game over characteristic
parent
d1b0a443
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
wristwatch-test.cpp
+13
-5
13 additions, 5 deletions
wristwatch-test.cpp
with
13 additions
and
5 deletions
wristwatch-test.cpp
+
13
−
5
View file @
430b4088
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
#define GPS_CHAR_UUID "3d4512a1-e027-473d-b880-f58e75ad8a9e"
#define GPS_CHAR_UUID "3d4512a1-e027-473d-b880-f58e75ad8a9e"
#define STEP_COUNTER_CHAR_UUID "5609995a-8003-4f11-bd73-8ae0eee8d004"
#define STEP_COUNTER_CHAR_UUID "5609995a-8003-4f11-bd73-8ae0eee8d004"
#define HEART_RATE_CHAR_UUID "50787168-dec5-437c-a6ab-e52fa492c85c"
#define HEART_RATE_CHAR_UUID "50787168-dec5-437c-a6ab-e52fa492c85c"
#define WALKING_GAME_OVER_CHAR_UUID "3c79b9e0-c841-42a5-8641-a456e335460b"
#define GPS_DATA_UPLOAD_INTERVAL 3 //in seconds
#define GPS_DATA_UPLOAD_INTERVAL 3 //in seconds
...
@@ -19,9 +20,11 @@
...
@@ -19,9 +20,11 @@
BLECharacteristic
*
gpsChar
;
BLECharacteristic
*
gpsChar
;
BLECharacteristic
*
stepCounterChar
;
BLECharacteristic
*
stepCounterChar
;
BLECharacteristic
*
heartRateChar
;
BLECharacteristic
*
heartRateChar
;
BLECharacteristic
*
walkingGameOverChar
;
//For testing
//For testing
uint8_t
tempCounter1
=
0
;
uint8_t
tempCounter1
=
0
;
uint32_t
tempCounter2
=
0
;
void
gpsThread
(
void
*
parameter
){
void
gpsThread
(
void
*
parameter
){
...
@@ -47,13 +50,11 @@ void gpsThread(void *parameter){
...
@@ -47,13 +50,11 @@ void gpsThread(void *parameter){
void
stepCounterThread
(
void
*
parameter
){
void
stepCounterThread
(
void
*
parameter
){
for
(;;){
for
(;;){
Serial
.
println
(
"Looping step counter thread"
);
Serial
.
println
(
"Looping step counter thread"
);
unsigned
char
tempToggle
=
0
;
//Toggle this value between 0 and 1 for every new step detected
//Toggle this value between 0 and 1 for every new step detected
tempToggle
=
tempToggle
?
0
:
1
;
stepCounterChar
->
setValue
(
tempCounter2
);
//Put in a uint32_t
stepCounterChar
->
setValue
(
&
tempToggle
,
1
);
stepCounterChar
->
notify
();
stepCounterChar
->
notify
();
tempCounter2
++
;
delay
(
500
);
delay
(
500
);
}
}
}
}
...
@@ -105,11 +106,18 @@ void setup() {
...
@@ -105,11 +106,18 @@ void setup() {
BLECharacteristic
::
PROPERTY_NOTIFY
|
BLECharacteristic
::
PROPERTY_NOTIFY
|
BLECharacteristic
::
PROPERTY_INDICATE
BLECharacteristic
::
PROPERTY_INDICATE
);
);
walkingGameOverChar
=
mainService
->
createCharacteristic
(
WALKING_GAME_OVER_CHAR_UUID
,
BLECharacteristic
::
PROPERTY_READ
|
BLECharacteristic
::
PROPERTY_WRITE
|
BLECharacteristic
::
PROPERTY_NOTIFY
|
BLECharacteristic
::
PROPERTY_INDICATE
);
//Add descriptor to set up notifications
//Add descriptor to set up notifications
gpsChar
->
addDescriptor
(
new
BLE2902
());
gpsChar
->
addDescriptor
(
new
BLE2902
());
stepCounterChar
->
addDescriptor
(
new
BLE2902
());
stepCounterChar
->
addDescriptor
(
new
BLE2902
());
heartRateChar
->
addDescriptor
(
new
BLE2902
());
heartRateChar
->
addDescriptor
(
new
BLE2902
());
walkingGameOverChar
->
addDescriptor
(
new
BLE2902
());
//Set initial values (this doesnt really matter)
//Set initial values (this doesnt really matter)
gpsChar
->
setValue
(
"GPS initial data"
);
gpsChar
->
setValue
(
"GPS initial data"
);
...
...
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