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
50f19d1d
Commit
50f19d1d
authored
6 years ago
by
Alexandre Abadie
Browse files
Options
Downloads
Patches
Plain Diff
drivers/periph_eeprom: add clear and erase functions
parent
90db0bf2
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
drivers/include/periph/eeprom.h
+19
-0
19 additions, 0 deletions
drivers/include/periph/eeprom.h
drivers/periph_common/eeprom.c
+15
-0
15 additions, 0 deletions
drivers/periph_common/eeprom.c
with
34 additions
and
0 deletions
drivers/include/periph/eeprom.h
+
19
−
0
View file @
50f19d1d
...
...
@@ -79,6 +79,25 @@ void eeprom_write_byte(uint32_t pos, uint8_t data);
*/
size_t
eeprom_write
(
uint32_t
pos
,
const
uint8_t
*
data
,
size_t
len
);
/**
* @brief Clear @p len bytes from the given position @p pos
*
* Clearing a byte in EEPROM simply consists in setting it to 0
*
* @param[in] pos start position in eeprom
* @param[in] len the number of bytes to clear
*
* @return the number of bytes cleared
*/
size_t
eeprom_clear
(
uint32_t
pos
,
size_t
len
);
/**
* @brief Erase the whole EEPROM content
*
* @return the EEPROM_SIZE
*/
size_t
eeprom_erase
(
void
);
#ifdef __cplusplus
}
#endif
...
...
This diff is collapsed.
Click to expand it.
drivers/periph_common/eeprom.c
+
15
−
0
View file @
50f19d1d
...
...
@@ -40,4 +40,19 @@ void eeprom_write_byte(uint32_t pos, uint8_t byte)
eeprom_write
(
pos
,
&
byte
,
1
);
}
size_t
eeprom_clear
(
uint32_t
pos
,
size_t
len
)
{
assert
(
pos
+
len
<=
EEPROM_SIZE
);
for
(
size_t
i
=
0
;
i
<
len
;
i
++
)
{
eeprom_write_byte
(
pos
++
,
0
);
}
return
len
;
}
size_t
eeprom_erase
(
void
)
{
return
eeprom_clear
(
0
,
EEPROM_SIZE
);
}
#endif
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