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

Mike,

here's the update. Let me know how it looks and if you're happy with it.

Cheers,
Darran.