Fork of Smoothie to port to mbed non-LPC targets.
Fork of Smoothie by
Diff: libs/SlowTicker.cpp
- Revision:
- 3:f151d08d335c
- Parent:
- 2:1df0b61d3b5a
diff -r 1df0b61d3b5a -r f151d08d335c libs/SlowTicker.cpp --- a/libs/SlowTicker.cpp Fri Feb 28 18:52:52 2014 -0800 +++ b/libs/SlowTicker.cpp Sun Mar 02 06:33:08 2014 +0000 @@ -14,8 +14,6 @@ #include "libs/Hook.h" #include "modules/robot/Conveyor.h" -#include <mri.h> - // This module uses a Timer to periodically call hooks // Modules register with a function ( callback ) and a frequency, and we then call that function at the given frequency. @@ -25,16 +23,6 @@ max_frequency = 0; global_slow_ticker = this; - // Configure the actual timer - LPC_SC->PCONP |= (1 << 22); // Power Ticker ON - LPC_TIM2->MR0 = 10000; // Initial dummy value for Match Register - LPC_TIM2->MCR = 3; // Match on MR0, reset on MR0 - LPC_TIM2->TCR = 1; // Enable interrupt - NVIC_EnableIRQ(TIMER2_IRQn); // Enable interrupt handler - - // ISP button - ispbtn.from_string("2.10")->as_input()->pull_up(); - // TODO: What is this ?? flag_1s_flag = 0; flag_1s_count = SystemCoreClock>>2; @@ -52,9 +40,6 @@ // Set the base frequency we use for all sub-frequencies void SlowTicker::set_frequency( int frequency ){ this->interval = (SystemCoreClock >> 2) / frequency; // SystemCoreClock/4 = Timer increments in a second - LPC_TIM2->MR0 = this->interval; - LPC_TIM2->TCR = 3; // Reset - LPC_TIM2->TCR = 1; // Reset flag_1s_count= SystemCoreClock>>2; } @@ -92,12 +77,6 @@ else g4_ticks = 0; } - - // Enter MRI mode if the ISP button is pressed - // TODO: This should have it's own module - if (ispbtn.get() == 0) - __debugbreak(); - } bool SlowTicker::flag_1s(){ @@ -182,9 +161,5 @@ } extern "C" void TIMER2_IRQHandler (void){ - if((LPC_TIM2->IR >> 0) & 1){ // If interrupt register set for MR0 - LPC_TIM2->IR |= 1 << 0; // Reset it - } global_slow_ticker->tick(); } -