Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
/*****************************************************************************
Debounce.cpp
Copyright (c) 2020 Raphael DINGE
*Tab=3***********************************************************************/
/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
#include "erb/detail/Debounce.h"
namespace erb
{
/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
/*
==============================================================================
Name : process
==============================================================================
*/
void Debounce::process (bool val)
{
_state = uint8_t (_state << 1) | (val ? 1 : 0);
}
/*
==============================================================================
Name : idle
==============================================================================
*/
bool Debounce::idle () const
{
return _state == 0x00;
}
/*
==============================================================================
Name : pressed
==============================================================================
*/
bool Debounce::pressed () const
{
return _state == 0x7f;
}
/*
==============================================================================
Name : held
==============================================================================
*/
bool Debounce::held () const
{
return _state == 0xff;
}
/*
==============================================================================
Name : released
==============================================================================
*/
bool Debounce::released () const
{
return _state == 0x80;
}
/*\\\ INTERNAL \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
} // namespace erb
/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
4b2b41491This file is pinned to the selected release. Download the original to open it in your design tool.