A library with drivers for different peripherals on the LPC4088 QuickStart Board or related add-on boards.
Dependencies: FATFileSystem
Fork of EALib by
AR1021.h@13:64f3dd338612, 2014-03-27 (annotated)
- Committer:
- koiamk
- Date:
- Thu Mar 27 22:43:39 2014 +0000
- Revision:
- 13:64f3dd338612
- Parent:
- 12:15597e45eea0
o;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
embeddedartists | 12:15597e45eea0 | 1 | /* |
embeddedartists | 12:15597e45eea0 | 2 | * Copyright 2013 Embedded Artists AB |
embeddedartists | 12:15597e45eea0 | 3 | * |
embeddedartists | 12:15597e45eea0 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
embeddedartists | 12:15597e45eea0 | 5 | * you may not use this file except in compliance with the License. |
embeddedartists | 12:15597e45eea0 | 6 | * You may obtain a copy of the License at |
embeddedartists | 12:15597e45eea0 | 7 | * |
embeddedartists | 12:15597e45eea0 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
embeddedartists | 12:15597e45eea0 | 9 | * |
embeddedartists | 12:15597e45eea0 | 10 | * Unless required by applicable law or agreed to in writing, software |
embeddedartists | 12:15597e45eea0 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
embeddedartists | 12:15597e45eea0 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
embeddedartists | 12:15597e45eea0 | 13 | * See the License for the specific language governing permissions and |
embeddedartists | 12:15597e45eea0 | 14 | * limitations under the License. |
embeddedartists | 12:15597e45eea0 | 15 | */ |
embeddedartists | 4:b32cf4ef45c5 | 16 | |
embeddedartists | 4:b32cf4ef45c5 | 17 | #ifndef AR1021_H |
embeddedartists | 4:b32cf4ef45c5 | 18 | #define AR1021_H |
embeddedartists | 4:b32cf4ef45c5 | 19 | |
embeddedartists | 4:b32cf4ef45c5 | 20 | #include "TouchPanel.h" |
embeddedartists | 4:b32cf4ef45c5 | 21 | |
embeddedartists | 4:b32cf4ef45c5 | 22 | /** |
embeddedartists | 4:b32cf4ef45c5 | 23 | * Microchip Touch Screen Controller (AR1021). |
embeddedartists | 4:b32cf4ef45c5 | 24 | * |
embeddedartists | 4:b32cf4ef45c5 | 25 | * Please note that this touch panel has an on-board storage for |
embeddedartists | 4:b32cf4ef45c5 | 26 | * calibration data. Once a successful calibration has been performed |
embeddedartists | 4:b32cf4ef45c5 | 27 | * it is not needed to do additional calibrations since the stored |
embeddedartists | 4:b32cf4ef45c5 | 28 | * calibration data will be used. |
embeddedartists | 4:b32cf4ef45c5 | 29 | */ |
embeddedartists | 4:b32cf4ef45c5 | 30 | class AR1021 : public TouchPanel { |
embeddedartists | 4:b32cf4ef45c5 | 31 | public: |
embeddedartists | 4:b32cf4ef45c5 | 32 | |
embeddedartists | 4:b32cf4ef45c5 | 33 | |
embeddedartists | 4:b32cf4ef45c5 | 34 | /** |
embeddedartists | 4:b32cf4ef45c5 | 35 | * Constructor |
embeddedartists | 4:b32cf4ef45c5 | 36 | * |
embeddedartists | 4:b32cf4ef45c5 | 37 | * @param mosi SPI MOSI pin |
embeddedartists | 4:b32cf4ef45c5 | 38 | * @param miso SPI MISO pin |
embeddedartists | 4:b32cf4ef45c5 | 39 | * @param sck SPI SCK pin |
embeddedartists | 4:b32cf4ef45c5 | 40 | * @param cs chip-select pin |
embeddedartists | 4:b32cf4ef45c5 | 41 | * @param siq interrupt pin |
embeddedartists | 4:b32cf4ef45c5 | 42 | */ |
embeddedartists | 4:b32cf4ef45c5 | 43 | AR1021(PinName mosi, PinName miso, PinName sck, PinName cs, PinName siq); |
embeddedartists | 4:b32cf4ef45c5 | 44 | |
embeddedartists | 4:b32cf4ef45c5 | 45 | |
embeddedartists | 5:3290d7b766d5 | 46 | virtual bool init(uint16_t width, uint16_t height); |
embeddedartists | 5:3290d7b766d5 | 47 | virtual bool read(touchCoordinate_t &coord); |
embeddedartists | 5:3290d7b766d5 | 48 | virtual bool calibrateStart(); |
embeddedartists | 5:3290d7b766d5 | 49 | virtual bool getNextCalibratePoint(uint16_t* x, uint16_t* y); |
embeddedartists | 5:3290d7b766d5 | 50 | virtual bool waitForCalibratePoint(bool* morePoints, uint32_t timeout); |
embeddedartists | 4:b32cf4ef45c5 | 51 | |
embeddedartists | 4:b32cf4ef45c5 | 52 | private: |
embeddedartists | 4:b32cf4ef45c5 | 53 | |
embeddedartists | 4:b32cf4ef45c5 | 54 | |
embeddedartists | 4:b32cf4ef45c5 | 55 | SPI _spi; |
embeddedartists | 4:b32cf4ef45c5 | 56 | DigitalOut _cs; |
embeddedartists | 4:b32cf4ef45c5 | 57 | DigitalIn _siq; |
embeddedartists | 4:b32cf4ef45c5 | 58 | InterruptIn _siqIrq; |
embeddedartists | 4:b32cf4ef45c5 | 59 | bool _initialized; |
embeddedartists | 4:b32cf4ef45c5 | 60 | |
embeddedartists | 4:b32cf4ef45c5 | 61 | |
embeddedartists | 4:b32cf4ef45c5 | 62 | int32_t _x; |
embeddedartists | 4:b32cf4ef45c5 | 63 | int32_t _y; |
embeddedartists | 4:b32cf4ef45c5 | 64 | int32_t _pen; |
embeddedartists | 4:b32cf4ef45c5 | 65 | |
embeddedartists | 4:b32cf4ef45c5 | 66 | uint16_t _width; |
embeddedartists | 4:b32cf4ef45c5 | 67 | uint16_t _height; |
embeddedartists | 4:b32cf4ef45c5 | 68 | uint8_t _inset; |
embeddedartists | 4:b32cf4ef45c5 | 69 | |
embeddedartists | 4:b32cf4ef45c5 | 70 | int _calibPoint; |
embeddedartists | 4:b32cf4ef45c5 | 71 | |
embeddedartists | 4:b32cf4ef45c5 | 72 | |
embeddedartists | 4:b32cf4ef45c5 | 73 | int cmd(char cmd, char* data, int len, char* respBuf, int* respLen, bool setCsOff=true); |
embeddedartists | 4:b32cf4ef45c5 | 74 | int waitForCalibResponse(uint32_t timeout); |
embeddedartists | 4:b32cf4ef45c5 | 75 | void readTouchIrq(); |
embeddedartists | 4:b32cf4ef45c5 | 76 | |
embeddedartists | 4:b32cf4ef45c5 | 77 | |
embeddedartists | 4:b32cf4ef45c5 | 78 | }; |
embeddedartists | 4:b32cf4ef45c5 | 79 | |
embeddedartists | 4:b32cf4ef45c5 | 80 | #endif |