A library with drivers for different peripherals on the LPC4088 QuickStart Board or related add-on boards.
Dependents: LPC4088test LPC4088test_ledonly LPC4088test_deleteall LPC4088_RAMtest ... more
AR1021.h@5:3290d7b766d5, 2013-10-18 (annotated)
- Committer:
- embeddedartists
- Date:
- Fri Oct 18 10:57:50 2013 +0000
- Revision:
- 5:3290d7b766d5
- Parent:
- 4:b32cf4ef45c5
- Child:
- 12:15597e45eea0
Corrected compiler warnings
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
embeddedartists | 4:b32cf4ef45c5 | 1 | |
embeddedartists | 4:b32cf4ef45c5 | 2 | #ifndef AR1021_H |
embeddedartists | 4:b32cf4ef45c5 | 3 | #define AR1021_H |
embeddedartists | 4:b32cf4ef45c5 | 4 | |
embeddedartists | 4:b32cf4ef45c5 | 5 | #include "TouchPanel.h" |
embeddedartists | 4:b32cf4ef45c5 | 6 | |
embeddedartists | 4:b32cf4ef45c5 | 7 | /** |
embeddedartists | 4:b32cf4ef45c5 | 8 | * Microchip Touch Screen Controller (AR1021). |
embeddedartists | 4:b32cf4ef45c5 | 9 | * |
embeddedartists | 4:b32cf4ef45c5 | 10 | * Please note that this touch panel has an on-board storage for |
embeddedartists | 4:b32cf4ef45c5 | 11 | * calibration data. Once a successful calibration has been performed |
embeddedartists | 4:b32cf4ef45c5 | 12 | * it is not needed to do additional calibrations since the stored |
embeddedartists | 4:b32cf4ef45c5 | 13 | * calibration data will be used. |
embeddedartists | 4:b32cf4ef45c5 | 14 | */ |
embeddedartists | 4:b32cf4ef45c5 | 15 | class AR1021 : public TouchPanel { |
embeddedartists | 4:b32cf4ef45c5 | 16 | public: |
embeddedartists | 4:b32cf4ef45c5 | 17 | |
embeddedartists | 4:b32cf4ef45c5 | 18 | |
embeddedartists | 4:b32cf4ef45c5 | 19 | /** |
embeddedartists | 4:b32cf4ef45c5 | 20 | * Constructor |
embeddedartists | 4:b32cf4ef45c5 | 21 | * |
embeddedartists | 4:b32cf4ef45c5 | 22 | * @param mosi SPI MOSI pin |
embeddedartists | 4:b32cf4ef45c5 | 23 | * @param miso SPI MISO pin |
embeddedartists | 4:b32cf4ef45c5 | 24 | * @param sck SPI SCK pin |
embeddedartists | 4:b32cf4ef45c5 | 25 | * @param cs chip-select pin |
embeddedartists | 4:b32cf4ef45c5 | 26 | * @param siq interrupt pin |
embeddedartists | 4:b32cf4ef45c5 | 27 | */ |
embeddedartists | 4:b32cf4ef45c5 | 28 | AR1021(PinName mosi, PinName miso, PinName sck, PinName cs, PinName siq); |
embeddedartists | 4:b32cf4ef45c5 | 29 | |
embeddedartists | 4:b32cf4ef45c5 | 30 | |
embeddedartists | 5:3290d7b766d5 | 31 | virtual bool init(uint16_t width, uint16_t height); |
embeddedartists | 5:3290d7b766d5 | 32 | virtual bool read(touchCoordinate_t &coord); |
embeddedartists | 5:3290d7b766d5 | 33 | virtual bool calibrateStart(); |
embeddedartists | 5:3290d7b766d5 | 34 | virtual bool getNextCalibratePoint(uint16_t* x, uint16_t* y); |
embeddedartists | 5:3290d7b766d5 | 35 | virtual bool waitForCalibratePoint(bool* morePoints, uint32_t timeout); |
embeddedartists | 4:b32cf4ef45c5 | 36 | |
embeddedartists | 4:b32cf4ef45c5 | 37 | private: |
embeddedartists | 4:b32cf4ef45c5 | 38 | |
embeddedartists | 4:b32cf4ef45c5 | 39 | |
embeddedartists | 4:b32cf4ef45c5 | 40 | SPI _spi; |
embeddedartists | 4:b32cf4ef45c5 | 41 | DigitalOut _cs; |
embeddedartists | 4:b32cf4ef45c5 | 42 | DigitalIn _siq; |
embeddedartists | 4:b32cf4ef45c5 | 43 | InterruptIn _siqIrq; |
embeddedartists | 4:b32cf4ef45c5 | 44 | bool _initialized; |
embeddedartists | 4:b32cf4ef45c5 | 45 | |
embeddedartists | 4:b32cf4ef45c5 | 46 | |
embeddedartists | 4:b32cf4ef45c5 | 47 | int32_t _x; |
embeddedartists | 4:b32cf4ef45c5 | 48 | int32_t _y; |
embeddedartists | 4:b32cf4ef45c5 | 49 | int32_t _pen; |
embeddedartists | 4:b32cf4ef45c5 | 50 | |
embeddedartists | 4:b32cf4ef45c5 | 51 | uint16_t _width; |
embeddedartists | 4:b32cf4ef45c5 | 52 | uint16_t _height; |
embeddedartists | 4:b32cf4ef45c5 | 53 | uint8_t _inset; |
embeddedartists | 4:b32cf4ef45c5 | 54 | |
embeddedartists | 4:b32cf4ef45c5 | 55 | int _calibPoint; |
embeddedartists | 4:b32cf4ef45c5 | 56 | |
embeddedartists | 4:b32cf4ef45c5 | 57 | |
embeddedartists | 4:b32cf4ef45c5 | 58 | int cmd(char cmd, char* data, int len, char* respBuf, int* respLen, bool setCsOff=true); |
embeddedartists | 4:b32cf4ef45c5 | 59 | int waitForCalibResponse(uint32_t timeout); |
embeddedartists | 4:b32cf4ef45c5 | 60 | void readTouchIrq(); |
embeddedartists | 4:b32cf4ef45c5 | 61 | |
embeddedartists | 4:b32cf4ef45c5 | 62 | |
embeddedartists | 4:b32cf4ef45c5 | 63 | }; |
embeddedartists | 4:b32cf4ef45c5 | 64 | |
embeddedartists | 4:b32cf4ef45c5 | 65 | #endif |