summaryrefslogtreecommitdiff
path: root/ppmsum.cpp
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2011-11-19 20:02:14 +0100
committerVegard Storheil Eriksen <zyp@jvnv.net>2011-11-19 20:02:14 +0100
commit307cfe164910eccc70c086c083595d637c7fb987 (patch)
treef9845dc9647518840faf469580f581cf65d9fced /ppmsum.cpp
parentc265553652444293f90189c7481fb7eb16f28115 (diff)
Moved driver related files to a subdirectory.
Diffstat (limited to 'ppmsum.cpp')
-rw-r--r--ppmsum.cpp54
1 files changed, 0 insertions, 54 deletions
diff --git a/ppmsum.cpp b/ppmsum.cpp
deleted file mode 100644
index 2beaccb..0000000
--- a/ppmsum.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-#include "ppmsum.h"
-
-PPMSum* PPMSum::self = 0;
-
-template<>
-void interrupt<Interrupt::TIM1_UP>() {
- PPMSum::self->irq();
-}
-
-template<>
-void interrupt<Interrupt::TIM1_CC>() {
- PPMSum::self->irq();
-}
-
-void PPMSum::irq() {
- int16_t sr = TIM1.SR;
- TIM1.SR = 0;
-
- if(sr & 0x01) {
- // Timeout.
-
- synced = false;
-
- } else if(sr & 0x02) {
- // Period.
-
- if(TIM1.CCR1 > 5000) {
- synced = true;
- index = 0;
- } else {
- index++;
- index &= 0xf;
- }
-
- } else if(sr & 0x04) {
- // Pulsewidth.
-
- channels[index] = TIM1.CCR2;
- }
-}
-
-void PPMSum::enable() {
- RCC.enable(RCC.TIM1);
- TIM1.PSC = 72;
- TIM1.CCMR1 = 0x0201;
- TIM1.SMCR = 0x54;
- TIM1.CCER = 0x31;
- TIM1.DIER = 0x07;
-
- Interrupt::enable(Interrupt::TIM1_UP);
- Interrupt::enable(Interrupt::TIM1_CC);
-
- TIM1.CR1 = 0x05;
-}