projects
/
moodlight.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
completely redid PWM: Now calculate 'microprograms', i.e. pairs of
[moodlight.git]
/
ircontrol.c
diff --git
a/ircontrol.c
b/ircontrol.c
index 4a8e46f92e0212fd30611e7369aa07fcaf15c252..16ff7b0a13d4c8f9215c667eee177e9d2164b411 100644
(file)
--- a/
ircontrol.c
+++ b/
ircontrol.c
@@
-1,4
+1,4
@@
-/* $Id: ircontrol.c,v 1.
5 2010/06/30 19:38
:28 simimeie Exp $
+/* $Id: ircontrol.c,v 1.
6 2010/07/10 07:36
:28 simimeie Exp $
* Functions for the infrared receiver
*
* The infrared receiver is connected to PB0 / PCINT0.
* Functions for the infrared receiver
*
* The infrared receiver is connected to PB0 / PCINT0.
@@
-22,7
+22,9
@@
* that equals around 7100 cpu cycles at 8 MHz. */
#define RC5HALFLENINCYCLES ((CPUFREQ * 889UL) / 1000000UL)
* that equals around 7100 cpu cycles at 8 MHz. */
#define RC5HALFLENINCYCLES ((CPUFREQ * 889UL) / 1000000UL)
-/* For NEC, we start with a 9000 us pulse, then 4500 us silence.
+/* Source for most of this was the following nice page with illustrations
+ * and all that: http://www.sbprojects.com/knowledge/ir/nec.htm
+ * For NEC, we start with a 9000 us pulse, then 4500 us silence.
* Then the bits follow:
* a 1 is a 560 us pulse followed by 1690 us of silence (=2250 us total).
* a 0 is a 560 us pulse followed by 560 us of silence (=1120 us total).
* Then the bits follow:
* a 1 is a 560 us pulse followed by 1690 us of silence (=2250 us total).
* a 0 is a 560 us pulse followed by 560 us of silence (=1120 us total).
@@
-69,7
+71,7
@@
ISR(PCINT0_vect) {
uint32_t ts1diff; /* distance from last 1 */
uint32_t ts0diff; /* distance from last 0 */
uint32_t ts1diff; /* distance from last 1 */
uint32_t ts0diff; /* distance from last 0 */
- v = PINB & _BV(
PB
0);
+ v = PINB & _BV(0);
if (v == lastpin) { /* No change visible - spurious interrupt */
return;
}
if (v == lastpin) { /* No change visible - spurious interrupt */
return;
}
@@
-184,7
+186,7
@@
ISR(PCINT0_vect) {
void ircontrol_init(void)
{
/* Activate pullup */
void ircontrol_init(void)
{
/* Activate pullup */
- PORTB |= _BV(
PB
0);
+ PORTB |= _BV(0);
/* enable PCINT0 */
PCICR |= _BV(PCIE0);
/* Enable pin change interrupt 0 (=PB0) in pcint0 */
/* enable PCINT0 */
PCICR |= _BV(PCIE0);
/* Enable pin change interrupt 0 (=PB0) in pcint0 */
This page took
0.047432 seconds
and
4
git commands to generate.