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.
Dependencies: USBDevice mbed FastAnalogIn FastIO FastPWM SimpleDMA
tls1410r.h@0:5acbbe3f4cf4, 2014-07-11 (annotated)
- Committer:
- mjr
- Date:
- Fri Jul 11 03:26:11 2014 +0000
- Revision:
- 0:5acbbe3f4cf4
Initial testing setup, before starting on real configuration
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| mjr | 0:5acbbe3f4cf4 | 1 | /* |
| mjr | 0:5acbbe3f4cf4 | 2 | * TLS1410R interface class. |
| mjr | 0:5acbbe3f4cf4 | 3 | * |
| mjr | 0:5acbbe3f4cf4 | 4 | * This provides a high-level interface for the Taos TLS1410R linear CCD array sensor. |
| mjr | 0:5acbbe3f4cf4 | 5 | */ |
| mjr | 0:5acbbe3f4cf4 | 6 | |
| mjr | 0:5acbbe3f4cf4 | 7 | #include "mbed.h" |
| mjr | 0:5acbbe3f4cf4 | 8 | |
| mjr | 0:5acbbe3f4cf4 | 9 | #ifndef TLS1410R_H |
| mjr | 0:5acbbe3f4cf4 | 10 | #define TLS1410R_H |
| mjr | 0:5acbbe3f4cf4 | 11 | |
| mjr | 0:5acbbe3f4cf4 | 12 | class TLS1410R |
| 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 | 0:5acbbe3f4cf4 | 17 | TLS1410R(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 | 0:5acbbe3f4cf4 | 41 | #endif /* TLS1410R_H */ |