Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add EEPROM library #126

Draft
wants to merge 3 commits into
base: next
Choose a base branch
from
Draft

Conversation

purviyeshi
Copy link

This PR resolves issue #88

Description:
Implement EEPROM library to ensure compatibility with standard AVR Arduino where actual EEPROM is not present, utilizing non-volatile storage (NVS) as a substitute.

Changes Made:

  • Created a new libraries/EEPROM library for handling EEPROM-like operations using NVS.
  • Added a sample program samples/eeprom_operations to demonstrate the usage of the EEPROM library.
  • Implemented the following functions in the EEPROM library:
    - Initialization Function: Sets up the NVS storage for data persistence.
    - Write Function: Allows writing data into NVS memory.
    - Read Function: Retrieves data from NVS memory.

Testing:
Used the beagleconnect_freedom board to test the implementation.
Followed the testing process as outlined here.

Output:
Encountered the following error during testing: unable to get page info.
image

Please review the code and suggest if any changes are required to improve the implementation or resolve the encountered issue.

@purviyeshi purviyeshi marked this pull request as draft January 28, 2025 07:41
Copy link
Collaborator

@DhruvaG2000 DhruvaG2000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing!
Few minor comments, since the PR is still marked as a draft.

samples/eeprom_operations/src/app.cpp Outdated Show resolved Hide resolved
samples/eeprom_operations/src/app.cpp Outdated Show resolved Hide resolved
samples/eeprom_operations/src/app.cpp Outdated Show resolved Hide resolved
samples/eeprom_operations/src/app.cpp Outdated Show resolved Hide resolved
libraries/EEPROM/EEPROM.h Outdated Show resolved Hide resolved
namespace arduino {

class ZephyrEEPROM {
public:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the indent correct? Doesn't public need some indentation?

Copy link
Author

@purviyeshi purviyeshi Jan 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both styles work the same in C++, but typically, access specifiers like public are aligned with the class definition. However, the content under access specifiers should have half-indentation for better consistency, I'll make changes. I also referred to the Wire library codebase.

Overview
********

A sample that reads data from flash memory, as well as writes data to flash memory.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some sort of sample output will be good to show.
Also a build command to show how to build this sample can make things much easier for any new users

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes sure, I'll add a sample output and include a build command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants