7 Commits

Author SHA1 Message Date
Rafi Khan
e19475e23a added changelog and contributors note 2017-02-06 22:23:57 -06:00
Rafi Khan
79f1baa0d6 Merge branch 'master' of https://github.com/salocinx/Arduino-IRremote into salocinx-master 2017-02-06 22:19:49 -06:00
salocinx
dd6da0d0cd Update irRecv.cpp 2017-02-02 14:20:41 +01:00
salocinx
69c4503209 added CDTV support 2017-02-02 14:18:57 +01:00
salocinx
db9cf55188 Create ir_CDTV.cpp 2017-02-02 14:15:07 +01:00
Rafi Khan
e12557b813 Merge branch 'master' of https://github.com/z3t0/Arduino-IRremote 2017-01-30 20:12:25 -06:00
Rafi Khan
98d6a2cf3f renamed "boarddefs.h" to "IRremoteBoardDefs.h" to avoid possible
conflcits. This was suggested in #375 and aims to prevent a **possible**
issue.
2017-01-20 23:13:28 -06:00
7 changed files with 177 additions and 7 deletions

View File

@@ -15,8 +15,9 @@ These are the active contributors of this project that you may contact if there
- [csBlueChip](https://github.com/csbluechip) : Active contributor, who contributed major and vital changes to the code base. - [csBlueChip](https://github.com/csbluechip) : Active contributor, who contributed major and vital changes to the code base.
- [Sebazzz](https://github.com/sebazz): Contributor - [Sebazzz](https://github.com/sebazz): Contributor
- [lumbric](https://github.com/lumbric): Contributor - [lumbric](https://github.com/lumbric): Contributor
- [ElectricRCAircraftGuy](https://github.com/electricrcaircraftguy): Active Contributor - [ElectricRCAircraftGuy](https://github.com/electricrcaircraftguy): Contributor
- [henkel](https://github.com/henkel): Contributor - [henkel](https://github.com/henkel): Contributor
- [MCUdude](https://github.com/MCUdude): Contributor - [MCUdude](https://github.com/MCUdude): Contributor
- [salocinx](https://github.com/salocinx): Contributor
Note: This list is being updated constantly so please let [z3t0](https://github.com/z3t0) know if you have been missed. Note: This list is being updated constantly so please let [z3t0](https://github.com/z3t0) know if you have been missed.

View File

@@ -79,6 +79,9 @@
#define DECODE_LEGO_PF 0 // NOT WRITTEN #define DECODE_LEGO_PF 0 // NOT WRITTEN
#define SEND_LEGO_PF 1 #define SEND_LEGO_PF 1
#define DECODE_CDTV 1
#define SEND_CDTV 1
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// When sending a Pronto code we request to send either the "once" code // When sending a Pronto code we request to send either the "once" code
// or the "repeat" code // or the "repeat" code
@@ -119,6 +122,7 @@ typedef
DENON, DENON,
PRONTO, PRONTO,
LEGO_PF, LEGO_PF,
CDTV,
} }
decode_type_t; decode_type_t;
@@ -247,9 +251,13 @@ class IRrecv
# if DECODE_DENON # if DECODE_DENON
bool decodeDenon (decode_results *results) ; bool decodeDenon (decode_results *results) ;
# endif # endif
//...................................................................... //......................................................................
# if DECODE_LEGO_PF # if DECODE_LEGO_PF
bool decodeLegoPowerFunctions (decode_results *results) ; bool decodeLegoPowerFunctions (decode_results *results) ;
# endif
//......................................................................
# if DECODE_CDTV
bool decodeCDTV (decode_results *results) ;
# endif # endif
} ; } ;
@@ -335,9 +343,13 @@ class IRsend
# if SEND_PRONTO # if SEND_PRONTO
void sendPronto (char* code, bool repeat, bool fallback) ; void sendPronto (char* code, bool repeat, bool fallback) ;
# endif # endif
//...................................................................... //......................................................................
# if SEND_LEGO_PF # if SEND_LEGO_PF
void sendLegoPowerFunctions (uint16_t data, bool repeat = true) ; void sendLegoPowerFunctions (uint16_t data, bool repeat = true) ;
# endif
//......................................................................
# if SEND_CDTV
void sendCDTV (unsigned long data, int nbits) ;
# endif # endif
} ; } ;

View File

@@ -17,8 +17,8 @@
// Whynter A/C ARC-110WD added by Francesco Meschia // Whynter A/C ARC-110WD added by Francesco Meschia
//****************************************************************************** //******************************************************************************
#ifndef boarddefs_h #ifndef IRremoteBoardDefs_h
#define boarddefs_h #define IRremoteBoardDefs_h
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Defines for blinking the LED // Defines for blinking the LED
@@ -545,4 +545,4 @@
# error "Internal code configuration error, no known IR_USE_TIMER# defined\n" # error "Internal code configuration error, no known IR_USE_TIMER# defined\n"
#endif #endif
#endif // ! boarddefs_h #endif // ! IRremoteBoardDefs_h

View File

@@ -108,6 +108,6 @@ EXTERN volatile irparams_t irparams;
#define SPACE 1 #define SPACE 1
// All board specific stuff has been moved to its own file, included here. // All board specific stuff has been moved to its own file, included here.
#include "boarddefs.h" #include "IRremoteBoardDefs.h"
#endif #endif

View File

@@ -1,4 +1,8 @@
## 2.3.0 - 2017/02/06
- Added Commodore Amiga CDTV Support [ISSUE #407](https://github.com/z3t0/Arduino-IRremote/issues/407) [PR #413](https://github.com/z3t0/Arduino-IRremote/pull/413)
## 2.2.2 - 2017/01/20 ## 2.2.2 - 2017/01/20
- Renamed "boarddefs.h" [ISSUE #375](https://github.com/z3t0/Arduino-IRremote/issues/375)
- Fixed naming bug [PR #398](https://github.com/z3t0/Arduino-IRremote/pull/398) - Fixed naming bug [PR #398](https://github.com/z3t0/Arduino-IRremote/pull/398)
## 2.2.1 - 2016/07/27 ## 2.2.1 - 2016/07/27

View File

@@ -85,6 +85,11 @@ int IRrecv::decode (decode_results *results)
if (decodeLegoPowerFunctions(results)) return true ; if (decodeLegoPowerFunctions(results)) return true ;
#endif #endif
#if DECODE_CDTV
DBG_PRINTLN("Attempting Commodore Amiga CDTV decode");
if (decodeCDTV(results)) return true;
#endif
// decodeHash returns a hash on any input. // decodeHash returns a hash on any input.
// Thus, it needs to be last in the list. // Thus, it needs to be last in the list.
// If you add any decodes, add them before this. // If you add any decodes, add them before this.

148
ir_CDTV.cpp Normal file
View File

@@ -0,0 +1,148 @@
#include "IRremote.h"
#include "IRremoteInt.h"
//==============================================================================
// COMMODORE AMIGA CD-TV
//==============================================================================
//==============================================================================
// CCCC DDDD TTTTT V V
// C D D T V V
// C D D T V V
// C D D T V V
// CCCC DDDD T V
//==============================================================================
//==============================================================================
// MEASUREMENTS
//==============================================================================
/*Encoding: UNKNOWN
Code : 72A03D6B(32 bits)
Timing[51] :
+8900, -4450 + 400, -1200 + 350, -400 + 400, -400
+ 400, -400 + 400, -1200 + 400, -400 + 350, -450
+ 350, -400 + 400, -400 + 400, -350 + 450, -400
+ 350, -450 + 350, -400 + 400, -1200 + 400, -1200
+ 350, -1200 + 400, -450 + 350, -1200 + 400, -1200
+ 350, -1200 + 400, -1200 + 350, -1250 + 350, -1200
+ 400, -1200 + 350
unsigned int rawData[51] = { 8900,4450, 400,1200, 350,400, 400,400, 400,400, 400,1200, 400,400, 350,450, 350,400, 400,400, 400,350, 450,400, 350,450, 350,400, 400,1200, 400,1200, 350,1200, 400,450, 350,1200, 400,1200, 350,1200, 400,1200, 350,1250, 350,1200, 400,1200, 350 }; // UNKNOWN 72A03D6B
*/
// NOTE: The array dump above begins at index = 1; therefore offset = 1 in the code below
//==============================================================================
#define CDTV_BITS 24
// timing intervals in usec
#define CDTV_HDR_MARK 8850 // start burst
#define CDTV_HDR_SPACE 4450 // pause after start
#define CDTV_BIT_MARK 350 // pulse
#define CDTV_ONE_SPACE 1250 // receive a '1'
#define CDTV_ZERO_SPACE 450 // receive a '0'
#define CDTV_RPT_SPACE 2250 // repeat signal
// message sizes measured in raw pulses
#define CDTV_RAW_REPEAT_LENGTH 4 // CDTV_HDR_MARK + CDTV_HDR_SPACE + CDTV_BIT_MARK
#define CDTV_RAW_SIGNAL_LENGTH 52 // CDTV_HDR_MARK + CDTV_HDR_SPACE + CDTV_BITS * (CDTV_BIT_MARK + CDTV_ZERO_SPACE | CDTV_ONE_SPACE)
//+=============================================================================
#if SEND_CDTV
void IRsend::sendCDTV(unsigned long data, int nbits) {
// set IR carrier frequency
enableIROut(40);
// send header
mark(CDTV_HDR_MARK);
space(CDTV_HDR_SPACE);
// send data
for (unsigned long mask = 1UL << (nbits - 1); mask; mask >>= 1) {
if (data & mask) {
mark(CDTV_BIT_MARK);
space(CDTV_ONE_SPACE);
} else {
mark(CDTV_BIT_MARK);
space(CDTV_ZERO_SPACE);
}
}
// send footer
mark(CDTV_BIT_MARK);
// always end with the LED off
space(0);
}
#endif
//+=============================================================================
// CDTV have a repeat signal that is 4-bits long [#FFFFFF]
//
#if DECODE_CDTV
bool IRrecv::decodeCDTV(decode_results *results) {
unsigned long data = 0; // we decode into this field; start with empty placeholder
int offset = 1; // skip first entry since it has not a lot of meaning
// check if header mark is within range
if (!MATCH_MARK(results->rawbuf[offset], CDTV_HDR_MARK)) {
return false;
}
offset++; // -> offset[2]
// check for 4-bit repeat signal
if ((irparams.rawlen == CDTV_RAW_REPEAT_LENGTH)
&& MATCH_SPACE(results->rawbuf[offset], CDTV_RPT_SPACE)
&& MATCH_MARK(results->rawbuf[offset+1], CDTV_BIT_MARK)) {
results->bits = 4;
results->value = 0xFFFFFF;
results->decode_type = CDTV;
return true;
}
// check on minimal raw length for decoding the 24-bit signal correctly
if (irparams.rawlen < CDTV_RAW_SIGNAL_LENGTH) {
return false;
}
// check header space
if (!MATCH_SPACE(results->rawbuf[offset], CDTV_HDR_SPACE)) {
return false;
}
offset++; // -> offset[3]
// build the data
for (int i = 0; i < CDTV_BITS; i++) {
// check if data mark is available; otherwise break
if (!MATCH_MARK(results->rawbuf[offset], CDTV_BIT_MARK)) {
return false;
}
offset++; // -> offset[4->28]
// append this bit
if (MATCH_SPACE(results->rawbuf[offset], CDTV_ONE_SPACE)) {
data = (data << 1) | 1;
} else if (MATCH_SPACE(results->rawbuf[offset], CDTV_ZERO_SPACE)) {
data = (data << 1) | 0;
} else {
return false;
}
offset++;
}
// validate checksum by comparing lower 12-bits with inverted higher 12-bits
unsigned long lo = data & 0xFFF; // extract lower 12-bit
unsigned long hi = data >> 12; // extract higher 12-bit
// success if (low XOR high == 0xFFF)
if (lo^hi == 0xFFF) {
results->bits = CDTV_BITS;
results->value = data;
results->decode_type = CDTV;
return true;
}
return false;
}
#endif