fixed major errors; code now compiles

Sorry, didn’t make sure code could compile before 1st commit. It can at
least do that now, still untested with PIC32.