Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: ReceiverIR.cpp
- Revision:
- 3:dfed23b157e6
- Parent:
- 1:4adf16017a0f
- Child:
- 4:2304646f6ff5
--- a/ReceiverIR.cpp Tue Aug 17 10:37:41 2010 +0000
+++ b/ReceiverIR.cpp Sat Aug 21 04:46:14 2010 +0000
@@ -29,7 +29,7 @@
IRQ_DISABLE();
State s = data.state;
IRQ_ENABLE();
- wait_ms(100);
+ wait_ms(10);
return s;
}
@@ -76,7 +76,7 @@
if ((Idle != data.state) || ((0 <= work.c1) || (0 <= work.c2) || (0 <= work.c3) || (0 <= work.d1) || (0 <= work.d2))) {
cnt++;
if (cnt > 50) {
-#if 0
+#if 1
printf("# WDT [c1=%d, c2=%d, c3=%d, d1=%d, d2=%d, state=%d, format=%d, bitcount=%d]\n",
work.c1,
work.c2,
@@ -118,9 +118,14 @@
/*
* NEC Repeat.
*/
- data.format = RemoteIR::NEC;
+ data.format = RemoteIR::NEC_REPEAT;
data.state = Received;
data.bitcount = 0;
+ work.c1 = -1;
+ work.c2 = -1;
+ work.c3 = -1;
+ work.d1 = -1;
+ work.d2 = -1;
} else if (InRange(a, TUS_AEHA * 8) && InRange(b, TUS_AEHA * 4)) {
/*
* AEHA.
@@ -132,9 +137,14 @@
/*
* AEHA Repeat.
*/
- data.format = RemoteIR::AEHA;
+ data.format = RemoteIR::AEHA_REPEAT;
data.state = Received;
data.bitcount = 0;
+ work.c1 = -1;
+ work.c2 = -1;
+ work.c3 = -1;
+ work.d1 = -1;
+ work.d2 = -1;
} else {
init_state();
}
@@ -150,7 +160,7 @@
data.buffer[data.bitcount / 8] &= ~(1 << (data.bitcount % 8));
}
data.bitcount++;
-#if 1
+#if 0
/*
* Length of NEC is always 32 bits.
*/
@@ -167,7 +177,7 @@
* Set timeout for tail detection automatically.
*/
timeout.detach();
- timeout.attach_us(this, &ReceiverIR::isr_timeout, TUS_NEC * 12);
+ timeout.attach_us(this, &ReceiverIR::isr_timeout, TUS_NEC * 5);
#endif
} else if (RemoteIR::AEHA == data.format) {
work.d2 = timer.read_us();
@@ -178,7 +188,7 @@
data.buffer[data.bitcount / 8] &= ~(1 << (data.bitcount % 8));
}
data.bitcount++;
-#if 1
+#if 0
/*
* Typical length of AEHA is 48 bits.
* Please check a specification of your remote controller if you find a problem.
@@ -196,7 +206,7 @@
* Set timeout for tail detection automatically.
*/
timeout.detach();
- timeout.attach_us(this, &ReceiverIR::isr_timeout, TUS_AEHA * 12);
+ timeout.attach_us(this, &ReceiverIR::isr_timeout, TUS_AEHA * 5);
#endif
} else if (RemoteIR::SONY == data.format) {
work.d1 = timer.read_us();
@@ -245,7 +255,7 @@
data.buffer[data.bitcount / 8] &= ~(1 << (data.bitcount % 8));
}
data.bitcount++;
-#if 1
+#if 0
/*
* How do we get the correct length? (6bits, 12bits, 15bits, 20bits...)
* By a model only?
@@ -264,7 +274,7 @@
* Set timeout for tail detection automatically.
*/
timeout.detach();
- timeout.attach_us(this, &ReceiverIR::isr_timeout, TUS_SONY * 10);
+ timeout.attach_us(this, &ReceiverIR::isr_timeout, TUS_SONY * 4);
#endif
}
break;