Touchscreen digit recognition.

Dependencies:   mbed TFT_fonts SPI_TFT_ILI9341 Adafruit_GFX FT6206 MMA8451Q

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers orientation.cpp Source File

orientation.cpp

00001 #include "orientation.hpp"
00002 
00003 int get_orientation() {
00004     static bool horizontal = true;
00005     float x = abs(acc.getAccX());
00006     float y = abs(acc.getAccY());
00007     float z = abs(acc.getAccZ());
00008     horizontal = z < 0.5 ? y > x : horizontal;
00009     return horizontal ? LANDSCAPE : PORTRAIT;
00010 }