p kj
/
LPC824-BlynkWeatherstation
Microduino
Fork of Io_moon by
Embed:
(wiki syntax)
Show/hide line numbers
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
Generated on Tue Jul 19 2022 01:01:49 by 1.7.2