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
8caaeeee
Commit
8caaeeee
authored
3 years ago
by
rahix
Browse files
Options
Downloads
Patches
Plain Diff
feat(filesystem): Add API call to check whether FS is attached
parent
7376a31c
No related branches found
No related tags found
1 merge request
!470
Add epic_fs_is_attached(), os.fs_is_attached(), and make the menu automatically return from USB mode
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
epicardium/epicardium.h
+10
-0
10 additions, 0 deletions
epicardium/epicardium.h
epicardium/modules/fileops.c
+11
-0
11 additions, 0 deletions
epicardium/modules/fileops.c
with
21 additions
and
0 deletions
epicardium/epicardium.h
+
10
−
0
View file @
8caaeeee
...
...
@@ -78,6 +78,7 @@ typedef _Bool bool;
#define API_FILE_UNLINK 0x4b
#define API_FILE_RENAME 0x4c
#define API_FILE_MKDIR 0x4d
#define API_FILE_FS_ATTACHED 0x4e
#define API_RTC_GET_SECONDS 0x50
#define API_RTC_SCHEDULE_ALARM 0x51
...
...
@@ -2064,6 +2065,15 @@ API(API_FILE_RENAME, int epic_file_rename(const char *oldp, const char* newp));
*/
API
(
API_FILE_MKDIR
,
int
epic_file_mkdir
(
const
char
*
dirname
));
/**
* Check whether the filesystem is currently attached and a call like
* :c:func:`epic_file_open` has a chance to succeed.
*
* :return: ``true`` if the filesystem is attached and ``false`` if the
* filesystem is not attached.
*/
API
(
API_FILE_FS_ATTACHED
,
bool
epic_fs_is_attached
(
void
));
/**
* RTC
* ===
...
...
This diff is collapsed.
Click to expand it.
epicardium/modules/fileops.c
+
11
−
0
View file @
8caaeeee
...
...
@@ -29,6 +29,17 @@ int epic_file_open(const char *filename, const char *mode)
return
res
;
}
bool
epic_fs_is_attached
(
void
)
{
EpicFileSystem
*
fs
;
if
(
efs_lock_global
(
&
fs
)
==
0
)
{
efs_unlock_global
(
fs
);
return
true
;
}
else
{
return
false
;
}
}
int
epic_file_close
(
int
fd
)
{
EpicFileSystem
*
fs
;
...
...
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