JP Abgrall | 5dcc6c9 | 2012-05-31 20:39:43 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 Samsung |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include <cutils/log.h> |
| 18 | #include <pthread.h> |
| 19 | |
| 20 | #include "PressureSensor.h" |
| 21 | |
| 22 | /* |
| 23 | * The BMP driver gives pascal values. |
| 24 | * It needs to be changed into hectoPascal. |
| 25 | */ |
| 26 | #define PRESSURE_HECTO_PA (1.0f/100.0f) |
| 27 | |
| 28 | PressureSensor::PressureSensor() |
| 29 | : IioSensorBase(NULL, "barometer", |
| 30 | "events/in_pressure0_thresh_either_en", |
| 31 | "in_pressure0_input", IIO_PRESSURE) |
| 32 | { |
| 33 | mPendingEvent.sensor = ID_PR; |
| 34 | mPendingEvent.type = SENSOR_TYPE_PRESSURE; |
| 35 | } |
| 36 | |
| 37 | void PressureSensor::handleData(int value) { |
JP Abgrall | db7bdef | 2012-06-21 15:04:34 -0700 | [diff] [blame] | 38 | ALOGV("PressureSensor::handleData value %d", value); |
JP Abgrall | 5dcc6c9 | 2012-05-31 20:39:43 -0700 | [diff] [blame] | 39 | mPendingEvent.pressure = value * PRESSURE_HECTO_PA; |
| 40 | } |