Bye bye Wii Motion Plus, hello MPU6050. Also, increase control loop
to 200Hz, add SD card logging, and a number of other changes.
This commit is contained in:
6
timer.c
6
timer.c
@@ -105,7 +105,7 @@ void init_timer(void)
|
||||
|
||||
T2REG(TCR) = TCR_ENABLE | TCR_RESET;
|
||||
T2REG(CTCR) = 0; /* Use PCLK */
|
||||
T2WREG(PR) = 0; // Prescaling
|
||||
T2WREG(PR) = 3; // Prescaling
|
||||
T2WREG(PC) = 0; // Reset the prescale counter
|
||||
T2WREG(TC) = 0; // Reset the counter
|
||||
|
||||
@@ -120,7 +120,7 @@ void init_timer(void)
|
||||
|
||||
T1REG(TCR) = TCR_ENABLE | TCR_RESET;
|
||||
T1REG(CTCR) = 0; /* Use PCLK */
|
||||
T1WREG(PR) = 0; // Prescaling
|
||||
T1WREG(PR) = 3; // Prescaling
|
||||
T1WREG(PC) = 0; // Reset the prescale counter
|
||||
T1WREG(TC) = 0; // Reset the counter
|
||||
|
||||
@@ -151,7 +151,7 @@ void timer_delay_clocks(unsigned int clocks)
|
||||
void timer_set_period(unsigned int period)
|
||||
{
|
||||
interrupt_register(TIMER3, timer_interrupt_handler);
|
||||
T3WREG(MR0) = period;
|
||||
T3WREG(MR0) = period-1;
|
||||
T3WREG(MCR) = MR0I | MR0R;
|
||||
T3WREG(TC) = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user