blob: 504d2cd966d8279182199d027be5d5ae944b3f31 [file] [log] [blame]
JP Abgrall5dcc6c92012-05-31 20:39:43 -07001/*
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
28PressureSensor::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
37void PressureSensor::handleData(int value) {
JP Abgralldb7bdef2012-06-21 15:04:34 -070038 ALOGV("PressureSensor::handleData value %d", value);
JP Abgrall5dcc6c92012-05-31 20:39:43 -070039 mPendingEvent.pressure = value * PRESSURE_HECTO_PA;
40}