Infrared4Arduino
IrSenderPwm.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 IRSENDERPWM_H
19 #define IRSENDERPWM_H
20 
21 #include <Arduino.h>
22 #include "IrSender.h"
23 
29 class IrSenderPwm : public IrSender {
30 private:
31  IrSenderPwm();
32  ~IrSenderPwm() {}
33  static IrSenderPwm *instance;
34  void enable(unsigned char khz);
35 
36 public:
41  static IrSenderPwm *getInstance(boolean create = false);
42 
47  static IrSenderPwm *newInstance();
48 
49  static void deleteInstance() {
50  delete instance;
51  instance = NULL;
52  }
53 
54  void send(const IrSequence& sequence, frequency_t frequency = IrSignal::defaultFrequency);
55 };
56 
57 #endif /* IRSENDERPWM_H */
58 
static const frequency_t defaultFrequency
Definition: IrSignal.h:13
static IrSenderPwm * getInstance(boolean create=false)
Returns a pointer to the instance, or NULL if not initialized.
Definition: IrSenderPwm.cpp:48
Abstract base class for all sending classes.
Definition: IrSender.h:27
uint16_t frequency_t
Type for modulation frequency in Hz.
Definition: InfraredTypes.h:33
Sending function using timer PWM.
Definition: IrSenderPwm.h:29
This class consists of a vector of durations.
Definition: IrSequence.h:12
static void deleteInstance()
Definition: IrSenderPwm.h:49
static IrSenderPwm * newInstance()
Creates a new instance (if not existing) and returns it.
Definition: IrSenderPwm.cpp:41
void send(const IrSequence &sequence, frequency_t frequency=IrSignal::defaultFrequency)
Sends an IrSequence with the prescribed frequency.
Definition: IrSenderPwm.cpp:27