summaryrefslogtreecommitdiffstats
path: root/libsensors/lsm330dlc_acceleration.c
Commit message (Collapse)AuthorAgeFilesLines
* i9300: rewrite libsensors in c++Simon Shields2016-03-051-390/+0
| | | | | | | | * based off t0lte sensors * AkmSensor kanged from i9100 (added sensor status support) * has a working compass! Change-Id: Iaed0463c33089ca0b636be4ba3f966f2e25f34f9
* libsensors: switch to portable typedefs to match callbacksDheeraj CVR2015-11-251-4/+4
| | | | | | | | | | | | | Using a strict basetype only coding style is not a good idea especially when we are dealing with callbacks which use portable typedef like int64_t. This kind of coding style would most likely end up in overflows at various places especially when dealing with timestamps and sensor delays which are caused when typecasting datatypes of different size. Switch to portable typedefs and get rid of "long". Change-Id: I75b9cace7602345dba9095f046292e6d4db07df4
* i9300: libsensors: remove unused orientation sensorChristian Balster2015-11-251-13/+0
| | | | | | | | | | | | | The Orientation Sensor is deprecated and no longer required. Additionally this implementation is never even used, since Android automatically replaces it by it's own implementation if the sensor HAL doesn't also provide a Rotation Vector sensor. Furthermore the current implementation only uses the accelerometer and magnetometer for the sensor fusion and doesn't make use of the Gyroscope. So should we at some point decide to implement our own complete sensor fusion this would have to be rewritten anyway. Change-Id: I45d8a9afd2089b49131e6cc69cdf2f3dfee46c92
* i9300: libsensors: Fix compass orientation (for real)Christian Balster2015-11-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Actually this fixes several more problems, but the compass orientation is the most noticeable symptom of this: Android expects sensor event timestamps in nanoseconds. Linux timestamps on the other hand are saved in the timeval struct in seconds and micro- seconds. Therefore these need to be converted, which is easy enough and is implemented in input.c of libsensors. Unfortunately, the current implementation uses type long int for the return value and all further calculations. Since the nanosecond values easily exceed 2^32 the buffers overflow and wrap, which results in the reported timestamps moving between -2^16 and 2^16. The consequences of this are noticeable especially with fused sensors integrating the gyroscope readings, which use the difference of two timestamps to calculate the change in orientation by multiplying it by the rotation rate. When the buffer wraps around this results in a huge time difference and thus leads to a momentary orientation change every ~4.3 seconds. This commit fixes this behavior by using long long int. Change-Id: Ib47bdc36ece16371c82f61b125315074ec048e32
* i9300: libsensors: fix typo in accelerometer dataChristian Balster2015-11-251-1/+1
| | | | Change-Id: Iee501b65c23bed22bfe769496bafc852f939a8ac
* i9300: update libsensors from replicantJavi Ferrer2015-11-251-40/+39
| | | | | | - Orientation sensor still broken Change-Id: I7d20afbbc1f8b1ca5d046a38c0c3b7ce824c12cd
* i9300: add opensource sensors halPaul Kocialkowski2013-09-021-0/+404
Change-Id: Ia104c31f165fcaca1ee5dc471f7d71ca9abd387f