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:
2014-05-06 21:03:48 +00:00
parent b482b85ffd
commit e8adff93c1
25 changed files with 1725 additions and 581 deletions

View File

@@ -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;
}