Lamp-Da 0.1
A compact lantern project
Loading...
Searching...
No Matches
Classes | Namespaces | Functions
utils.h File Reference

Define useful functions. More...

Go to the source code of this file.

Classes

union  lampda::COLOR
 Use this to convert color to bytes. More...
 

Namespaces

namespace  lampda
 Program scope.
 
namespace  lampda::utils
 Utility function and classes.
 

Functions

template<typename N >
static constexpr N lampda::min (const N a, const N b)
 Minimum of two numbers.
 
template<typename N >
static constexpr N lampda::max (const N a, const N b)
 Maximum of two numbers.
 
template<typename N >
static constexpr N lampda::abs (const N a)
 absolute of a number
 
template<typename T >
static constexpr T lampda::lmpd_constrain (const T &a, const T &mini, const T &maxi)
 Constrain a number between two numbers.
 
template<typename T = float>
static T lampda::lmpd_map (float x, const float in_min, const float in_max, const float out_min, const float out_max)
 Linearly interpolate a number between two numbers.
 
static constexpr float lampda::to_radians (float degrees)
 Convert an angle in degrees to an angle in radians.
 
static constexpr float lampda::wrap_angle (const float angle_rad)
 Wrap an angle in radians between 0 and 2*PI.
 
uint32_t lampda::utils::get_random_complementary_color (const uint32_t color, const float tolerance)
 Compute the complementary color of the given color, with a random variation.
 
uint32_t lampda::utils::get_gradient (const uint32_t colorStart, const uint32_t colorEnd, const float level)
 Return the color gradient between colorStart to colorEnd.
 
COLOR lampda::utils::color_fade (COLOR c1, uint8_t amount, bool video)
 
COLOR lampda::utils::color_add (COLOR c1, COLOR c2, bool fast)
 
uint32_t lampda::utils::hue_to_rgb_sinus (const uint16_t angle)
 
template<typename T >
static constexpr uint32_t lampda::utils::hash (const T s, const uint16_t maxSize=14, const uint16_t off=0)
 Hash input string into a 32-bit unsigned integer.
 
constexpr double lampda::utils::analogReadToVoltage (const uint16_t analogVal)
 
constexpr uint16_t lampda::utils::voltageToAnalogRead (const float voltage)
 

Detailed Description

Define useful functions.