Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
/*****************************************************************************
JackDetection.hpp
Copyright (c) 2020 Raphael DINGE
*Tab=3***********************************************************************/
#pragma once
/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
namespace erb
{
/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
/*
==============================================================================
Name : push
==============================================================================
*/
void JackDetection::push (bool current_val, bool expected_val)
{
constexpr int seq_length = 64;
++_run;
if (_run >= seq_length)
{
_plugged_flag = _mismatch >= (seq_length / 8);
_run = 0;
_mismatch = 0;
}
_mismatch += current_val ^ expected_val;
}
/*
==============================================================================
Name : plugged
==============================================================================
*/
bool JackDetection::plugged () const
{
return _plugged_flag;
}
/*\\\ INTERNAL \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
} // namespace erb
/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
1c962d8cfThis file is pinned to the selected release. Download the original to open it in your design tool.