Updates:
- Re-located repairprocessrow information in dedicated object - added error conditions to repair row and added condition handling to repair process git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@260 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
@@ -0,0 +1,161 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
/// @file CathodeMCP.c
|
||||
/// @brief Description
|
||||
// -----------------------------------------------------------------------------
|
||||
// Micro-Key bv
|
||||
// Industrieweg 28, 9804 TG Noordhorn
|
||||
// Postbus 92, 9800 AB Zuidhorn
|
||||
// The Netherlands
|
||||
// Tel: +31 594 503020
|
||||
// Fax: +31 594 505825
|
||||
// Email: support@microkey.nl
|
||||
// Web: www.microkey.nl
|
||||
// -----------------------------------------------------------------------------
|
||||
/// $Revision$
|
||||
/// $Author$
|
||||
/// $Date$
|
||||
// (c) 2017 Micro-Key bv
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
/// @file CathodeMCP.c
|
||||
/// @ingroup {group_name}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Include files
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#include "CathodeMCP.h"
|
||||
|
||||
#include "PCBA.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Type definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// File-scope variables
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static struct CathodeMCP thisCathodeMCP;
|
||||
struct CathodeMCP* instance;
|
||||
|
||||
static const char nameArray[CathodeMCP_NumberOfTypes][20] =
|
||||
{
|
||||
"Cathode repair",
|
||||
"MCP repair",
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static ErrorStatus CathodeMCP_construct(struct CathodeMCP* self);
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
struct CathodeMCP* CathodeMCP_getInstance(void)
|
||||
{
|
||||
// Check if the current PCBA is a cathodeMCP assemblage
|
||||
if (PCBA_getInstance()->pcba == PCBA_CathodeMCP)
|
||||
{
|
||||
if (instance == NULL)
|
||||
{
|
||||
instance = &thisCathodeMCP;
|
||||
ErrorStatus constructResult = CathodeMCP_construct(instance);
|
||||
|
||||
if (constructResult != SUCCESS)
|
||||
{
|
||||
instance = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
instance = NULL;
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
||||
ErrorStatus CathodeMCP_setIO(struct Gpio* mcp0, struct Gpio* mcp1, struct Gpio* mcp2, struct Gpio* cat0, struct Gpio* cat1, struct Gpio* cat2)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
if ((mcp0 != NULL) && (mcp1 != NULL) && (mcp2 != NULL) && (cat0 != NULL) && (cat1 != NULL) && (cat2 != NULL))
|
||||
{
|
||||
thisCathodeMCP.mcp0 = mcp0;
|
||||
thisCathodeMCP.mcp1 = mcp1;
|
||||
thisCathodeMCP.mcp2 = mcp2;
|
||||
|
||||
thisCathodeMCP.cat0 = cat0;
|
||||
thisCathodeMCP.cat1 = cat1;
|
||||
thisCathodeMCP.cat2 = cat2;
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
void CathodeMCP_switchToCathode(void)
|
||||
{
|
||||
thisCathodeMCP.type = CathodeMCP_Cathode;
|
||||
|
||||
GPIO_setValue(thisCathodeMCP.mcp0, false);
|
||||
GPIO_setValue(thisCathodeMCP.mcp1, false);
|
||||
GPIO_setValue(thisCathodeMCP.mcp2, false);
|
||||
|
||||
GPIO_setValue(thisCathodeMCP.cat0, true);
|
||||
GPIO_setValue(thisCathodeMCP.cat1, true);
|
||||
GPIO_setValue(thisCathodeMCP.cat2, true);
|
||||
|
||||
snprintf(thisCathodeMCP.name, (sizeof(thisCathodeMCP.name) / sizeof(thisCathodeMCP.name[0])), "%s", nameArray[thisCathodeMCP.type]);
|
||||
}
|
||||
|
||||
|
||||
void CathodeMCP_switchToMCP(void)
|
||||
{
|
||||
thisCathodeMCP.type = CathodeMCP_MCP;
|
||||
|
||||
GPIO_setValue(thisCathodeMCP.cat0, false);
|
||||
GPIO_setValue(thisCathodeMCP.cat1, false);
|
||||
GPIO_setValue(thisCathodeMCP.cat2, false);
|
||||
|
||||
GPIO_setValue(thisCathodeMCP.mcp0, true);
|
||||
GPIO_setValue(thisCathodeMCP.mcp1, true);
|
||||
GPIO_setValue(thisCathodeMCP.mcp2, true);
|
||||
|
||||
snprintf(thisCathodeMCP.name, (sizeof(thisCathodeMCP.name) / sizeof(thisCathodeMCP.name[0])), "%s", nameArray[thisCathodeMCP.type]);
|
||||
}
|
||||
|
||||
|
||||
static ErrorStatus CathodeMCP_construct(struct CathodeMCP* self)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
thisCathodeMCP.type = CathodeMCP_Cathode;
|
||||
|
||||
GPIO_setValue(thisCathodeMCP.mcp0, false);
|
||||
GPIO_setValue(thisCathodeMCP.mcp1, false);
|
||||
GPIO_setValue(thisCathodeMCP.mcp2, false);
|
||||
|
||||
GPIO_setValue(thisCathodeMCP.cat0, false);
|
||||
GPIO_setValue(thisCathodeMCP.cat1, false);
|
||||
GPIO_setValue(thisCathodeMCP.cat2, false);
|
||||
|
||||
snprintf(thisCathodeMCP.name, (sizeof(thisCathodeMCP.name) / sizeof(thisCathodeMCP.name[0])), "%s", nameArray[thisCathodeMCP.type]);
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
Reference in New Issue
Block a user