A library with drivers for different peripherals on the LPC4088 QuickStart Board or related add-on boards.
Fork of EALib by
Diff: AR1021.h
- Revision:
- 4:b32cf4ef45c5
- Child:
- 5:3290d7b766d5
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AR1021.h Fri Oct 18 12:48:58 2013 +0200 @@ -0,0 +1,65 @@ + +#ifndef AR1021_H +#define AR1021_H + +#include "TouchPanel.h" + +/** + * Microchip Touch Screen Controller (AR1021). + * + * Please note that this touch panel has an on-board storage for + * calibration data. Once a successful calibration has been performed + * it is not needed to do additional calibrations since the stored + * calibration data will be used. + */ +class AR1021 : public TouchPanel { +public: + + + /** + * Constructor + * + * @param mosi SPI MOSI pin + * @param miso SPI MISO pin + * @param sck SPI SCK pin + * @param cs chip-select pin + * @param siq interrupt pin + */ + AR1021(PinName mosi, PinName miso, PinName sck, PinName cs, PinName siq); + + + bool init(uint16_t width, uint16_t height); + bool read(touchCoordinate_t &coord); + bool calibrateStart(); + bool getNextCalibratePoint(uint16_t* x, uint16_t* y); + bool waitForCalibratePoint(bool* morePoints, uint32_t timeout); + +private: + + + SPI _spi; + DigitalOut _cs; + DigitalIn _siq; + InterruptIn _siqIrq; + bool _initialized; + + + int32_t _x; + int32_t _y; + int32_t _pen; + + uint16_t _width; + uint16_t _height; + uint8_t _inset; + + int _calibPoint; + + + int cmd(char cmd, char* data, int len, char* respBuf, int* respLen, bool setCsOff=true); + int waitForCalibResponse(uint32_t timeout); + void readTouchIrq(); + + +}; + +#endif