Infrared4Arduino 1.2.3
Loading...
Searching...
No Matches
IrSenderNonMod.cpp
Go to the documentation of this file.
1/*
2Copyright (C) 2015 Bengt Martensson.
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation; either version 2 of the License, or (at
7your option) any later version.
8
9This program is distributed in the hope that it will be useful, but
10WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12General Public License for more details.
13
14You should have received a copy of the GNU General Public License along with
15this program. If not, see http://www.gnu.org/licenses/.
16*/
17
18#include "IrSenderNonMod.h"
19
20IrSenderNonMod::IrSenderNonMod(pin_t pin, bool _invert) : IrSender(pin),invert(_invert) {
21}
22
23void IrSenderNonMod::sendNonModulated(const IrSequence& irSequence, unsigned int times) {
24 for (unsigned int i = 0; i < times; i++)
25 send(irSequence);
26}
27
28void IrSenderNonMod::sendSpace(microseconds_t time) {
29 if (invert)
30 writeHigh();
31 else
32 writeLow();
34}
35
36void IrSenderNonMod::sendMark(microseconds_t time) {
37 if (invert)
38 writeLow();
39 else
40 writeHigh();
42}
uint16_t microseconds_t
Type for durations in micro seconds.
Definition: InfraredTypes.h:15
uint8_t pin_t
Type for GPIO pin, compatible with Arduino libs.
Definition: InfraredTypes.h:41
static void delayMicroseconds(microseconds_t)
Version of delayMicroseconds able to grok more than 16383 micros.
Definition: Board.cpp:25
void sendNonModulated(const IrSequence &irSequence, unsigned int times=1U)
Sends the IrSequence as argument.
IrSenderNonMod(pin_t pin, bool invert=false)
Abstract base class for all sending classes.
Definition: IrSender.h:27
void writeLow()
Definition: IrSender.h:39
void writeHigh()
Definition: IrSender.h:38
virtual void send(const IrSequence &irSequence, frequency_t frequency=IrSignal::defaultFrequency, dutycycle_t dutyCycle=Board::defaultDutyCycle)
Sends an IrSequence with the prescribed frequency.
Definition: IrSender.cpp:57
This class consists of a vector of durations.
Definition: IrSequence.h:11