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
ngt7
F23-BLE
Commits
a7d77d37
Commit
a7d77d37
authored
1 year ago
by
Nick Tsintolas
Browse files
Options
Downloads
Patches
Plain Diff
cleaned things up
parent
c33bc739
Branches
main
No related tags found
No related merge requests found
Pipeline
#459814
passed
1 year ago
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main.c
+8
-9
8 additions, 9 deletions
src/main.c
with
8 additions
and
9 deletions
src/main.c
+
8
−
9
View file @
a7d77d37
...
...
@@ -63,13 +63,9 @@ static struct gpio_callback gather_button_data;
static
struct
gpio_callback
ble_button_data
;
//INTS + FLOATS
float
sin_100hz_conversion
=
1
.
0
/
45
.
0
;
//%/mV
float
sin_500hz_conversion
=
1
.
0
/
140
.
0
;
// %/mV
float
battery_lvl
;
float
led1_brightness
;
float
led2_brightness
;
int64_t
work_queue_time
;
int64_t
work_done
;
bool
usbregstatus
;
static
int32_t
atm_pressure_kPa
;
float
data_collector
[
3
];
// { LED 1 Brightness, LED 2 Brightness, Pressure (Pa) }
...
...
@@ -266,7 +262,7 @@ void sin100hzStopperWork(){
if
(
data_collector
[
0
]
<
0
){
data_collector
[
0
]
=
0
;
}
LOG_INF
(
"
Voltage
1 VALUE: %f"
,
data_collector
[
0
]);
//brightness percent for LED1
LOG_INF
(
"
Brightness for LED
1 VALUE: %f"
,
data_collector
[
0
]);
//brightness percent for LED1
k_event_post
(
&
s_obj
.
collectDone
,
FREQEVENT1
);
//notifies this sampling is done
}
...
...
@@ -310,7 +306,7 @@ void sin500hzStopperWork(){
if
(
data_collector
[
1
]
<
0
){
data_collector
[
1
]
=
0
;
}
LOG_INF
(
"
Voltage
2 VALUE: %f"
,
data_collector
[
1
]);
//brightness % for LED2
LOG_INF
(
"
Brightness for LED
2 VALUE: %f"
,
data_collector
[
1
]);
//brightness % for LED2
k_event_post
(
&
s_obj
.
collectDone
,
FREQEVENT2
);
//notifies this sampling is done
}
...
...
@@ -483,6 +479,7 @@ static void idle_exit(void *o){
//GATHER STATE
static
void
gather_info_entry
(
void
*
o
){
LOG_INF
(
"Gather Entry"
);
//start sampling timers unitl all samples collected
k_timer_start
(
&
sin100hzTimer
,
K_NO_WAIT
,
K_USEC
(
1000000
/
FREQ1
/
SAMPLINGMULTIPLIER
));
//1000 samples/sec, 1 sample every 1000us
k_timer_start
(
&
sin500hzTimer
,
K_NO_WAIT
,
K_USEC
(
1000000
/
FREQ2
/
SAMPLINGMULTIPLIER
));
//5000 samples/sec, 1 sample every 200us
...
...
@@ -505,6 +502,7 @@ static void gather_info_run(void *o){
//ERROR STATE
static
void
error_entry
(
void
*
o
){
LOG_INF
(
"Error Entry"
);
gpio_pin_set_dt
(
&
error_led
,
1
);
}
...
...
@@ -514,9 +512,9 @@ static void ble_notification_entry(void *o){
ble_data
[
0
]
=
data_collector
[
0
];
ble_data
[
1
]
=
data_collector
[
1
];
ble_data
[
2
]
=
data_collector
[
2
];
LOG_INF
(
"READY TO SEND: LED1 Brightness: %d"
,
ble_data
[
0
]);
LOG_INF
(
"READY TO SEND: LED2 Brightness: %d"
,
ble_data
[
1
]);
LOG_INF
(
"READY TO SEND: Pressure: %d"
,
ble_data
[
2
]);
//
LOG_INF("READY TO SEND: LED1 Brightness: %d", ble_data[0]);
//
LOG_INF("READY TO SEND: LED2 Brightness: %d", ble_data[1]);
//
LOG_INF("READY TO SEND: Pressure: %d", ble_data[2]);
//battery GATT
err
=
bt_bas_set_battery_level
((
int
)
battery_lvl
);
...
...
@@ -539,6 +537,7 @@ static void ble_notification_entry(void *o){
//VBUS STATE
static
void
vbus_entry
(
void
*
o
){
LOG_INF
(
"VBUS Detected"
);
k_timer_start
(
&
error_timer
,
K_MSEC
(
ERROR_CYCLE_TIME_MS
),
K_MSEC
(
ERROR_CYCLE_TIME_MS
));
}
...
...
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