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
00001 /* 00002 * Copyright 2013 Embedded Artists AB 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 #ifndef AR1021_H 00018 #define AR1021_H 00019 00020 #include "TouchPanel.h" 00021 00022 /** 00023 * Microchip Touch Screen Controller (AR1021). 00024 * 00025 * Please note that this touch panel has an on-board storage for 00026 * calibration data. Once a successful calibration has been performed 00027 * it is not needed to do additional calibrations since the stored 00028 * calibration data will be used. 00029 */ 00030 class AR1021 : public TouchPanel { 00031 public: 00032 00033 00034 /** 00035 * Constructor 00036 * 00037 * @param mosi SPI MOSI pin 00038 * @param miso SPI MISO pin 00039 * @param sck SPI SCK pin 00040 * @param cs chip-select pin 00041 * @param siq interrupt pin 00042 */ 00043 AR1021(PinName mosi, PinName miso, PinName sck, PinName cs, PinName siq); 00044 00045 00046 virtual bool init(uint16_t width, uint16_t height); 00047 virtual bool read(touchCoordinate_t &coord); 00048 virtual bool calibrateStart(); 00049 virtual bool getNextCalibratePoint(uint16_t* x, uint16_t* y); 00050 virtual bool waitForCalibratePoint(bool* morePoints, uint32_t timeout); 00051 00052 private: 00053 00054 00055 SPI _spi; 00056 DigitalOut _cs; 00057 DigitalIn _siq; 00058 InterruptIn _siqIrq; 00059 bool _initialized; 00060 00061 00062 int32_t _x; 00063 int32_t _y; 00064 int32_t _pen; 00065 00066 uint16_t _width; 00067 uint16_t _height; 00068 uint8_t _inset; 00069 00070 int _calibPoint; 00071 00072 00073 int cmd(char cmd, char* data, int len, char* respBuf, int* respLen, bool setCsOff=true); 00074 int waitForCalibResponse(uint32_t timeout); 00075 void readTouchIrq(); 00076 00077 00078 }; 00079 00080 #endif
Generated on Fri Jul 15 2022 02:16:08 by 1.7.2