drivers icon indicating copy to clipboard operation
drivers copied to clipboard

`sd` package: `sdcard` package redesign

Open soypat opened this issue 1 year ago • 8 comments
trafficstars

New Features:

  • Idiomatic CSD V1,V2 support with V3 API compatibility
  • No heap allocations
  • Complete error handling
  • CRC support
  • Design for interface compatibility with other SDCard implementations i.e. Using raw SDIO with a Raspberry Pi Pico.
  • Added tests for what is testable
  • Renamed ReadData to more idiomatic ReadBlock, same with Write methods
  • More checks for OOB write/read requests
  • Allow multi block writing and multi block reading in a double method interface, making it easier to use.
  • Easily enable highest transfer rate available for SDCard using CSD

~Is still a WIP. CRC7 still does not work and I'm getting errors on ever other ReadBlock call.~

soypat avatar Jan 14 '24 18:01 soypat

Is it possible to make this implement BlockDevice so that it is natively compatible with tinyfs? Skimming definitions.go, it looks there are some similar methods in there

https://github.com/tinygo-org/tinyfs/blob/release/tinyfs.go#L43

bgould avatar Jan 15 '24 14:01 bgould

@bgould Will do, but I'll do it through another type that uses the ReadBlocks/WriteBlocks interface set to implement the tinyfs.BlockDevice interface. Already had this in mind as the next addition to sd

soypat avatar Jan 15 '24 22:01 soypat

@bgould I've added a draft of what I mean: https://github.com/tinygo-org/drivers/pull/639/files#diff-92f519b8e01de4c93b473c245b482f67da4e20bfbfbe48aaca799f35e45afb43R38

soypat avatar Jan 15 '24 23:01 soypat

@bgould OK, I've finished the sd.BlockDevice type, seems to be working OK. Check it out and let me know what you think :)

soypat avatar Jan 16 '24 03:01 soypat

@soypat would you perhaps be able to add a README with some small explanation about how this works?

For example what is rustref.go do? :smile_cat:

deadprogram avatar Jan 23 '24 17:01 deadprogram

OK, added a Readme and switched some filenames around to make navigation easier.

soypat avatar Jan 23 '24 23:01 soypat

@bgould have you had a chance to try this out yet?

deadprogram avatar Feb 24 '24 18:02 deadprogram

Paging Dr. @bgould :smile_cat: any chance to try this out?

deadprogram avatar May 02 '24 17:05 deadprogram