Update flash library to use SPI library, add void * support, refactor