openchronos-ng
opensource firmware for the ez430 chronos
|
00001 /* 00002 temperature.h: Temperature driver header 00003 00004 Copyright (C) 2012 Matthew Excell <matt@excellclan.com> 00005 00006 This program is free software: you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation, either version 3 of the License, or 00009 (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program. If not, see <http://www.gnu.org/licenses/>. 00018 */ 00019 // ************************************************************************************************* 00020 // 00021 // Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/ 00022 // 00023 // 00024 // Redistribution and use in source and binary forms, with or without 00025 // modification, are permitted provided that the following conditions 00026 // are met: 00027 // 00028 // Redistributions of source code must retain the above copyright 00029 // notice, this list of conditions and the following disclaimer. 00030 // 00031 // Redistributions in binary form must reproduce the above copyright 00032 // notice, this list of conditions and the following disclaimer in the 00033 // documentation and/or other materials provided with the 00034 // distribution. 00035 // 00036 // Neither the name of Texas Instruments Incorporated nor the names of 00037 // its contributors may be used to endorse or promote products derived 00038 // from this software without specific prior written permission. 00039 // 00040 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00041 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00042 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00043 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00044 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00045 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00046 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00047 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00048 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00049 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00050 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00051 // 00052 // ************************************************************************************************* 00053 00054 #ifndef TEMPERATURE_H_ 00055 #define TEMPERATURE_H_ 00056 00057 // ************************************************************************************************* 00058 // Include section 00059 #include <openchronos.h> 00060 00061 // ************************************************************************************************* 00062 // Prototypes section 00063 00064 // internal functions 00065 extern void reset_temp_measurement(void); 00066 extern void temperature_measurement(uint8_t filter); 00067 00068 #ifndef CONFIG_TEMPERATUREMON_METRIC_ONLY 00069 extern int16_t convert_C_to_F(int16_t value); 00070 extern int16_t convert_F_to_C(int16_t value); 00071 #endif 00072 // ************************************************************************************************* 00073 // Defines section 00074 00075 00076 // ************************************************************************************************* 00077 // Global Variable section 00078 /* TODO: pack this stuff!!!! */ 00079 struct temp 00080 { 00081 // Temperature (�C) in 2.1 format 00082 int16_t degrees; 00083 // User set calibration value (�C) in 2.1 format 00084 int16_t offset; 00085 // Update available for sys_msg? 00086 uint8_t has_update :1; 00087 #ifndef CONFIG_TEMPERATUREMON_METRIC_ONLY 00088 //C or F 00089 uint8_t is_c :1; 00090 #endif 00091 00092 }; 00093 extern struct temp sTemp; 00094 00095 #ifndef FALSE 00096 // the classic false 00097 #define FALSE (0 == 1) 00098 #endif 00099 00100 #ifndef TRUE 00101 // the classic true 00102 #define TRUE (1 == 1) 00103 #endif 00104 00105 #define FILTER_OFF (0) 00106 #define FILTER_ON (1) 00107 00108 // ************************************************************************************************* 00109 // Extern section 00110 00111 00112 #endif /*TEMPERATURE_H_*/