Dependents:   nhk2018_throwing02 nhk_2018_undercarry_test08 nhk_2018_undercarry_test09 nhk_2018_undercarry_test10 ... more

Fork of TCS3200 by Grant Phillips

Committer:
kenken0721
Date:
Thu Mar 22 13:10:24 2018 +0000
Revision:
1:40b638b93be8
Parent:
0:b98e768bc655
Child:
2:78984c66a877

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
grantphillips 0:b98e768bc655 1
grantphillips 0:b98e768bc655 2 #ifndef TCS3200_H
grantphillips 0:b98e768bc655 3 #define TCS3200_H
grantphillips 0:b98e768bc655 4
grantphillips 0:b98e768bc655 5 #include "mbed.h"
grantphillips 0:b98e768bc655 6
grantphillips 0:b98e768bc655 7 class TCS3200 {
kenken0721 1:40b638b93be8 8 public:
grantphillips 0:b98e768bc655 9 /** Create a TCS3200 object connected to the specified pins.
grantphillips 0:b98e768bc655 10 * @param S0 Frequency scaling output pin S0
grantphillips 0:b98e768bc655 11 * @param S1 Frequency scaling output pin S1
grantphillips 0:b98e768bc655 12 * @param S2 Photo diode selection output pin S2
grantphillips 0:b98e768bc655 13 * @param S3 Photo diode selection output pin S3
grantphillips 0:b98e768bc655 14 * @param OUT Frequency input pin
grantphillips 0:b98e768bc655 15 */
kenken0721 1:40b638b93be8 16 TCS3200(PinName S2, PinName S3, PinName OUT);
grantphillips 0:b98e768bc655 17
grantphillips 0:b98e768bc655 18 /** Reads the output signal's HIGH pulse for RED.
grantphillips 0:b98e768bc655 19 * @param
grantphillips 0:b98e768bc655 20 * None
grantphillips 0:b98e768bc655 21 * @return
grantphillips 0:b98e768bc655 22 * Duration as nanoseconds (ns).
grantphillips 0:b98e768bc655 23 */
grantphillips 0:b98e768bc655 24 long ReadRed();
grantphillips 0:b98e768bc655 25
grantphillips 0:b98e768bc655 26 /** Reads the output signal's HIGH pulse for GREEN.
grantphillips 0:b98e768bc655 27 * @param
grantphillips 0:b98e768bc655 28 * None
grantphillips 0:b98e768bc655 29 * @return
grantphillips 0:b98e768bc655 30 * Duration as nanoseconds (ns).
grantphillips 0:b98e768bc655 31 */
grantphillips 0:b98e768bc655 32 long ReadGreen();
grantphillips 0:b98e768bc655 33
grantphillips 0:b98e768bc655 34 /** Reads the output signal's HIGH pulse for BLUE.
grantphillips 0:b98e768bc655 35 * @param
grantphillips 0:b98e768bc655 36 * None
grantphillips 0:b98e768bc655 37 * @return
grantphillips 0:b98e768bc655 38 * Duration as nanoseconds (ns).
grantphillips 0:b98e768bc655 39 */
grantphillips 0:b98e768bc655 40 long ReadBlue();
grantphillips 0:b98e768bc655 41
grantphillips 0:b98e768bc655 42 /** Reads the output signal's HIGH pulse for CLEAR.
grantphillips 0:b98e768bc655 43 * @param
grantphillips 0:b98e768bc655 44 * None
grantphillips 0:b98e768bc655 45 * @return
grantphillips 0:b98e768bc655 46 * Duration as nanoseconds (ns).
grantphillips 0:b98e768bc655 47 */
grantphillips 0:b98e768bc655 48 long ReadClear();
grantphillips 0:b98e768bc655 49
grantphillips 0:b98e768bc655 50 /** Sets the mode of operation.
grantphillips 0:b98e768bc655 51 * @param
grantphillips 0:b98e768bc655 52 * mode POWERDOWN, SCALE_2 (2% scaling), SCALE_20 (20% scaling), SCALE_100 (100% scaling).
grantphillips 0:b98e768bc655 53 * @return
grantphillips 0:b98e768bc655 54 * None
grantphillips 0:b98e768bc655 55 */
grantphillips 0:b98e768bc655 56
grantphillips 0:b98e768bc655 57 private:
grantphillips 0:b98e768bc655 58 DigitalOut mS2;
grantphillips 0:b98e768bc655 59 DigitalOut mS3;
grantphillips 0:b98e768bc655 60 InterruptIn signal;
grantphillips 0:b98e768bc655 61 Timer timer;
grantphillips 0:b98e768bc655 62 long pulsewidth;
grantphillips 0:b98e768bc655 63 void HighTrigger();
grantphillips 0:b98e768bc655 64 void LowTrigger();
grantphillips 0:b98e768bc655 65 };
grantphillips 0:b98e768bc655 66
grantphillips 0:b98e768bc655 67 #endif