Skip to content

Commit 78b4f8c

Browse files
authored
* Added support for Particle boards (Arduino-IRremote#726)
Thanks 👍
1 parent e2768ec commit 78b4f8c

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

src/private/IRremoteBoardDefs.h

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,12 @@
150150
#undef USE_DEFAULT_ENABLE_IR_IN
151151
#undef USE_DEFAULT_ENABLE_IR_OUT
152152

153+
#elif defined(PARTICLE)
154+
155+
#define BLINKLED D7
156+
#define BLINKLED_ON() digitalWrite(BLINKLED,1)
157+
#define BLINKLED_OFF() digitalWrite(BLINKLED,0)
158+
153159
#else
154160
#warning No blinking definition found. Check IRremoteBoardDefs.h.
155161
#ifdef LED_BUILTIN
@@ -367,6 +373,13 @@
367373
// Supply own enbleIRIn
368374
#undef USE_DEFAULT_ENABLE_IR_IN
369375

376+
/*********************
377+
* Particle Boards
378+
*********************/
379+
#elif defined(PARTICLE)
380+
#define IR_USE_TIMER_PARTICLE
381+
#define SYSCLOCK 16000000
382+
370383
#else
371384
// Arduino Duemilanove, Diecimila, LilyPad, Mini, Fio, Nano, etc
372385
// ATmega48, ATmega88, ATmega168, ATmega328
@@ -991,6 +1004,49 @@ static void timerConfigForSend(uint16_t aFrequencyKHz __attribute__((unused))) {
9911004
#endif
9921005
#define ISR(f) void IRTimer(void)
9931006

1007+
// defines for Particle special IntervalTimer
1008+
#elif defined(IR_USE_TIMER_PARTICLE)
1009+
1010+
#ifndef __INTERVALTIMER_H__
1011+
#include "SparkIntervalTimer.h" // SparkIntervalTimer.h is required if PARTICLE is defined.
1012+
#endif
1013+
1014+
#ifndef IR_SEND_PIN
1015+
#define IR_SEND_PIN A5 // Particle supports multiple pins
1016+
#endif
1017+
1018+
#ifndef IR_OUT_KHZ
1019+
#define IR_OUT_KHZ 38 // default set to 38 KHz
1020+
#endif
1021+
1022+
extern IntervalTimer timer;
1023+
extern int ir_send_pin;
1024+
extern int ir_out_khz;
1025+
1026+
1027+
void IRTimer();
1028+
1029+
#define TIMER_RESET_INTR_PENDING
1030+
#define TIMER_ENABLE_SEND_PWM analogWrite(ir_send_pin, 128, ir_out_khz*1000)
1031+
#define TIMER_DISABLE_SEND_PWM analogWrite(ir_send_pin, 0, ir_out_khz*1000)
1032+
#define TIMER_ENABLE_RECEIVE_INTR timer.begin(IRTimer, 50, uSec);
1033+
#define TIMER_DISABLE_RECEIVE_INTR timer.end()
1034+
1035+
#ifdef ISR
1036+
#undef ISR
1037+
#endif
1038+
#define ISR(f) IntervalTimer timer; \
1039+
int ir_out_khz = IR_OUT_KHZ; \
1040+
int ir_send_pin = IR_SEND_PIN; \
1041+
void IRTimer(void)
1042+
1043+
static void timerConfigForSend(uint16_t aFrequencyKHz) {
1044+
ir_out_khz = aFrequencyKHz;
1045+
}
1046+
1047+
static void timerConfigForReceive() {
1048+
}
1049+
9941050
//---------------------------------------------------------
9951051
// Unknown Timer
9961052
//

0 commit comments

Comments
 (0)