Production Test Program (PTP) for the LPC4088 Experiment Base Board

Dependencies:   EALib I2S LM75B SDFileSystem mbed

Committer:
embeddedartists
Date:
Wed Oct 01 11:16:38 2014 +0000
Revision:
9:eb6086159020
Parent:
1:47680ec5d783
Updated used libraries

Who changed what in which revision?

UserRevisionLine numberNew contents of line
embeddedartists 1:47680ec5d783 1 /*
embeddedartists 1:47680ec5d783 2 * Copyright 2013 Embedded Artists AB
embeddedartists 1:47680ec5d783 3 *
embeddedartists 1:47680ec5d783 4 * Licensed under the Apache License, Version 2.0 (the "License");
embeddedartists 1:47680ec5d783 5 * you may not use this file except in compliance with the License.
embeddedartists 1:47680ec5d783 6 * You may obtain a copy of the License at
embeddedartists 1:47680ec5d783 7 *
embeddedartists 1:47680ec5d783 8 * http://www.apache.org/licenses/LICENSE-2.0
embeddedartists 1:47680ec5d783 9 *
embeddedartists 1:47680ec5d783 10 * Unless required by applicable law or agreed to in writing, software
embeddedartists 1:47680ec5d783 11 * distributed under the License is distributed on an "AS IS" BASIS,
embeddedartists 1:47680ec5d783 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
embeddedartists 1:47680ec5d783 13 * See the License for the specific language governing permissions and
embeddedartists 1:47680ec5d783 14 * limitations under the License.
embeddedartists 1:47680ec5d783 15 */
embeddedartists 1:47680ec5d783 16
embeddedartists 1:47680ec5d783 17 #ifndef AR1021I2C_H
embeddedartists 1:47680ec5d783 18 #define AR1021I2C_H
embeddedartists 1:47680ec5d783 19
embeddedartists 1:47680ec5d783 20 #include "TouchPanel.h"
embeddedartists 1:47680ec5d783 21
embeddedartists 1:47680ec5d783 22 /**
embeddedartists 1:47680ec5d783 23 * Microchip Touch Screen Controller (AR1021).
embeddedartists 1:47680ec5d783 24 *
embeddedartists 1:47680ec5d783 25 * Please note that this touch panel has an on-board storage for
embeddedartists 1:47680ec5d783 26 * calibration data. Once a successful calibration has been performed
embeddedartists 1:47680ec5d783 27 * it is not needed to do additional calibrations since the stored
embeddedartists 1:47680ec5d783 28 * calibration data will be used.
embeddedartists 1:47680ec5d783 29 */
embeddedartists 1:47680ec5d783 30 class AR1021I2C : public TouchPanel {
embeddedartists 1:47680ec5d783 31 public:
embeddedartists 1:47680ec5d783 32
embeddedartists 1:47680ec5d783 33
embeddedartists 1:47680ec5d783 34 /**
embeddedartists 1:47680ec5d783 35 * Constructor
embeddedartists 1:47680ec5d783 36 *
embeddedartists 1:47680ec5d783 37 * @param mosi I2C SDA pin
embeddedartists 1:47680ec5d783 38 * @param miso I2C SCL pin
embeddedartists 1:47680ec5d783 39 * @param siq interrupt pin
embeddedartists 1:47680ec5d783 40 */
embeddedartists 1:47680ec5d783 41 AR1021I2C(PinName sda, PinName scl, PinName siq);
embeddedartists 1:47680ec5d783 42
embeddedartists 1:47680ec5d783 43 bool info(int* verHigh, int* verLow, int* resBits, int* type);
embeddedartists 1:47680ec5d783 44
embeddedartists 1:47680ec5d783 45 virtual bool init(uint16_t width, uint16_t height);
embeddedartists 1:47680ec5d783 46 virtual bool read(touchCoordinate_t &coord);
embeddedartists 1:47680ec5d783 47 virtual bool calibrateStart();
embeddedartists 1:47680ec5d783 48 virtual bool getNextCalibratePoint(uint16_t* x, uint16_t* y);
embeddedartists 1:47680ec5d783 49 virtual bool waitForCalibratePoint(bool* morePoints, uint32_t timeout);
embeddedartists 1:47680ec5d783 50
embeddedartists 1:47680ec5d783 51 private:
embeddedartists 1:47680ec5d783 52
embeddedartists 1:47680ec5d783 53
embeddedartists 1:47680ec5d783 54 I2C _i2c;
embeddedartists 1:47680ec5d783 55 DigitalIn _siq;
embeddedartists 1:47680ec5d783 56 InterruptIn _siqIrq;
embeddedartists 1:47680ec5d783 57 bool _initialized;
embeddedartists 1:47680ec5d783 58
embeddedartists 1:47680ec5d783 59
embeddedartists 1:47680ec5d783 60 int32_t _x;
embeddedartists 1:47680ec5d783 61 int32_t _y;
embeddedartists 1:47680ec5d783 62 int32_t _pen;
embeddedartists 1:47680ec5d783 63
embeddedartists 1:47680ec5d783 64 uint16_t _width;
embeddedartists 1:47680ec5d783 65 uint16_t _height;
embeddedartists 1:47680ec5d783 66 uint8_t _inset;
embeddedartists 1:47680ec5d783 67
embeddedartists 1:47680ec5d783 68 int _calibPoint;
embeddedartists 1:47680ec5d783 69
embeddedartists 1:47680ec5d783 70
embeddedartists 1:47680ec5d783 71 int cmd(char cmd, char* data, int len, char* respBuf, int* respLen, bool setCsOff=true);
embeddedartists 1:47680ec5d783 72 int waitForCalibResponse(uint32_t timeout);
embeddedartists 1:47680ec5d783 73 void readTouchIrq();
embeddedartists 1:47680ec5d783 74 };
embeddedartists 1:47680ec5d783 75
embeddedartists 1:47680ec5d783 76 #endif
embeddedartists 1:47680ec5d783 77