SPIMemory library - Formerly SPIFlash - now supports SPI FRAM as well! :)

Update on future development:

I started working on SPIFlash as a little project to improve my programming skills (in 2015) but it has quickly turned into something that barely resembles the first release on the surface.

No matter how many new features I added, the fundamental functions of the library have remained the same from day one. This means any new features I would like to add today are hamstrung by sloppy coding from 2 years ago (Don't tell this to 2015 me. I thought it was the bees-knees when I figured out how to work *flash.writeAnything()* ! I'd never heard of templates before then). With all I have learnt about programming with C & C++ over the last two years, there are a number of changes I would like to bring in to make the library lean and efficient, support more chips, and add more features - all without any more bloat. As of v2.7.0 I appear to have hit a solid wall with improving I/O speeds. I know its possible to go faster, but not with the base code as clumsy as it is.

This brings us to the next major release milestone - v3.0.0. It is going to be a complete overhaul of the library. The changes I have made so far have resulted in a pretty dramatic increase of I/O speeds - especially when working with large chunks of data like structs, arrays and strings (>50% increase in speed with strings, for example). I am doing my best to preserve the functions currently in use, but, some will have to go the way of the dodo in the name of efficiency. The following changes will be made to the library as it stands. (This is a very preliminary list - more changes will happen before final release)

  • The ability to read and write using page numbers + offsets will be retired and the library will transition to using addresses only. For users wanting to keep old programs working, the getAddress() function should help generate addresses from the page number+offset numbers
  • Preliminary testing with Microchip Flash memory has succeeded. This version will be compatible with Flash memory from multiple manufacturers, starting with Microchip.
  • The Arduino platform is now switching towards using ARM chips - more ARM chips/platforms will be supported with future releases starting with STM32. This however has started making life difficult with trying to maintain compatibility with the ATTiny platform. All versions >v3.0.0 will not support the ATTiny series any more
  • Restructuring the library has let me make the troubleshooting function more efficient and human readable. It will compile better and use far fewer resources than the current version.
  • I am working on making it easy for users to get the library working with flash memory that is not officially supported. This will roll out with v3.0.0

If any of you have any suggestions for improvement or a wishlist of features, I'd love to hear from you! - MicroPython port anyone? :sunglasses: