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
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
fpletz
firmware
Commits
af026115
Verified
Commit
af026115
authored
5 years ago
by
rahix
Browse files
Options
Downloads
Patches
Plain Diff
chore(ble): Move ble_shall_start() into ble module
Signed-off-by:
Rahix
<
rahix@rahix.de
>
parent
d4295ca4
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
epicardium/ble/ble.c
+32
-0
32 additions, 0 deletions
epicardium/ble/ble.c
epicardium/main.c
+1
-41
1 addition, 41 deletions
epicardium/main.c
epicardium/modules/modules.h
+2
-0
2 additions, 0 deletions
epicardium/modules/modules.h
with
35 additions
and
41 deletions
epicardium/ble/ble.c
+
32
−
0
View file @
af026115
#include
"epicardium.h"
#include
"modules/log.h"
#include
"fs_util.h"
...
...
@@ -172,6 +173,37 @@ void wsf_ble_signal_event(void)
notify
();
}
/*************************************************************************************************/
#define BLEMAXCFGBYTES 100
bool
ble_shall_start
(
void
)
{
int
bleConfigFile
=
epic_file_open
(
"ble.txt"
,
"r"
);
if
(
bleConfigFile
<
0
)
{
LOG_INFO
(
"ble"
,
"can not open ble.txt -> BLE is not started"
);
epic_file_close
(
bleConfigFile
);
return
false
;
}
char
cfgBuf
[
BLEMAXCFGBYTES
+
1
];
int
readNum
=
epic_file_read
(
bleConfigFile
,
cfgBuf
,
BLEMAXCFGBYTES
);
epic_file_close
(
bleConfigFile
);
if
(
readNum
<
0
)
{
LOG_WARN
(
"ble"
,
"can not read ble.txt -> BLE is not started"
);
return
false
;
}
cfgBuf
[
readNum
]
=
'\0'
;
char
bleActiveStr
[]
=
"active=true"
;
cfgBuf
[
sizeof
(
bleActiveStr
)
-
1
]
=
'\0'
;
if
(
strcmp
(
cfgBuf
,
"active=true"
)
!=
0
)
{
LOG_INFO
(
"ble"
,
"BLE is disabled."
);
return
false
;
}
else
{
LOG_INFO
(
"ble"
,
"BLE is enabled."
);
return
true
;
}
}
/*************************************************************************************************/
static
void
scheduleTimer
(
void
)
{
bool_t
timerRunning
;
...
...
This diff is collapsed.
Click to expand it.
epicardium/main.c
+
1
−
41
View file @
af026115
...
...
@@ -9,46 +9,6 @@
#include
<stdlib.h>
#include
<string.h>
#define BLEMAXCFGBYTES 100
int
bleShallStart
(
void
)
{
int
bleConfigFile
=
epic_file_open
(
"ble.txt"
,
"r"
);
if
(
bleConfigFile
<
0
)
{
LOG_INFO
(
"startup"
,
"can not open ble.txt -> BLE is not started"
);
epic_file_close
(
bleConfigFile
);
return
0
;
}
char
cfgBuf
[
BLEMAXCFGBYTES
+
1
];
int
readNum
=
epic_file_read
(
bleConfigFile
,
cfgBuf
,
BLEMAXCFGBYTES
);
epic_file_close
(
bleConfigFile
);
if
(
readNum
<
0
)
{
LOG_INFO
(
"startup"
,
"can not read ble.txt -> BLE is not started"
);
return
0
;
}
cfgBuf
[
readNum
]
=
'\0'
;
char
bleActiveStr
[]
=
"active=true"
;
cfgBuf
[
sizeof
(
bleActiveStr
)
-
1
]
=
'\0'
;
if
(
strcmp
(
cfgBuf
,
"active=true"
)
!=
0
)
{
LOG_INFO
(
"startup"
,
"ble.txt is not
\"
active=true
\"
-> BLE is not started"
);
return
0
;
}
LOG_INFO
(
"startup"
,
"ble.txt is
\"
active=true
\"
-> BLE is starting"
);
return
1
;
}
int
main
(
void
)
{
LOG_INFO
(
"startup"
,
"Epicardium startup ..."
);
...
...
@@ -100,7 +60,7 @@ int main(void)
}
/* BLE */
if
(
ble
S
hall
S
tart
())
{
if
(
ble
_s
hall
_s
tart
())
{
if
(
xTaskCreate
(
vBleTask
,
(
const
char
*
)
"BLE"
,
...
...
This diff is collapsed.
Click to expand it.
epicardium/modules/modules.h
+
2
−
0
View file @
af026115
...
...
@@ -5,6 +5,7 @@
#include
"semphr.h"
#include
<stdint.h>
#include
<stdbool.h>
/* ---------- Dispatcher --------------------------------------------------- */
void
vApiDispatcher
(
void
*
pvParameters
);
...
...
@@ -33,6 +34,7 @@ void vPmicTask(void *pvParameters);
/* ---------- BLE ---------------------------------------------------------- */
void
vBleTask
(
void
*
pvParameters
);
bool
ble_shall_start
(
void
);
void
ble_uart_write
(
uint8_t
*
pValue
,
uint8_t
len
);
/* ---------- Display ------------------------------------------------------ */
...
...
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