summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2011-07-09 18:49:13 +0200
committerVegard Storheil Eriksen <zyp@jvnv.net>2011-07-09 18:50:01 +0200
commit1e38db8e6d96aeec5231d9614ac9f7605773b596 (patch)
tree4fb6091bf79d5f1d55b32c11f6df5c4f37430f7b
parent091a4f626f8c6369638a3d54b8b67d9e225673ad (diff)
Added synced-flag to PPMSum class.
-rw-r--r--ppmsum.cpp3
-rw-r--r--ppmsum.h4
2 files changed, 5 insertions, 2 deletions
diff --git a/ppmsum.cpp b/ppmsum.cpp
index 3da7d78..75faa17 100644
--- a/ppmsum.cpp
+++ b/ppmsum.cpp
@@ -21,12 +21,13 @@ void PPMSum::irq() {
if(sr & 0x01) {
// Timeout.
- // TODO: Indicate failsafe.
+ synced = false;
} else if(sr & 0x02) {
// Period.
if(TIM4.CCR1 > 5000) {
+ synced = true;
index = 0;
} else {
index++;
diff --git a/ppmsum.h b/ppmsum.h
index 3c4ce79..efc7287 100644
--- a/ppmsum.h
+++ b/ppmsum.h
@@ -11,7 +11,6 @@ class PPMSum {
static PPMSum* self;
uint8_t index;
- uint16_t channels[16];
void irq();
@@ -20,6 +19,9 @@ class PPMSum {
self = this;
}
+ bool synced;
+ uint16_t channels[16];
+
void enable();
};