Touchscreen digit recognition.

Dependencies:   mbed TFT_fonts SPI_TFT_ILI9341 Adafruit_GFX FT6206 MMA8451Q

orientation.cpp

Committer:
atomicle
Date:
18 months ago
Revision:
2:1ab6ba7c2c90

File content as of revision 2:1ab6ba7c2c90:

#include "orientation.hpp"

int get_orientation() {
    static bool horizontal = true;
    float x = abs(acc.getAccX());
    float y = abs(acc.getAccY());
    float z = abs(acc.getAccZ());
    horizontal = z < 0.5 ? y > x : horizontal;
    return horizontal ? LANDSCAPE : PORTRAIT;
}