spi-memory icon indicating copy to clipboard operation
spi-memory copied to clipboard

Make BlockDevice depend on Write<u8> to remove mutable reference on write buffer

Open fry opened this issue 4 years ago • 0 comments

Hi!

I ran into the issue of write_bytes taking a &mut [u8], because the Transfer trait requires it. The nRF52-hal SPI drivers appear to implement Write<_> at least, so I made the BlockDevice trait depend on that so write_bytes can be non-mutable.

This required some reorganisation of the Error type to receive the SPI Error type, as both Transfer and Write have their own associated Error type.

I might've missed some implications of depending on the Write trait, as I assumed that anything that implements Transfer, should have no problem implementing Write.

fry avatar Nov 03 '20 11:11 fry