COSA
An Object-Oriented Platform for Arduino Programming
TCS230.hh
Go to the documentation of this file.
1 
21 #ifndef COSA_TCS320_HH
22 #define COSA_TCS320_HH
23 
24 #include "Cosa/OutputPin.hh"
26 
46 class TCS230 {
47 public:
52  enum Filter {
55  NO_FILTER = 2,
57  };
58 
69 #if !defined(BOARD_ATTINY)
75 #else
81 #endif
82 
88  void frequency_scaling(uint8_t percent);
89 
94  void photodiode(Filter type);
95 
102  uint16_t sample(uint8_t ms = 10);
103 
104 private:
105  class IRQPin : public ExternalInterrupt {
106  public:
107  static const uint16_t MAX = 10000;
108  IRQPin(Board::ExternalInterruptPin pin);
109  virtual void on_interrupt(uint16_t arg = 0);
110  friend class TCS230;
111  private:
112  uint16_t m_count;
113  };
114  IRQPin m_out;
115  OutputPin m_s0;
116  OutputPin m_s1;
117  OutputPin m_s2;
118  OutputPin m_s3;
119 };
120 
121 #endif
122 
123 
uint16_t sample(uint8_t ms=10)
Definition: TCS230.cpp:73
Definition: TCS230.hh:46
ExternalInterruptPin
Definition: ATmega1284P.hh:190
void photodiode(Filter type)
Definition: TCS230.cpp:38
void frequency_scaling(uint8_t percent)
Definition: TCS230.cpp:45
Filter
Definition: TCS230.hh:52
TCS230(Board::ExternalInterruptPin out=Board::EXT1, Board::DigitalPin s0=Board::D4, Board::DigitalPin s1=Board::D5, Board::DigitalPin s2=Board::D6, Board::DigitalPin s3=Board::D7)
Definition: TCS230.cpp:24