This is a fork of a functional ILI9341 display with a functional Seeed touch screen library.

Dependencies:   BMP180 UniGraphic mbed BNO055_fusionI_fixed HTU21D GPSISR Compass Fonts uGUI

Fork of TFT_test_NUCLEO-F411RE by Motoo Tanaka

/media/uploads/trevieze/win_20170427_21_31_20_pro.jpg

Had to move sensors to a remote board because of interference. Added spi burst mode to supported displays.

To do.... ugui buttons are slow. will need to add rtos to project. Finish other way points screen. Will have to rewrite portions of the touch screen class. Sense touch, delay, read values and then average, touch released, is the sequence. Add cadence input and logic to program for computer screen.

Committer:
trevieze
Date:
Wed Apr 12 20:30:06 2017 +0000
Revision:
14:b174ec6e3ca0
Parent:
4:25554dc066a0
Child:
17:4f10efd72d9d
Child:
18:50520438c129
Added burst mode to spi 8 bit driver. Increased SPI speed to 20 mhz. added uGUI to project. Scaled touch driver.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
trevieze 2:c5085faf2aa5 1 /* mbed library for touchscreen connected to 4 mbed pins
trevieze 2:c5085faf2aa5 2 * derive from SPI_TFT lib
trevieze 2:c5085faf2aa5 3 * Copyright (c) 2011 Peter Drescher - DC2PD
trevieze 2:c5085faf2aa5 4 *
trevieze 2:c5085faf2aa5 5 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
trevieze 2:c5085faf2aa5 6 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
trevieze 2:c5085faf2aa5 7 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
trevieze 2:c5085faf2aa5 8 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
trevieze 2:c5085faf2aa5 9 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
trevieze 2:c5085faf2aa5 10 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
trevieze 2:c5085faf2aa5 11 * THE SOFTWARE.
trevieze 2:c5085faf2aa5 12 */
trevieze 2:c5085faf2aa5 13
trevieze 2:c5085faf2aa5 14 #ifndef MBED_TOUCH_H
trevieze 2:c5085faf2aa5 15 #define MBED_TOUCH_H
trevieze 2:c5085faf2aa5 16
trevieze 2:c5085faf2aa5 17 #include "mbed.h"
trevieze 2:c5085faf2aa5 18
trevieze 4:25554dc066a0 19 #define __PRESURE 1000
trevieze 2:c5085faf2aa5 20 #define RXPLATE 300
trevieze 2:c5085faf2aa5 21
trevieze 14:b174ec6e3ca0 22 //Measured ADC values for (0,0) and (210-1,320-1)
trevieze 14:b174ec6e3ca0 23 //TS_MINX corresponds to ADC value when X = 0
trevieze 14:b174ec6e3ca0 24 //TS_MINY corresponds to ADC value when Y = 0
trevieze 14:b174ec6e3ca0 25 //TS_MAXX corresponds to ADC value when X = 240 -1
trevieze 14:b174ec6e3ca0 26 //TS_MAXY corresponds to ADC value when Y = 320 -1
trevieze 14:b174ec6e3ca0 27
trevieze 14:b174ec6e3ca0 28 #define TS_MINX 10500 //116*2
trevieze 14:b174ec6e3ca0 29 #define TS_MAXX 116252 //890*2
trevieze 14:b174ec6e3ca0 30 #define TS_MINY 12500 //83*2
trevieze 14:b174ec6e3ca0 31 #define TS_MAXY 116044 //913*2
trevieze 14:b174ec6e3ca0 32
trevieze 2:c5085faf2aa5 33 struct point {
trevieze 2:c5085faf2aa5 34 int x;
trevieze 2:c5085faf2aa5 35 int y;
trevieze 2:c5085faf2aa5 36 int z;
trevieze 2:c5085faf2aa5 37 };
trevieze 2:c5085faf2aa5 38
trevieze 2:c5085faf2aa5 39 class TouchScreen {
trevieze 2:c5085faf2aa5 40 public:
trevieze 2:c5085faf2aa5 41 /** create a TFT with touch object connected to the pins:
trevieze 2:c5085faf2aa5 42 *
trevieze 2:c5085faf2aa5 43 * @param pin xp resistiv touch x+
trevieze 2:c5085faf2aa5 44 * @param pin xm resistiv touch x-
trevieze 2:c5085faf2aa5 45 * @param pin yp resistiv touch y+
trevieze 2:c5085faf2aa5 46 * @param pin ym resistiv touch y-
trevieze 2:c5085faf2aa5 47 * @param mosi,miso,sclk SPI connection to TFT
trevieze 2:c5085faf2aa5 48 * @param cs pin connected to CS of display
trevieze 2:c5085faf2aa5 49 * @param reset pin connected to RESET of display
trevieze 2:c5085faf2aa5 50 * based on my SPI_TFT lib
trevieze 2:c5085faf2aa5 51 */
trevieze 2:c5085faf2aa5 52 TouchScreen(PinName xp, PinName xm, PinName yp, PinName ym);
trevieze 14:b174ec6e3ca0 53 void getTouch(point& p);
trevieze 14:b174ec6e3ca0 54 long map(long x, long in_min, long in_max, long out_min, long out_max);
trevieze 2:c5085faf2aa5 55 protected:
trevieze 2:c5085faf2aa5 56 PinName _xm;
trevieze 2:c5085faf2aa5 57 PinName _ym;
trevieze 2:c5085faf2aa5 58 PinName _xp;
trevieze 2:c5085faf2aa5 59 PinName _yp;
trevieze 2:c5085faf2aa5 60 //DigitalOut bl;
trevieze 2:c5085faf2aa5 61
trevieze 2:c5085faf2aa5 62 typedef enum { YES, MAYBE, NO } TOUCH;
trevieze 2:c5085faf2aa5 63 int readTouch(PinName p, PinName m, PinName a, PinName i);
trevieze 2:c5085faf2aa5 64 int x_off,y_off;
trevieze 2:c5085faf2aa5 65 int pp_tx,pp_ty;
trevieze 2:c5085faf2aa5 66 };
trevieze 2:c5085faf2aa5 67
trevieze 2:c5085faf2aa5 68 #endif