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

Implement eeprom writing in eepromCmdFnc #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Firmware/OpenSteamController/src/eeprom_access.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,9 @@ int eepromCmdFnc(int argc, const char* argv[]) {
uint32_t num_words = strtol(argv[4], NULL, 0);
retval = eepromReadToConsole(word_size, addr, num_words);
} else if (!strcmp("write", argv[1])) {
//TODO: imeplement this
printf("eeprom writing not implemented yet\n");
printf("experimental eeprom write\n");
uint32_t arr[1] = { strtol(argv[4], NULL, 16) };
Copy link
Owner

Choose a reason for hiding this comment

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

Use better variable name than "arr."

Also variable does not need to be array since it is only 1 32-bit word. You can pass reference to it when calling eepromWrite.

eepromWrite(addr, arr, 1);
Copy link
Owner

Choose a reason for hiding this comment

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

Since writing to EEPROM could brick a user's controller I'd like to see another user prompt before writing the value (e.g. "You are about to write value 0x%08x to address 0x%08x in EEPROM. This could brick your controller. Are you sure you want to do this [Y/n]?")

return -1;
} else {
printf("Invalid argument \"%s\"\n", argv[1]);
Expand Down