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.
Fork of RemoteIR by
Revision 12:0767bcde0d32, committed 2016-02-01
- Comitter:
- 1ITF3
- Date:
- Mon Feb 01 10:20:31 2016 +0000
- Parent:
- 11:268cc2ab63bd
- Commit message:
- Test code TV RC6 bij gecodeerd
Changed in this revision
--- a/RemoteIR.h Mon Sep 20 00:54:59 2010 +0000
+++ b/RemoteIR.h Mon Feb 01 10:20:31 2016 +0000
@@ -17,13 +17,15 @@
NEC_REPEAT,
AEHA,
AEHA_REPEAT,
- SONY
+ SONY,
+ RC6
} Format;
static const int TUS_NEC = 562;
static const int TUS_AEHA = 425;
static const int TUS_SONY = 600;
-
+ static const int TUS_RC6 = 444;
+
private:
RemoteIR();
};
--- a/TransmitterIR.cpp Mon Sep 20 00:54:59 2010 +0000
+++ b/TransmitterIR.cpp Mon Feb 01 10:20:31 2016 +0000
@@ -68,6 +68,8 @@
work.leader = 0;
work.data = 0;
work.trailer = 0;
+
+
data.format = format;
data.bitlength = bitlength;
@@ -89,6 +91,10 @@
ticker.detach();
ticker.attach_us(this, &TransmitterIR::tick, RemoteIR::TUS_SONY);
break;
+ case RemoteIR::RC6:
+ ticker.detach();
+ ticker.attach_us(this, &TransmitterIR::tick, RemoteIR::TUS_RC6);
+ break;
}
UNLOCK();
@@ -111,6 +117,7 @@
*/
static const int LEADER_NEC_HEAD = 16;
static const int LEADER_NEC_TAIL = 8;
+
if (work.leader < LEADER_NEC_HEAD) {
tx.write(0.5);
} else {
@@ -120,6 +127,21 @@
if ((LEADER_NEC_HEAD + LEADER_NEC_TAIL) <= work.leader) {
work.state = Data;
}
+ } else if (data.format == RemoteIR::RC6){
+ //RC6
+ static const int LEADER_RC6_HEAD = 6;
+ static const int LEADER_RC6_TAIL = 2;
+ static const int LEADER_RC6_TOGGLE= 888;
+ if (work.leader < LEADER_RC6_HEAD) {
+ tx.write(0.5);
+
+ } else {
+ tx.write(0.0);
+ }
+ work.leader++;
+ if ((LEADER_RC6_HEAD + LEADER_RC6_TAIL) <= work.leader) {
+ work.state = Toggle;
+ }
} else if (data.format == RemoteIR::AEHA) {
/*
* AEHA.
@@ -153,6 +175,23 @@
} else {
}
break;
+ work.state = Leader;
+
+ case Toggle:
+ if (0 != (data.buffer[work.bitcount / 8] & (1 << work.bitcount % 8))) {
+ if (1 <= work.data) {
+ tx.write(0.5);
+ } else {
+ work.data++;
+ }
+
+
+ } else {
+ work.data++;
+ }
+
+
+ break;
case Data:
if (data.format == RemoteIR::NEC) {
/*
@@ -182,6 +221,28 @@
if (data.bitlength <= work.bitcount) {
work.state = Trailer;
}
+ } else if (data.format == RemoteIR::RC6) {
+ //RC6
+
+ if (0 != (data.buffer[work.bitcount / 8] & (1 << work.bitcount % 8))) {
+ if (1 <= work.data) {
+ tx.write(0.5);
+ } else {
+ work.data++;
+ }
+ } else {
+ if (0 <= work.data) {
+ tx.write(0.0);
+
+ } else {
+ work.data++;
+ }
+
+ }
+ if (data.bitlength <= work.bitcount) {
+ work.state = Trailer;
+ }
+
} else if (data.format == RemoteIR::AEHA) {
/*
* AEHA.
@@ -205,7 +266,9 @@
} else {
work.data++;
}
+
}
+
}
if (data.bitlength <= work.bitcount) {
work.state = Trailer;
@@ -258,6 +321,20 @@
work.state = Idle;
//ticker.detach();
}
+ } else if (data.format == RemoteIR::RC6) {
+ //RC6
+ static const int TRAILER_RC6_HEAD = 0;
+ static const int TRAILER_RC6_TAIL = 1;
+ if (work.trailer < TRAILER_RC6_HEAD) {
+ tx.write(0.5);
+ } else {
+ tx.write(0.0);
+ }
+ work.trailer++;
+ if ((TRAILER_RC6_HEAD + TRAILER_RC6_TAIL) <= work.trailer) {
+ work.state = Idle;
+ //ticker.detach();
+ }
} else if (data.format == RemoteIR::AEHA) {
/*
* AEHA.
--- a/TransmitterIR.h Mon Sep 20 00:54:59 2010 +0000
+++ b/TransmitterIR.h Mon Feb 01 10:20:31 2016 +0000
@@ -34,7 +34,8 @@
Idle,
Leader,
Data,
- Trailer
+ Trailer,
+ Toggle
} State;
/**
