Infrared4Arduino
IrSender.h
Go to the documentation of this file.
1 /*
2 Copyright (C) 2015 Bengt Martensson.
3 
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3 of the License, or (at
7 your option) any later version.
8 
9 This program is distributed in the hope that it will be useful, but
10 WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 General Public License for more details.
13 
14 You should have received a copy of the GNU General Public License along with
15 this program. If not, see http://www.gnu.org/licenses/.
16 */
17 
18 #ifndef IRSENDER_H
19 #define IRSENDER_H
20 
21 #include "InfraredTypes.h"
22 #include "IrSignal.h"
23 
27 class IrSender {
28 private:
29  pin_t outputPin;
30 
31 protected:
32  pin_t getOutputPin() const {
33  return outputPin;
34  }
35  void delayUSecs(microseconds_t T);
36  IrSender();
37  IrSender(pin_t pin);
38 
39 public:
40  virtual ~IrSender();
41 
47  virtual void send(const IrSequence& irSequence, frequency_t frequency = IrSignal::defaultFrequency) = 0;
48 
57  void sendIrSignal(const IrSignal& irSignal, unsigned int noSends = 1);
58 
60  virtual void mute();
61 };
62 
63 #endif /* ! IRSENDER_H */
64 
static const frequency_t defaultFrequency
Definition: IrSignal.h:13
uint16_t microseconds_t
Type for durations in micro seconds.
Definition: InfraredTypes.h:16
uint8_t pin_t
Type for GPIO pin, compatible with Arduino libs.
Definition: InfraredTypes.h:40
This class models an IR signal with intro-, repeat-, and ending sequences.
Definition: IrSignal.h:11
Abstract base class for all sending classes.
Definition: IrSender.h:27
void delayUSecs(microseconds_t T)
Definition: IrSender.cpp:25
uint16_t frequency_t
Type for modulation frequency in Hz.
Definition: InfraredTypes.h:33
pin_t getOutputPin() const
Definition: IrSender.h:32
virtual void send(const IrSequence &irSequence, frequency_t frequency=IrSignal::defaultFrequency)=0
Sends an IrSequence with the prescribed frequency.
This class consists of a vector of durations.
Definition: IrSequence.h:12
This file defines some general data types that are used in the library.
virtual void mute()
Force output pin inactive.
Definition: IrSender.cpp:49
virtual ~IrSender()
Definition: IrSender.cpp:45
IrSender()
Definition: IrSender.cpp:35
void sendIrSignal(const IrSignal &irSignal, unsigned int noSends=1)
Sends the IrSignal given as argument the prescribed number of times.
Definition: IrSender.cpp:53