Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: SPI_STMPE610 mbed vt100
main.cpp
- Committer:
- Rhyme
- Date:
- 2014-11-08
- Revision:
- 0:bfe34cc0bc72
- Child:
- 1:8e4295a5c716
File content as of revision 0:bfe34cc0bc72:
/* main.cpp to test touch sensor comes with adafruit 2.8" TFT LCD shield
* 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.
*/
/*
* Note: Since the interrupt siganl of the shield was not connected
* to an interrupt pin on my frdm-kl25z, I just used polling mode.
*/
#include "mbed.h"
#include "SPI_STMPE610.h"
#define PIN_MOSI PTD2
#define PIN_MISO PTD3
#define PIN_SCLK PTD1
#define PIN_CS_TSC PTA13
#define PIN_TSC_INTR PTC9
SPI_STMPE610 TSC(PIN_MOSI, PIN_MISO, PIN_SCLK, PIN_CS_TSC) ;
int main()
{
uint16_t touched, x, y, z ;
printf("Test SPI STMPE610\n\r") ;
while (true) {
touched = TSC.getRAWPoint(&x, &y, &z) ;
if (touched) {
printf("x = %d, y = %d, z = %d\n\r", x, y, z) ;
}
wait(0.1) ;
}
}