COSA
An Object-Oriented Platform for Arduino Programming
AnalogPins.hh
Go to the documentation of this file.
1 
21 #ifndef COSA_ANALOG_PINS_HH
22 #define COSA_ANALOG_PINS_HH
23 
24 #include "Cosa/AnalogPin.hh"
25 
30 class AnalogPins : private AnalogPin {
31 public:
42  uint16_t* buffer, uint8_t count,
44  AnalogPin((Board::AnalogPin) 255, ref),
45  m_pin_at(pins),
46  m_buffer(buffer),
47  m_count(count),
48  m_next(0)
49  {
50  }
51 
56  uint8_t count() const
57  {
58  return (m_count);
59  }
60 
66  Board::AnalogPin pin_at(uint8_t ix) const
67  {
68  return ((Board::AnalogPin) (ix < m_count ?
69  pgm_read_byte(&m_pin_at[ix]) :
70  0));
71  }
72 
76  bool samples_request();
77 
83  virtual void on_interrupt(uint16_t arg);
84 
91  virtual void on_event(uint8_t type, uint16_t value)
92  {
93  UNUSED(type);
94  UNUSED(value);
95  }
96 
97 private:
98  const Board::AnalogPin* m_pin_at;
99  uint16_t* m_buffer;
100  uint8_t m_count;
101  uint8_t m_next;
102 };
103 
104 #endif
uint8_t count() const
Definition: AnalogPins.hh:56
virtual void on_interrupt(uint16_t arg)
Definition: AnalogPins.cpp:31
#define UNUSED(x)
Definition: ATmega328P.hh:31
bool samples_request()
Definition: AnalogPins.cpp:24
AnalogPins(const Board::AnalogPin *pins, uint16_t *buffer, uint8_t count, Board::Reference ref=Board::AVCC_REFERENCE)
Definition: AnalogPins.hh:41
Board::AnalogPin pin_at(uint8_t ix) const
Definition: AnalogPins.hh:66
virtual void on_event(uint8_t type, uint16_t value)
Definition: AnalogPins.hh:91
uint16_t value() const
Definition: AnalogPin.hh:79