Touchscreen digit recognition.
Dependencies: mbed TFT_fonts SPI_TFT_ILI9341 Adafruit_GFX FT6206 MMA8451Q
Diff: orientation.cpp
- Revision:
- 2:1ab6ba7c2c90
diff -r c44001c6bbf8 -r 1ab6ba7c2c90 orientation.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/orientation.cpp Fri Jan 17 08:33:46 2020 +0000 @@ -0,0 +1,10 @@ +#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; +}