Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: ESP8266BlynkWeatherStation TEST123
Fork of Blynk by
utility/BlynkUtility.h
- Committer:
 - vshymanskyy
 - Date:
 - 2016-05-07
 - Revision:
 - 0:58b20b438383
 
File content as of revision 0:58b20b438383:
/**
 * @file       BlynkUtility.h
 * @author     Volodymyr Shymanskyy
 * @license    This project is released under the MIT License (MIT)
 * @copyright  Copyright (c) 2015 Volodymyr Shymanskyy
 * @date       Jun 2015
 * @brief      Utility functions
 *
 */
#ifndef BlynkUtility_h
#define BlynkUtility_h
template<class T>
const T& BlynkMin(const T& a, const T& b)
{
    return (b < a) ? b : a;
}
template<class T>
const T& BlynkMax(const T& a, const T& b)
{
    return (b < a) ? a : b;
}
template <unsigned WSIZE, typename T>
void BlynkAverageSample (T& avg, const T& input) {
    avg -= avg/WSIZE;
    const T add = input/WSIZE;
    // Fix for shorter delays
    avg += (add > 0) ? add : -1;
}
#endif
            
    