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: mbed TFT_fonts SPI_TFT_ILI9341 Adafruit_GFX FT6206 MMA8451Q
orientation.cpp
- Committer:
- atomicle
- Date:
- 2020-01-17
- 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;
}