COSA
An Object-Oriented Platform for Arduino Programming
|
#include <TCS230.hh>
Public Types | |
enum | Filter { RED_FILTER = 0, BLUE_FILTER = 1, NO_FILTER = 2, GREEN_FILTER = 3 } |
Public Member Functions | |
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) | |
void | frequency_scaling (uint8_t percent) |
void | photodiode (Filter type) |
uint16_t | sample (uint8_t ms=10) |
Cosa Device Driver for TCS230 Programmable Color Light-to-Frequency Converter.
enum TCS230::Filter |
TCS230::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 |
||
) |
Construct TCS230 device driver with given device output pin and selectable option, output frequency scaling and photodiode type, pins. The default setting is 20% scaling and GREEN.
[in] | out | device data pulse output (default EXT1). |
[in] | s0 | frequency scaling option bit0 (default D4). |
[in] | s1 | frequency scaling option bit1 (default D5). |
[in] | s2 | photodiode type option bit0 (default D6). |
[in] | s3 | photodiode type option bit0 (default D7). |
Definition at line 24 of file TCS230.cpp.
void TCS230::frequency_scaling | ( | uint8_t | percent | ) |
Set output frequency scaling (f0). Power-down (0%), 2%, 20% and 100% levels.
[in] | percent | output frequency scaling. |
Definition at line 45 of file TCS230.cpp.
void TCS230::photodiode | ( | Filter | type | ) |
Set photodiode filter type (RED, GREEN, BLUE or NO_FILTER).
[in] | type | of color filter. |
Definition at line 38 of file TCS230.cpp.
uint16_t TCS230::sample | ( | uint8_t | ms = 10 | ) |
Collect generated pulses for the given time-period with the current output frequency scaling and photodiode type. Return number of pulses or UINT16_MAX if over-flow.
Definition at line 73 of file TCS230.cpp.