added functions to set the period in HardwareTimer