summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2011-11-18 22:07:11 +0100
committerAlexander Sulfrian <alexander@sulfrian.net>2011-11-18 22:07:11 +0100
commit6a072ffc96fb16b44bf21e9b4e4ae9e2b64f78f6 (patch)
treea5c21fc9bd96c854167e5ffe97696fa7cb2a0b88
parentae455ef0bca4ea7a7119dac1ed28f5aab9bae265 (diff)
downloadonkyo-ri-6a072ffc96fb16b44bf21e9b4e4ae9e2b64f78f6.tar.gz
onkyo-ri-6a072ffc96fb16b44bf21e9b4e4ae9e2b64f78f6.tar.xz
onkyo-ri-6a072ffc96fb16b44bf21e9b4e4ae9e2b64f78f6.zip
translate the onkyo signals into the ones for pioneer
-rw-r--r--onkyo_ri.pde17
1 files changed, 16 insertions, 1 deletions
diff --git a/onkyo_ri.pde b/onkyo_ri.pde
index a23c920..4ce88c2 100644
--- a/onkyo_ri.pde
+++ b/onkyo_ri.pde
@@ -70,12 +70,27 @@ void send(ir_t *proto, uint64_t value, int pin, bool inverted) {
void setup(void) {
Serial.begin(9600);
Serial.println("Ready to decode IR!");
- pinMode(13, OUTPUT);
+ pinMode(8, OUTPUT);
+
+ digitalWrite(8, HIGH);
+}
+
+void findKey(ir_map_t *ir_map, uint8_t count, uint64_t code) {
+ uint8_t i;
+
+ for (i = 0; i < count; i++) {
+ if (ir_map[i].from == code) {
+ send(&pioneer, ir_map[i].to, 8, true);
+ return;
+ }
+ }
}
void loop(void) {
uint64_t code = listenForIR(&onkyo);
Serial.println(code, HEX);
+
+ findKey(ir_map, ARRAY_LEN(ir_map), code);
}
int getPulseLength() {