stm32-rs / stm32l0xx-hal

A hardware abstraction layer (HAL) for the STM32L0 series microcontrollers written in Rust
BSD Zero Clause License
96 stars 60 forks source link

Flash: Support writing single bytes to EEPROM #140

Closed dbrgn closed 3 years ago

dbrgn commented 3 years ago

EEPROM supports single-byte writes.

image

This also changes the pointer type from u32 to usize.

dbrgn commented 3 years ago

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 commented 3 years ago

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.