COSA
An Object-Oriented Platform for Arduino Programming
Touch.hh
Go to the documentation of this file.
1 
21 #ifndef COSA_TOUCH_HH
22 #define COSA_TOUCH_HH
23 
24 #include "Cosa/Types.h"
25 #include "Cosa/IOPin.hh"
26 #include "Cosa/Periodic.hh"
27 
43 class Touch : private IOPin, public Periodic {
44 public:
51  Touch(Job::Scheduler* scheduler, Board::DigitalPin pin, uint16_t threshold = 250);
52 
57  virtual void on_touch() = 0;
58 
59 protected:
61  static const uint16_t SAMPLE_RATE = 16;
62 
64  const uint16_t THRESHOLD;
65 
67  uint32_t m_start;
68 
70  uint8_t m_sampling;
71 
73  uint8_t m_touched;
74 
80  virtual void run();
81 };
82 
83 #endif
uint8_t m_touched
Definition: Touch.hh:73
uint8_t pin() const
Definition: Pin.hh:103
Touch(Job::Scheduler *scheduler, Board::DigitalPin pin, uint16_t threshold=250)
Definition: Touch.cpp:24
uint32_t m_start
Definition: Touch.hh:67
virtual void on_touch()=0
static const uint16_t SAMPLE_RATE
Definition: Touch.hh:61
virtual void run()
Definition: Touch.cpp:36
Definition: IOPin.hh:29
const uint16_t THRESHOLD
Definition: Touch.hh:64
Definition: Touch.hh:43
uint8_t m_sampling
Definition: Touch.hh:70