Simple test program for FRDM-KL25Z and Adafruit 2.8" TFT display. For the touch sensor, only polling mode is implemented.

Dependencies:   MMA8451Q SPI_STMPE610 TSI UniGraphic mbed

This program was to test Adafruit 2.8" TFT with touch with FRDM-KL25Z.
After download the binary to the FRDM-KL25Z and push the reset button ,
a simple welcome message will be displayed.

このプログラムは私が秋月で購入した Adafruit 2.8" TFT
http://akizukidenshi.com/catalog/g/gM-07747/
をFRDM-KL25Z で試すために書いたものです。
ダウンロード後にFRDM-KL25Zのリセットスイッチを押すと
最初の画面が表示されます。

Now using UniGraphic library.
And the problem of remaining previous screen is gone. ;-)
For a little bonus, TS_Eyes and Maze are also included.

UniGraphic ライブラリ版になり、画面にごみが残るバグが治りました。
おまけに TS_Eyes と Maze も追加してあります。 (^ ^)v

/media/uploads/Rhyme/img_0984_ss.jpg

If you push and keep the right side of the screen,
the screen will advance to the page2, which is a simple graph sample.

ここで画面の右側をしばらく押していると、次のページに移行します。
このページでは、簡単なグラフを表示する例を描画しています。

/media/uploads/Rhyme/img_0985_ss.jpg

And if you do the same again, the program advances to the page3,
which is a data display page of MMA8451Q accelerometer mounted on
the FRDM-KL25Z.

さらに画面の右側をしばらく押していると、次のページに移行します。
ここでは、FRDM-KL25Zに搭載されている MMA8451Q という3軸の
加速度センサの値を表示しています。

/media/uploads/Rhyme/img_0986_ss.jpg

And this is the last page of this program, so far, so if you
try to advance page, it will return to the first page.

このページが最後のページになっているので、さらにページ送りをすると
最初のページに戻ります。

SPI_STMPE610.h

Committer:
Rhyme
Date:
2014-10-31
Revision:
0:6b8a2d4c88b3

File content as of revision 0:6b8a2d4c88b3:

/* mbed SPI_STMPE610.h to test adafruit 2.8" TFT LCD shiled w Touchscreen
 * Copyright (c) 2014 Motoo Tanaka @ Design Methodology Lab
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

#ifndef SPI_STMPE610_H
#define SPI_STMPE610_H

#include "mbed.h"

/**
 * STMPE610 Touch Sensor
 * 
 *
 */

class SPI_STMPE610 
{
public:
 /**
 * STMPE610 constructor
 *
 * @param mosi SPI_MOSI pin
 * @param miso SPI_MISO pin
 * @param sclk SPI_CLK pin
 * @param cs   SPI_CS  pin
 */
 SPI_STMPE610(PinName mosi, PinName miso, PinName sclk, PinName cs) ;
 
 ~SPI_STMPE610() ;

 /*
  * some member functions here (yet to be written)
  */

 SPI m_spi;
 DigitalOut m_cs ;
 int _mode ;
 
  void readRegs(int addr, uint8_t *data, int len) ;
  void writeRegs(uint8_t *data, int len) ;
  uint8_t read8(int addr) ;
  void write8(int addr, uint8_t data) ;
  uint16_t read16(int addr) ;
  void write16(int addr, uint16_t data) ;
  
  int getRAWPoint(uint16_t *x, uint16_t *y, uint16_t *z) ;
  
  private:
} ;
#endif /* SPI_STMPE610_H */