Infrared4Arduino
IrWidgetAggregating.h
Go to the documentation of this file.
1 // Copyright (c) 2012 Michael Dreher <michael(at)5dot1.de>
2 // this code may be distributed under the terms of the General Public License V2 (GPL V2)
3 
4 // This is a slight reorganization of the original code, by Bengt Martensson.
5 
6 #pragma once
7 
8 #if defined (DOXYGEN) || !defined(ARDUINO) || defined ARDUINO_ARCH_AVR
9 
10 #include "IrWidget.h"
11 
17 class IrWidgetAggregating : public IrWidget {
18 private:
19  static IrWidgetAggregating *instance;
21  }
22 
23 public:
24  void capture();
25  static void deleteInstance();
26 
28  return instance;
29  }
30 
32  bool pullup = false,
33  int16_t markExcess = defaultMarkExcess,
36 
37 protected:
38  IrWidgetAggregating(size_t captureLength = defaultCaptureLength,
39  bool pullup = false,
40  int16_t markExcess = defaultMarkExcess,
43 
44 private:
45  inline uint16_t packTimeVal/*Normal*/(uint32_t val) const {
46  if (val >= 0x8000) {
47  val = val >> (RANGE_EXTENSION_BITS + 1);
48  val |= 0x8000;
49  }
50 
51  return val;
52  }
53 
54  inline uint32_t unpackTimeVal/*Normal*/(uint32_t val) const {
55  if (val & 0x8000) {
56  val = (val & 0x7fff) << (RANGE_EXTENSION_BITS + 1);
57  }
58 
59  return val;
60  }
61 };
62 
63 #endif // ARDUINO_ARCH_AVR
static IrWidgetAggregating * newIrWidgetAggregating(size_t captureLength=defaultCaptureLength, bool pullup=false, int16_t markExcess=defaultMarkExcess, milliseconds_t beginningTimeout=defaultBeginningTimeout, milliseconds_t endingTimeout=defaultEndingTimeout)
static const milliseconds_t defaultBeginningTimeout
Definition: IrReader.h:33
static const milliseconds_t defaultEndingTimeout
Definition: IrReader.h:34
static const int16_t defaultMarkExcess
Definition: IrWidget.h:47
uint16_t milliseconds_t
Type for durations in milli seconds.
Definition: InfraredTypes.h:25
Base class for classes based upon ICP pins capture.
Definition: IrWidget.h:45
This class implements the IrWidget.
milliseconds_t beginningTimeout
Definition: IrReader.h:38
static const uint8_t RANGE_EXTENSION_BITS
Definition: IrWidget.h:131
static const size_t defaultCaptureLength
Definition: IrReader.h:35
ovlBitsDataType endingTimeout
Definition: IrWidget.h:133
static IrWidgetAggregating * getInstance()
int16_t markExcess
Microseconds subtracted from pulses and added to gaps.
Definition: IrReader.h:44