1 /* ****************************************************************
3 * Copyright 2017 Samsung Electronics All Rights Reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 ******************************************************************/
19 #ifndef __CO2_SENSOR_H__
20 #define __CO2_SENSOR_H__
23 * @brief Reads the value from co2 sensor through AD converter(MCP3008).
24 * @param[in] ch_num The number of channel connected to the co2 detection sensor with AD converter
25 * @param[out] out_value The vaule of a co2 level
26 * @return 0 on success, otherwise a negative error value
29 int co2_sensor_read(int ch_num, unsigned int *out_value);
31 /* release resource */
32 void co2_sensor_close(void);
34 /* utility functions */
35 double co2_sensor_value_to_voltage(unsigned int value);
38 /* Fallowing functions art Not implemented, please see comments in c source code */
39 int co2_sensor_set_calibration_values(unsigned int zero_point_v,
40 unsigned int second_point_ppm, unsigned int second_point_v);
41 unsigned int co2_sensor_voltage_to_ppm(double voltage);
42 unsigned int co2_sensor_value_to_ppm(unsigned int value);
44 #endif /* __CO2_SENSOR_H__ */