Fixed pointer to periodic timer.  Added mega detection for SPI config.

Ran into a build issue with the way periodic_timer was defined and used.  error: field 'periodic_timer' has incomplete type.  This fixes that.

I also added the detection of mega boards and setting the SPI pins appropriately.