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

Flash: Support writing single bytes to EEPROM #140

Merged
merged 2 commits into from
Jan 6, 2021
Merged

Conversation

dbrgn
Copy link
Contributor

@dbrgn dbrgn commented Jan 5, 2021

EEPROM supports single-byte writes.

image

This also changes the pointer type from u32 to usize.

Since "usize" is the pointer-sized type, it makes sense to actually use
that type for addresses instead of u32.
@dbrgn dbrgn added the enhancement New feature or request label Jan 5, 2021
@dbrgn dbrgn requested a review from hannobraun January 5, 2021 19:11
Copy link
Contributor

@hannobraun hannobraun left a comment

Choose a reason for hiding this comment

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

Looks good to me. I haven't tested, but since it seems to work for you, that's good enough for me.

I'm not too sure about changing the pointer type to usize. As far as I can see, that doesn't make any difference, except to make the code less explicit. I don't think it's a big deal though.

I'm leaving this open in case we want to talk about the usize change some more, but as far as I'm concerned, this can be merged.

@dbrgn
Copy link
Contributor Author

dbrgn commented Jan 6, 2021

As far as I can see, that doesn't make any difference, except to make the code less explicit.

For me, it's more explicit. The type is now "unsigned integer the size of pointer" (which is fitting since it stores pointers), while u32 is just "a 32 bit unsigned integer". For me it's mostly about the semantics, not about the actual size.

Edit: In theory, it also makes the code more portable, in case ST would release a new line of 64 bit microcontrollers with similar peripherals. However, I don't think that argument has any practical value, since there would surely be other differences as well.

@hannobraun
Copy link
Contributor

For me, it's more explicit. The type is now "unsigned integer the size of pointer" (which is fitting since it stores pointers), while u32 is just "a 32 bit unsigned integer". For me it's mostly about the semantics, not about the actual size.

Yeah, that makes sense. Convinced.

@hannobraun hannobraun merged commit 3fc4f66 into master Jan 6, 2021
@hannobraun hannobraun deleted the flash-eeprom branch January 6, 2021 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants