| 826 | } |
| 827 | |
| 828 | void T2DActivity::enableAccelerometer(bool enable) { |
| 829 | |
| 830 | accelerometerActive = enable; |
| 831 | |
| 832 | if (enable) { |
| 833 | |
| 834 | if (platState.engine->accelerometerSensor != NULL) { |
| 835 | ASensorEventQueue_enableSensor(platState.engine->sensorEventQueue, |
| 836 | platState.engine->accelerometerSensor); |
| 837 | // We'd like to get 30 events per second (in us). |
| 838 | ASensorEventQueue_setEventRate(platState.engine->sensorEventQueue, |
| 839 | platState.engine->accelerometerSensor, (1000L/30)*1000); |
| 840 | } |
| 841 | |
| 842 | } else { |
| 843 | |
| 844 | if (platState.engine->accelerometerSensor != NULL) { |
| 845 | ASensorEventQueue_disableSensor(platState.engine->sensorEventQueue, |
| 846 | platState.engine->accelerometerSensor); |
| 847 | } |
| 848 | |
| 849 | } |
| 850 | |
| 851 | } |
| 852 | |
| 853 | /** |
| 854 | * update callback |
no outgoing calls
no test coverage detected