You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
88 lines
1.6 KiB
C++
88 lines
1.6 KiB
C++
7 months ago
|
/*
|
||
|
* TriggerFault.cpp
|
||
|
*
|
||
|
* Author: Aleksey Gerasimenko
|
||
|
* gerasimenko.aleksey.n@gmail.com
|
||
|
*/
|
||
|
|
||
|
#include "SYSCTRL/TriggerFault.h"
|
||
|
|
||
|
namespace SYSCTRL
|
||
|
{
|
||
|
//CONSTRUCTOR
|
||
|
TriggerFault::TriggerFault():
|
||
|
SYSCTRL::TriggerBase()
|
||
|
{}//CONSTRUCTOR
|
||
|
|
||
|
#pragma CODE_SECTION("ramfuncs");
|
||
|
void TriggerFault::setSET(bool set)
|
||
|
{
|
||
|
m_trigger.bit.set = set;
|
||
|
//
|
||
|
}//
|
||
|
//
|
||
|
#pragma CODE_SECTION("ramfuncs");
|
||
|
void TriggerFault::setRESET(bool reset)
|
||
|
{
|
||
|
m_trigger.bit.reset = reset;
|
||
|
//
|
||
|
}//
|
||
|
//
|
||
|
#pragma CODE_SECTION("ramfuncs");
|
||
|
void TriggerFault::execute()
|
||
|
{
|
||
|
// Q(i) = S | (nR & Q(i-1))
|
||
|
//
|
||
|
m_trigger.bit.out_privious = m_trigger.bit.out;
|
||
|
m_trigger.bit.out_shadow = m_trigger.bit.set | (!m_trigger.bit.reset & m_trigger.bit.out_privious);
|
||
|
m_trigger.bit.out = m_trigger.bit.out_shadow;
|
||
|
m_trigger.bit.positive = !m_trigger.bit.out_privious & m_trigger.bit.out;
|
||
|
m_trigger.bit.negative = m_trigger.bit.out_privious & !m_trigger.bit.out;
|
||
|
//
|
||
|
}//
|
||
|
//
|
||
|
#pragma CODE_SECTION("ramfuncs");
|
||
|
void TriggerFault::clear()
|
||
|
{
|
||
|
m_trigger.all = 0;
|
||
|
//
|
||
|
}//
|
||
|
//
|
||
|
#pragma CODE_SECTION("ramfuncs");
|
||
|
bool TriggerFault::getOUT()
|
||
|
{
|
||
|
return m_trigger.bit.out;
|
||
|
//
|
||
|
}//
|
||
|
//
|
||
|
#pragma CODE_SECTION("ramfuncs");
|
||
|
bool TriggerFault::getPOSITIVE()
|
||
|
{
|
||
|
return m_trigger.bit.positive;
|
||
|
//
|
||
|
}//
|
||
|
//
|
||
|
#pragma CODE_SECTION("ramfuncs");
|
||
|
bool TriggerFault::getNEGATIVE()
|
||
|
{
|
||
|
return m_trigger.bit.negative;
|
||
|
//
|
||
|
}//
|
||
|
//
|
||
|
#pragma CODE_SECTION("ramfuncs");
|
||
|
bool TriggerFault::isPOSITIVE()
|
||
|
{
|
||
|
return m_trigger.bit.positive;
|
||
|
//
|
||
|
}//
|
||
|
//
|
||
|
#pragma CODE_SECTION("ramfuncs");
|
||
|
bool TriggerFault::isNEGATIVE()
|
||
|
{
|
||
|
return m_trigger.bit.negative;
|
||
|
//
|
||
|
}//
|
||
|
//
|
||
|
|
||
|
} /* namespace SYSCTRL */
|