Fix reading the PWM period on init.

"a" positions the stream at the end of the file, so it was always
reading 0.

Also, move state declaration out of robotics_cape.h