fix some mismatched types in ccspi.cc, and some compiler warnings elsewhere

ccspi.cpp had a couple places where we had

 f(uint16_t x) {
   for uin8_t i=0; i<x; i++)

I discovered these while checking on various compiler warnings, which I also fixed.

If you dont want the warning fixes you still want the type fix