Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Pinscape_Controller by
tsl1410r.h@1:d913e0afb2ac, 2014-07-16 (annotated)
- Committer:
- mjr
- Date:
- Wed Jul 16 23:33:12 2014 +0000
- Revision:
- 1:d913e0afb2ac
- Parent:
- tls1410r.h@0:5acbbe3f4cf4
Before removing time/frequency limit on reading the plunger sensor
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| mjr | 0:5acbbe3f4cf4 | 1 | /* |
| mjr | 1:d913e0afb2ac | 2 | * TSL1410R interface class. |
| mjr | 0:5acbbe3f4cf4 | 3 | * |
| mjr | 1:d913e0afb2ac | 4 | * This provides a high-level interface for the Taos TSL1410R linear CCD array sensor. |
| mjr | 0:5acbbe3f4cf4 | 5 | */ |
| mjr | 0:5acbbe3f4cf4 | 6 | |
| mjr | 0:5acbbe3f4cf4 | 7 | #include "mbed.h" |
| mjr | 0:5acbbe3f4cf4 | 8 | |
| mjr | 1:d913e0afb2ac | 9 | #ifndef TSL1410R_H |
| mjr | 1:d913e0afb2ac | 10 | #define TSL1410R_H |
| mjr | 0:5acbbe3f4cf4 | 11 | |
| mjr | 1:d913e0afb2ac | 12 | class TSL1410R |
| mjr | 0:5acbbe3f4cf4 | 13 | { |
| mjr | 0:5acbbe3f4cf4 | 14 | public: |
| mjr | 0:5acbbe3f4cf4 | 15 | // set up with the two DigitalOut ports (SI and clock), and the |
| mjr | 0:5acbbe3f4cf4 | 16 | // analog in port for reading the currently selected pixel value |
| mjr | 1:d913e0afb2ac | 17 | TSL1410R(PinName siPort, PinName clockPort, PinName aoPort); |
| mjr | 0:5acbbe3f4cf4 | 18 | |
| mjr | 0:5acbbe3f4cf4 | 19 | // Integrate light and read the pixels. Fills in pix[] with the pixel values, |
| mjr | 0:5acbbe3f4cf4 | 20 | // scaled 0-0xffff. n is the number of pixels to read; if this is less than |
| mjr | 0:5acbbe3f4cf4 | 21 | // the total number of pixels npix, we'll read every mth pixel, where m = npix/n. |
| mjr | 0:5acbbe3f4cf4 | 22 | // E.g., if you want 640 pixels out of 1280 on the sensor, we'll read every |
| mjr | 0:5acbbe3f4cf4 | 23 | // other pixel. If you want 320, we'll read every fourth pixel. |
| mjr | 0:5acbbe3f4cf4 | 24 | // Before reading, we'll pause for integrate_us additional microseconds during |
| mjr | 0:5acbbe3f4cf4 | 25 | // the integration phase; use 0 for no additional integration time. |
| mjr | 0:5acbbe3f4cf4 | 26 | void read(uint16_t *pix, int n, int integrate_us); |
| mjr | 0:5acbbe3f4cf4 | 27 | |
| mjr | 0:5acbbe3f4cf4 | 28 | // clock through all pixels to clear the array |
| mjr | 0:5acbbe3f4cf4 | 29 | void clear(); |
| mjr | 0:5acbbe3f4cf4 | 30 | |
| mjr | 0:5acbbe3f4cf4 | 31 | // number of pixels in the array |
| mjr | 0:5acbbe3f4cf4 | 32 | static const int nPix = 1280; |
| mjr | 0:5acbbe3f4cf4 | 33 | |
| mjr | 0:5acbbe3f4cf4 | 34 | |
| mjr | 0:5acbbe3f4cf4 | 35 | private: |
| mjr | 0:5acbbe3f4cf4 | 36 | DigitalOut si; |
| mjr | 0:5acbbe3f4cf4 | 37 | DigitalOut clock; |
| mjr | 0:5acbbe3f4cf4 | 38 | AnalogIn ao; |
| mjr | 0:5acbbe3f4cf4 | 39 | }; |
| mjr | 0:5acbbe3f4cf4 | 40 | |
| mjr | 1:d913e0afb2ac | 41 | #endif /* TSL1410R_H */ |
