Changed spi freq to 16MHz. Fixed a bug with long periods not fitting in uint16