* AM2321的取温度间隔得大于2s,否则,i2c会不工作了 * SimpleTimer有个bug,会导致两次快速的读温度,现在读温度函数里加了保护 * Blynk有个bug,会导致无法把数据传到服务器 * 现在可以正常工作了

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers BlynkUtility.h Source File

BlynkUtility.h

Go to the documentation of this file.
00001 /**
00002  * @file       BlynkUtility.h
00003  * @author     Volodymyr Shymanskyy
00004  * @license    This project is released under the MIT License (MIT)
00005  * @copyright  Copyright (c) 2015 Volodymyr Shymanskyy
00006  * @date       Jun 2015
00007  * @brief      Utility functions
00008  *
00009  */
00010 
00011 #ifndef BlynkUtility_h
00012 #define BlynkUtility_h
00013 
00014 template<class T>
00015 const T& BlynkMin(const T& a, const T& b)
00016 {
00017     return (b < a) ? b : a;
00018 }
00019 
00020 template<class T>
00021 const T& BlynkMax(const T& a, const T& b)
00022 {
00023     return (b < a) ? a : b;
00024 }
00025 
00026 template <unsigned WSIZE, typename T>
00027 void BlynkAverageSample (T& avg, const T& input) {
00028     avg -= avg/WSIZE;
00029     const T add = input/WSIZE;
00030     // Fix for shorter delays
00031     avg += (add > 0) ? add : -1;
00032 }
00033 
00034 #endif
00035