display has now a refresh timer to totally refresh the display contents (to prevent EMC issues) Fixed PCBA names git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@229 05563f52-14a8-4384-a975-3d1654cca0fa
96 lines
2.9 KiB
C
96 lines
2.9 KiB
C
// -----------------------------------------------------------------------------
|
|
/// @file PCBA.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 PCBA.c
|
|
/// @ingroup {group_name}
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Include files
|
|
// -----------------------------------------------------------------------------
|
|
|
|
#include "PCBA.h"
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Constant and macro definitions
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Type definitions
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// File-scope variables
|
|
// -----------------------------------------------------------------------------
|
|
|
|
static struct Pcba* instance = NULL;
|
|
static struct Pcba thisPCBA;
|
|
|
|
static const char nameArray[4][20] =
|
|
{
|
|
"Cathode/MCP repair",
|
|
"Tesla repair",
|
|
"Anode repair",
|
|
"UNDEFINED PCBA",
|
|
};
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Function declarations
|
|
// -----------------------------------------------------------------------------
|
|
|
|
static ErrorStatus PCBA_construct(struct Pcba* self);
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Function definitions
|
|
// -----------------------------------------------------------------------------
|
|
|
|
struct Pcba* PCBA_getInstance(void)
|
|
{
|
|
ErrorStatus returnValue = SUCCESS;
|
|
|
|
if (instance == NULL)
|
|
{
|
|
instance = &thisPCBA;
|
|
returnValue = PCBA_construct(instance);
|
|
|
|
if (returnValue != SUCCESS)
|
|
{
|
|
instance = NULL;
|
|
}
|
|
}
|
|
return instance;
|
|
}
|
|
|
|
static ErrorStatus PCBA_construct(struct Pcba* self)
|
|
{
|
|
ErrorStatus returnValue = SUCCESS;
|
|
|
|
uint8_t A0 = GPIO_ReadInputDataBit(self->A0.GPIO_Typedef, self->A0.GPIO_InitStruct.GPIO_Pin);
|
|
uint8_t A1 = GPIO_ReadInputDataBit(self->A1.GPIO_Typedef, self->A1.GPIO_InitStruct.GPIO_Pin);
|
|
|
|
self->pcba = (A0 & 0x01) | ((A1 << 1) & 0x02);
|
|
snprintf(self->name, (sizeof(self->name) / sizeof(self->name[0])), "%s", nameArray[self->pcba]);
|
|
|
|
return returnValue;
|
|
}
|