Music Player for ARCH-PRO

Dependencies:   GT20L16J1Y_font TinyJpgDec mbed

SeeedStudio Arch Pro + aitendo TFT-LCD w/Touch panel => .wav File Player
LPC1768 + aitendo TFT-LCD w/Touch panel => .wav File Player
http://goji2100.com/
/media/uploads/Goji/017s.png

Committer:
Goji
Date:
Mon Sep 08 16:07:05 2014 +0000
Revision:
0:6fa19738f62e
Music Player for ARCH-PRO

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Goji 0:6fa19738f62e 1 // --------------------------------------------------------
Goji 0:6fa19738f62e 2 // mGTPlib.c (c) Copyright 2013-2014 Goji.
Goji 0:6fa19738f62e 3 // --------------------------------------------------------
Goji 0:6fa19738f62e 4
Goji 0:6fa19738f62e 5 #include "mbed.h"
Goji 0:6fa19738f62e 6 #include "mainconf.h"
Goji 0:6fa19738f62e 7
Goji 0:6fa19738f62e 8 #include "mGTP.h"
Goji 0:6fa19738f62e 9
Goji 0:6fa19738f62e 10 extern TFT_INFO TFT_info;
Goji 0:6fa19738f62e 11
Goji 0:6fa19738f62e 12 #define TPC_ABS(a,b) ((a>b)?(a-b):(b-a))
Goji 0:6fa19738f62e 13
Goji 0:6fa19738f62e 14 int16_t TPC_getXYO(int16_t *dx, int16_t *dy)
Goji 0:6fa19738f62e 15 {
Goji 0:6fa19738f62e 16 int16_t wx1, wx2, wy1, wy2;
Goji 0:6fa19738f62e 17
Goji 0:6fa19738f62e 18 if ((wx1 = get_pX()) < TFT_info.TPC_xNon) return(0);
Goji 0:6fa19738f62e 19 if ((wy1 = get_pY()) < TFT_info.TPC_yNon) return(0);
Goji 0:6fa19738f62e 20 wait_us(300);
Goji 0:6fa19738f62e 21 if ((wx2 = get_pX()) < TFT_info.TPC_xNon) return(0);
Goji 0:6fa19738f62e 22 if ((wy2 = get_pY()) < TFT_info.TPC_yNon) return(0);
Goji 0:6fa19738f62e 23 if ((TPC_ABS(wx1, wx2) > 20) || (TPC_ABS(wy1, wy2) > 20)) return(1);
Goji 0:6fa19738f62e 24
Goji 0:6fa19738f62e 25 *dx = (wx1 + wx2) / 2;
Goji 0:6fa19738f62e 26 *dy = (wy1 + wy2) / 2;
Goji 0:6fa19738f62e 27
Goji 0:6fa19738f62e 28 return(2);
Goji 0:6fa19738f62e 29 }
Goji 0:6fa19738f62e 30
Goji 0:6fa19738f62e 31 int16_t TPC_getXY(int16_t *dx, int16_t *dy)
Goji 0:6fa19738f62e 32 {
Goji 0:6fa19738f62e 33 int16_t rc;
Goji 0:6fa19738f62e 34
Goji 0:6fa19738f62e 35 if ((rc = TPC_getXYO(dx, dy)) != 2) return(rc);
Goji 0:6fa19738f62e 36
Goji 0:6fa19738f62e 37 *dx = (*dx > TFT_info.TPC_xMin) ? (*dx - TFT_info.TPC_xMin) : 0;
Goji 0:6fa19738f62e 38 *dy = (*dy > TFT_info.TPC_yMin) ? (*dy - TFT_info.TPC_yMin) : 0;
Goji 0:6fa19738f62e 39 if (*dx > TFT_info.TPC_xMax) *dx = TFT_info.TPC_xMax;
Goji 0:6fa19738f62e 40 if (*dy > TFT_info.TPC_yMax) *dy = TFT_info.TPC_yMax;
Goji 0:6fa19738f62e 41
Goji 0:6fa19738f62e 42 *dx = ((((*dx * 1000) / TFT_info.TPC_xMax) * (TFT_info.xMAX - 1)) / 1000);
Goji 0:6fa19738f62e 43 *dy = ((((*dy * 1000) / TFT_info.TPC_yMax) * (TFT_info.yMAX - 1)) / 1000);
Goji 0:6fa19738f62e 44
Goji 0:6fa19738f62e 45 return(2);
Goji 0:6fa19738f62e 46 }