Languages: |
English • العربية • Български • Česky • Dansk • Deutsch • Esperanto • Eesti • Español • فارسی • Suomi • Français • עברית • Magyar • Italiano • 한국어 • Nederlands • Norsk (bokmål) • Polski • Português • Română • Русский • Svenska • Slovenčina • Українська • 中文(中国大陆) • 中文(台灣) • Euskara • Català |
Here's a quick and simple C program that reads a packet from the
accelerometer once per second, and rotates the screen to a new
orientation if the orientation has changed.
I don't mean this to conflict with Paul's excellent work on Gestures; my reason for writing it is so that it can be used as an always-on daemon in the OM distributions. (Full gesture interpretation is more CPU heavy and requires reading data more often than once per second, so perhaps that will be done on-demand instead of always-on.)
The code is: http://github.com/cjb/freerunner-rotate/tree/master/rotate.c?raw=true
There's an ARM binary here (chmod a+x rotate && ./rotate): http://dev.laptop.org/~cjb/rotate
update by Kurt Van Dijck
I modified the above program to use read (not fread) with struct input_event datastructures. The simplifies the detection of current position. No sleeps are necessary, no incomplete reads, .... code is: http://www.ecirc.net/openmoko/rotate.c
invoke with: rotate [ DEVICE FILE [landscape]]
the second paraemeter is to allow landscape rotation. On my system, the glamo graphics driver eats all cpu when rotated in landscape.
Rotate
Rotates the screen according to the position of the Neo FreeRunner.
|
opkg install http://projects.openmoko.org/frs/download.php/455/accel-rotate_0.41_armv4t.ipk
opkg install http://projects.openmoko.org/frs/download.php/456/accel-rotate-qte_0.41_armv4t.ipk