Skip to content

Commit 8583716

Browse files
committed
Merge pull request #174 from Sissors/master
Properly round non integer bus-frequencies in MHz
2 parents 94a1bdc + 65d6645 commit 8583716

File tree

1 file changed

+1
-1
lines changed
  • libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KLXX

1 file changed

+1
-1
lines changed

libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KLXX/us_ticker.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ static void pit_init(void) {
4444
PIT->CHANNEL[1].TCTRL |= PIT_TCTRL_TEN_MASK; // Start timer 1
4545

4646
// Use channel 0 as a prescaler for channel 1
47-
PIT->CHANNEL[0].LDVAL = bus_frequency() / 1000000 - 1;
47+
PIT->CHANNEL[0].LDVAL = (bus_frequency() + 500000) / 1000000 - 1;
4848
PIT->CHANNEL[0].TCTRL = PIT_TCTRL_TEN_MASK; // Start timer 0, disable interrupts
4949
}
5050

0 commit comments

Comments
 (0)