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 #ifndef IRWIDGETAGGREGATING_H
7 #define IRWIDGETAGGREGATING_H
8 
9 #include "IrWidget.h"
10 
16 class IrWidgetAggregating : public IrWidget {
17 private:
18  static IrWidgetAggregating *instance;
20  }
21 
22 public:
23  void capture();
24  static void deleteInstance();
25 
27  return instance;
28  }
29 
31  boolean pullup = false,
32  int16_t markExcess = defaultMarkExcess,
35 
36 protected:
37  IrWidgetAggregating(size_t captureLength = defaultCaptureLength,
38  boolean pullup = false,
39  int16_t markExcess = defaultMarkExcess,
42 
43 private:
44  inline uint16_t packTimeVal/*Normal*/(uint32_t val) const {
45  if (val >= 0x8000) {
46  val = val >> (RANGE_EXTENSION_BITS + 1);
47  val |= 0x8000;
48  }
49 
50  return val;
51  }
52 
53  inline uint32_t unpackTimeVal/*Normal*/(uint32_t val) const {
54  if (val & 0x8000) {
55  val = (val & 0x7fff) << (RANGE_EXTENSION_BITS + 1);
56  }
57 
58  return val;
59  }
60 };
61 
62 #endif /* IRWIDGETAGGREGATING_H */
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:46
uint16_t milliseconds_t
Type for durations in milli seconds.
Definition: InfraredTypes.h:26
Base class for classes based upon ICP pins capture.
Definition: IrWidget.h:44
This class implements the IrWidget.
static IrWidgetAggregating * newIrWidgetAggregating(size_t captureLength=defaultCaptureLength, boolean pullup=false, int16_t markExcess=defaultMarkExcess, milliseconds_t beginningTimeout=defaultBeginningTimeout, milliseconds_t endingTimeout=defaultEndingTimeout)
milliseconds_t beginningTimeout
Definition: IrReader.h:38
static const uint8_t RANGE_EXTENSION_BITS
Definition: IrWidget.h:126
static const size_t defaultCaptureLength
Definition: IrReader.h:35
ovlBitsDataType endingTimeout
Definition: IrWidget.h:129
static IrWidgetAggregating * getInstance()
int16_t markExcess
Microseconds subtracted from pulses and added to gaps.
Definition: IrReader.h:44