Added some IO modules (teslaGun, solenoid, powerEnable) as dedicated modules instead of general IO

Fixed code behind them

git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@266 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
mmi
2017-10-25 14:50:20 +00:00
parent 7e6f4a735c
commit 9a0d6a2288
22 changed files with 774 additions and 239 deletions

View File

@@ -33,9 +33,11 @@
#include "Error.h"
#include "platform.h"
#include "CoverSolenoid.h"
#include "Interlock.h"
#include "Logger.h"
#include "PCBA.h"
#include "Power6V5Supply.h"
#include "Version.h"
// -----------------------------------------------------------------------------
@@ -97,16 +99,6 @@ ErrorStatus hsb_generateStartScreen(struct Display* Display)
}
ErrorStatus hsb_solenoidLock (void)
{
return GPIO_setValue(solenoid, false);
}
ErrorStatus hsb_solenoidUnlock (void)
{
return GPIO_setValue(solenoid, true);
}
ErrorStatus hsb_enableSafety(void)
{
ErrorStatus returnValue = SUCCESS;
@@ -114,7 +106,7 @@ ErrorStatus hsb_enableSafety(void)
// First, Lock the cover
if (returnValue == SUCCESS)
{
hsb_solenoidLock();
CoverSolenoid_lock();
}
if (returnValue == SUCCESS)
@@ -132,33 +124,11 @@ ErrorStatus hsb_enableSafety(void)
}
}
if (returnValue == SUCCESS)
{
// TESLA has a second interlock that must be closed
if (PCBA_getInstance()->pcba == PCBA_Tesla)
{
if (Interlock_isClosed(teslalock))
{
// Enable Interrupt for tesla interlock switch
Interlock_setEXTI(teslalock, ENABLE);
}
else
{
Error_postError(INTERLOCK_TESLA_FAIL);
returnValue = ERROR;
}
}
}
// if Interlock(s) closed, continue procedure
if (returnValue == SUCCESS)
{
// Power the circuit
if (GPIO_setValue(power6v5Enable, false) != SUCCESS)
{
Error_postError(POWERENABLE_FAIL);
returnValue = ERROR;
}
Power6V5Supply_on();
}
return returnValue;
}
@@ -168,19 +138,10 @@ ErrorStatus hsb_disableSafety(void)
{
ErrorStatus returnValue = SUCCESS;
// Power the circuit
if (GPIO_setValue(power6v5Enable, true) != SUCCESS)
{
Error_postError(POWERENABLE_FAIL);
returnValue = ERROR;
}
// Un-Power the circuit
Power6V5Supply_off();
Interlock_setEXTI(interlock, DISABLE);
// TESLA has a second interlock that must be closed
if (PCBA_getInstance()->pcba == PCBA_Tesla)
{
Interlock_setEXTI(teslalock, DISABLE);
}
return returnValue;
}