Skip to content

Commit e535db8

Browse files
committed
Renamed hardware specific macro and function names.
1 parent ea450fc commit e535db8

File tree

5 files changed

+123
-100
lines changed

5 files changed

+123
-100
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## 2.6.2 2020/08
22
- Added ATmega328PB support.
3+
- Renamed hardware specific macro and function names.
34

45
## 2.6.1 2020/08
56
- Adjusted JVC and LG timing.

src/IRremote.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ int MATCH_SPACE(int measured_ticks, int desired_us) {
127127
// Gap width is recorded; Ready is cleared; New logging starts
128128
//
129129
ISR (TIMER_INTR_NAME) {
130-
TIMER_RESET; // reset timer interrupt flag if required (currently only for Teensy and ATmega4809)
130+
TIMER_RESET_INTR_PENDING; // reset timer interrupt flag if required (currently only for Teensy and ATmega4809)
131131

132132
// Read if IR Receiver -> SPACE [xmt LED off] or a MARK [xmt LED on]
133133
// digitalRead() is very slow. Optimisation is possible, but makes the code unportable

src/irRecv.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -168,20 +168,19 @@ IRrecv::IRrecv(int recvpin, int blinkpin) {
168168
#ifdef USE_DEFAULT_ENABLE_IR_IN
169169
void IRrecv::enableIRIn() {
170170
// Interrupt Service Routine - Fires every 50uS
171-
cli();
171+
noInterrupts();
172172
// Setup pulse clock timer interrupt
173173
// Prescale /8 (16M/8 = 0.5 microseconds per tick)
174174
// Therefore, the timer interval can range from 0.5 to 128 microseconds
175175
// Depending on the reset value (255 to 0)
176-
timerConfigNormal();
176+
timerConfigForReceive();
177177

178178
// Timer2 Overflow Interrupt Enable
179-
TIMER_ENABLE_INTR;
179+
TIMER_ENABLE_RECEIVE_INTR;
180180

181-
TIMER_RESET;
181+
TIMER_RESET_INTR_PENDING;
182182

183-
sei();
184-
// enable interrupts
183+
interrupts();
185184

186185
// Initialize state machine variables
187186
irparams.rcvstate = IR_REC_STATE_IDLE;
@@ -192,10 +191,7 @@ void IRrecv::enableIRIn() {
192191
}
193192

194193
void IRrecv::disableIRIn() {
195-
cli();
196-
TIMER_DISABLE_INTR;
197-
sei();
198-
// enable interrupts
194+
TIMER_DISABLE_RECEIVE_INTR;
199195
}
200196

201197
#endif // USE_DEFAULT_ENABLE_IR_IN

src/irSend.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ void IRsend::mark(unsigned int time) {
8888
#elif defined(USE_NO_CARRIER)
8989
digitalWrite(sendPin, LOW); // Set output to active low.
9090
#else
91-
TIMER_ENABLE_PWM; // Enable pin 3 PWM output
91+
TIMER_ENABLE_SEND_PWM; // Enable pin 3 PWM output
9292
#endif
9393
if (time > 0) {
9494
custom_delay_usec(time);
@@ -104,7 +104,7 @@ void IRsend::space(unsigned int time) {
104104
#if defined(USE_NO_CARRIER)
105105
digitalWrite(sendPin, HIGH); // Set output to inactive high.
106106
#else
107-
TIMER_DISABLE_PWM; // Disable pin 3 PWM output
107+
TIMER_DISABLE_SEND_PWM; // Disable pin 3 PWM output
108108
#endif
109109
if (time > 0) {
110110
IRsend::custom_delay_usec(time);
@@ -135,13 +135,13 @@ void IRsend::enableIROut(int khz) {
135135
digitalWrite(sendPin, HIGH); // Set output to inactive high.
136136
#else
137137
// Disable the Timer2 Interrupt (which is used for receiving IR)
138-
TIMER_DISABLE_INTR; //Timer2 Overflow Interrupt
138+
TIMER_DISABLE_RECEIVE_INTR; //Timer2 Overflow Interrupt
139139

140140
pinMode(sendPin, OUTPUT);
141141

142142
SENDPIN_OFF(sendPin); // When not sending, we want it low
143143

144-
timerConfigkHz(khz);
144+
timerConfigForSend(khz);
145145
#endif
146146
}
147147
#endif

0 commit comments

Comments
 (0)