PIC32 port of Repaper's EPD code