Provides an API software interface to TIMER2 to control upto four stepper motors.
src/SimpleStepperInst.cpp@0:7393c52297ee, 2011-05-02 (annotated)
- Committer:
- AjK
- Date:
- Mon May 02 10:02:18 2011 +0000
- Revision:
- 0:7393c52297ee
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AjK | 0:7393c52297ee | 1 | /* |
AjK | 0:7393c52297ee | 2 | Copyright (c) 2010 Andy Kirkham |
AjK | 0:7393c52297ee | 3 | |
AjK | 0:7393c52297ee | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy |
AjK | 0:7393c52297ee | 5 | of this software and associated documentation files (the "Software"), to deal |
AjK | 0:7393c52297ee | 6 | in the Software without restriction, including without limitation the rights |
AjK | 0:7393c52297ee | 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
AjK | 0:7393c52297ee | 8 | copies of the Software, and to permit persons to whom the Software is |
AjK | 0:7393c52297ee | 9 | furnished to do so, subject to the following conditions: |
AjK | 0:7393c52297ee | 10 | |
AjK | 0:7393c52297ee | 11 | The above copyright notice and this permission notice shall be included in |
AjK | 0:7393c52297ee | 12 | all copies or substantial portions of the Software. |
AjK | 0:7393c52297ee | 13 | |
AjK | 0:7393c52297ee | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
AjK | 0:7393c52297ee | 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
AjK | 0:7393c52297ee | 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
AjK | 0:7393c52297ee | 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
AjK | 0:7393c52297ee | 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
AjK | 0:7393c52297ee | 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
AjK | 0:7393c52297ee | 20 | THE SOFTWARE. |
AjK | 0:7393c52297ee | 21 | */ |
AjK | 0:7393c52297ee | 22 | |
AjK | 0:7393c52297ee | 23 | #include "SimpleSteppers.h" |
AjK | 0:7393c52297ee | 24 | #include "IOmacros.h" |
AjK | 0:7393c52297ee | 25 | |
AjK | 0:7393c52297ee | 26 | #ifdef __ARMCC_VERSION |
AjK | 0:7393c52297ee | 27 | #define __SS_IRQ __irq |
AjK | 0:7393c52297ee | 28 | #else |
AjK | 0:7393c52297ee | 29 | #define __SS_IRQ |
AjK | 0:7393c52297ee | 30 | #endif |
AjK | 0:7393c52297ee | 31 | |
AjK | 0:7393c52297ee | 32 | namespace AjK { |
AjK | 0:7393c52297ee | 33 | |
AjK | 0:7393c52297ee | 34 | SimpleStepperController __simpleStepperController; |
AjK | 0:7393c52297ee | 35 | |
AjK | 0:7393c52297ee | 36 | extern "C" void TIMER2_IRQHandler(void) __SS_IRQ { |
AjK | 0:7393c52297ee | 37 | __simpleStepperController.isr(); |
AjK | 0:7393c52297ee | 38 | LPC_TIM2->IR = 0x3F; // Clear all possible TIMER2 interrupts. |
AjK | 0:7393c52297ee | 39 | } |
AjK | 0:7393c52297ee | 40 | |
AjK | 0:7393c52297ee | 41 | }; // namespace AjK ends. |