Getting the code to run on the Due is not as easy. Changes I had to make to get the code to compile where:
- Replace the AVR pgmspace code with a stubbed out implementation that for SAM
- Fix up calls to random()
- Replace calls to the _BV(x) macro with (1 << x)
- Remove references to util/delay.h
- Change calls to _delay_ms(x) to delay(x)
- Remove the freemem() function and calls to it since it requires macros that don’t exist on SAM
I’ve also wired the ST7565 directly to the Due, instead of level shifting it through the 4050 that adafruit supplies with it since the Due is 3.3v already.