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 2 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 #pragma once
19 
20 #include <Arduino.h>
21 #include "IrSender.h"
22 
28 class IrSenderPwm : public IrSender {
29 private:
30  IrSenderPwm();
31  ~IrSenderPwm() {}
32  static IrSenderPwm *instance;
33  void enable(unsigned char khz);
34 
35 public:
40  static IrSenderPwm *getInstance(bool create = false);
41 
46  static IrSenderPwm *newInstance();
47 
48  static void deleteInstance() {
49  delete instance;
50  instance = NULL;
51  }
52 
53  void send(const IrSequence& sequence, frequency_t frequency = IrSignal::defaultFrequency);
54 };
static const frequency_t defaultFrequency
Definition: IrSignal.h:12
uint32_t frequency_t
Type for modulation frequency in Hz.
Definition: InfraredTypes.h:32
Abstract base class for all sending classes.
Definition: IrSender.h:26
Sending function using timer PWM.
Definition: IrSenderPwm.h:28
This class consists of a vector of durations.
Definition: IrSequence.h:11
static void deleteInstance()
Definition: IrSenderPwm.h:48
static IrSenderPwm * getInstance(bool create=false)
Returns a pointer to the instance, or NULL if not initialized.
Definition: IrSenderPwm.cpp:48
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