Graphical demo for the LPC4088 Experiment Base Board with one of the Display Expansion Kits. This program displays a number of dots in a 3D-projected wave.

Dependencies:   EALib mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers AR1021I2C.h Source File

AR1021I2C.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 AR1021I2C_H
00018 #define AR1021I2C_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 AR1021I2C : public TouchPanel {
00031 public:
00032 
00033 
00034     /**
00035      * Constructor
00036      *
00037      * @param mosi I2C SDA pin
00038      * @param miso I2C SCL pin
00039      * @param siq interrupt pin
00040      */
00041     AR1021I2C(PinName sda, PinName scl, PinName siq);
00042 
00043     bool info(int* verHigh, int* verLow, int* resBits, int* type);
00044 
00045     virtual bool init(uint16_t width, uint16_t height);
00046     virtual bool read(touchCoordinate_t &coord);
00047     virtual bool calibrateStart();
00048     virtual bool getNextCalibratePoint(uint16_t* x, uint16_t* y);
00049     virtual bool waitForCalibratePoint(bool* morePoints, uint32_t timeout);
00050 
00051 private:
00052 
00053 
00054     I2C _i2c;
00055     DigitalIn _siq;
00056     InterruptIn _siqIrq;
00057     bool _initialized;
00058 
00059 
00060     int32_t _x;
00061     int32_t _y;
00062     int32_t _pen;
00063 
00064     uint16_t _width;
00065     uint16_t _height;
00066     uint8_t _inset;
00067 
00068     int _calibPoint;
00069 
00070 
00071     int cmd(char cmd, char* data, int len, char* respBuf, int* respLen, bool setCsOff=true);
00072     int waitForCalibResponse(uint32_t timeout);
00073     void readTouchIrq();
00074 };
00075 
00076 #endif
00077