Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RIOT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cm-projects
RIOT
Commits
c95c1e4d
Commit
c95c1e4d
authored
6 years ago
by
Alexandre Abadie
Browse files
Options
Downloads
Patches
Plain Diff
tests/periph_eeprom: add clear and erase commands
parent
50f19d1d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/periph_eeprom/main.c
+42
-0
42 additions, 0 deletions
tests/periph_eeprom/main.c
with
42 additions
and
0 deletions
tests/periph_eeprom/main.c
+
42
−
0
View file @
c95c1e4d
...
@@ -139,6 +139,46 @@ static int cmd_write_byte(int argc, char **argv)
...
@@ -139,6 +139,46 @@ static int cmd_write_byte(int argc, char **argv)
return
0
;
return
0
;
}
}
static
int
cmd_clear
(
int
argc
,
char
**
argv
)
{
if
(
argc
<
3
)
{
printf
(
"usage: %s <pos> <count>
\n
"
,
argv
[
0
]);
return
1
;
}
uint32_t
pos
=
atoi
(
argv
[
1
]);
uint32_t
count
=
atoi
(
argv
[
2
]);
if
(
pos
+
count
>
EEPROM_SIZE
)
{
puts
(
"Failed: cannot clear out of eeprom bounds"
);
return
1
;
}
size_t
ret
=
eeprom_clear
(
pos
,
count
);
printf
(
"%d bytes cleared in EEPROM
\n
"
,
(
int
)
ret
);
return
0
;
}
static
int
cmd_erase
(
int
argc
,
char
**
argv
)
{
if
(
argc
!=
1
)
{
printf
(
"usage: %s
\n
"
,
argv
[
0
]);
return
1
;
}
size_t
ret
=
eeprom_erase
();
if
(
ret
==
EEPROM_SIZE
)
{
puts
(
"EEPROM erased with success"
);
}
else
{
puts
(
"EEPROM erase failed"
);
return
1
;
}
return
0
;
}
static
int
cmd_test
(
int
argc
,
char
**
argv
)
static
int
cmd_test
(
int
argc
,
char
**
argv
)
{
{
(
void
)
argv
;
(
void
)
argv
;
...
@@ -187,6 +227,8 @@ static const shell_command_t shell_commands[] = {
...
@@ -187,6 +227,8 @@ static const shell_command_t shell_commands[] = {
{
"write"
,
"Write bytes to eeprom"
,
cmd_write
},
{
"write"
,
"Write bytes to eeprom"
,
cmd_write
},
{
"read_byte"
,
"Read a single byte from eeprom"
,
cmd_read_byte
},
{
"read_byte"
,
"Read a single byte from eeprom"
,
cmd_read_byte
},
{
"write_byte"
,
"Write a single byte to eeprom"
,
cmd_write_byte
},
{
"write_byte"
,
"Write a single byte to eeprom"
,
cmd_write_byte
},
{
"clear"
,
"Clear bytes to eeprom"
,
cmd_clear
},
{
"erase"
,
"Erase whole eeprom"
,
cmd_erase
},
{
"test"
,
"Test the EEPROM implementation"
,
cmd_test
},
{
"test"
,
"Test the EEPROM implementation"
,
cmd_test
},
{
NULL
,
NULL
,
NULL
}
{
NULL
,
NULL
,
NULL
}
};
};
...
...
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