Merge pull request #174 from Sissors/master

Properly round non integer bus-frequencies in MHz
pull/176/head
Emilio Monti 2014-02-18 17:48:06 +00:00
commit 8583716513
1 changed files with 1 additions and 1 deletions

View File

@ -44,7 +44,7 @@ static void pit_init(void) {
PIT->CHANNEL[1].TCTRL |= PIT_TCTRL_TEN_MASK; // Start timer 1
// Use channel 0 as a prescaler for channel 1
PIT->CHANNEL[0].LDVAL = bus_frequency() / 1000000 - 1;
PIT->CHANNEL[0].LDVAL = (bus_frequency() + 500000) / 1000000 - 1;
PIT->CHANNEL[0].TCTRL = PIT_TCTRL_TEN_MASK; // Start timer 0, disable interrupts
}