Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
/*****************************************************************************
LedRgb.hpp
Copyright (c) 2020 Raphael DINGE
*Tab=3***********************************************************************/
#pragma once
/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
namespace erb
{
/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
/*
==============================================================================
Name : ColorRgb::none
==============================================================================
*/
ColorRgb ColorRgb::none ()
{
return { 0.f, 0.f, 0.f };
}
/*
==============================================================================
Name : ColorRgb::red
==============================================================================
*/
ColorRgb ColorRgb::red ()
{
return { 1.f, 0.f, 0.f };
}
/*
==============================================================================
Name : ColorRgb::green
==============================================================================
*/
ColorRgb ColorRgb::green ()
{
return { 0.f, 1.f, 0.f };
}
/*
==============================================================================
Name : ColorRgb::blue
==============================================================================
*/
ColorRgb ColorRgb::blue ()
{
return { 0.f, 0.f, 1.f };
}
/*
==============================================================================
Name : ctor
==============================================================================
*/
template <PinType Pin>
LedRgb <Pin>::LedRgb (typename Led <Pin>::BindingType data_r, typename Led <Pin>::BindingType data_g, typename Led <Pin>::BindingType data_b, const uint64_t & clock_ms)
: r (data_r, clock_ms)
, g (data_g, clock_ms)
, b (data_b, clock_ms)
{
}
/*
==============================================================================
Name : set_brightness
==============================================================================
*/
template <PinType Pin>
void LedRgb <Pin>::set_brightness (float perceptual_brightness)
{
r.set_brightness (perceptual_brightness);
g.set_brightness (perceptual_brightness);
b.set_brightness (perceptual_brightness);
}
/*
==============================================================================
Name : on
==============================================================================
*/
template <PinType Pin>
void LedRgb <Pin>::on (ColorRgb color)
{
r.on (color.r);
g.on (color.g);
b.on (color.b);
}
/*
==============================================================================
Name : off
==============================================================================
*/
template <PinType Pin>
void LedRgb <Pin>::off ()
{
r.off ();
g.off ();
b.off ();
}
/*
==============================================================================
Name : pulse
==============================================================================
*/
template <PinType Pin>
void LedRgb <Pin>::pulse (ColorRgb color, std::chrono::milliseconds duration, TransitionFunction transition_function)
{
r.pulse (color.r, duration, transition_function);
g.pulse (color.g, duration, transition_function);
b.pulse (color.b, duration, transition_function);
}
/*
==============================================================================
Name : pulse_twice
==============================================================================
*/
template <PinType Pin>
void LedRgb <Pin>::pulse_twice (ColorRgb color, std::chrono::milliseconds duration, TransitionFunction transition_function)
{
r.pulse_twice (color.r, duration, transition_function);
g.pulse_twice (color.g, duration, transition_function);
b.pulse_twice (color.b, duration, transition_function);
}
/*
==============================================================================
Name : pulse_thrice
==============================================================================
*/
template <PinType Pin>
void LedRgb <Pin>::pulse_thrice (ColorRgb color, std::chrono::milliseconds duration, TransitionFunction transition_function)
{
r.pulse_thrice (color.r, duration, transition_function);
g.pulse_thrice (color.g, duration, transition_function);
b.pulse_thrice (color.b, duration, transition_function);
}
/*
==============================================================================
Name : blink
==============================================================================
*/
template <PinType Pin>
void LedRgb <Pin>::blink (ColorRgb color, std::chrono::milliseconds period, TransitionFunction transition_function)
{
r.blink (color.r, period, transition_function);
g.blink (color.g, period, transition_function);
b.blink (color.b, period, transition_function);
}
/*\\\ INTERNAL \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
/*
==============================================================================
Name : impl_postprocess
==============================================================================
*/
template <PinType Pin>
void LedRgb <Pin>::impl_postprocess ()
{
r.impl_postprocess ();
g.impl_postprocess ();
b.impl_postprocess ();
}
/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
} // namespace erb
/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
1c962d8cfThis file is pinned to the selected release. Download the original to open it in your design tool.