ADC debugged and functional now
Added Version interface Added DisplayDevice to create an independent bridge between display app and specific display driver git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@228 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
@@ -24,12 +24,9 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
// Include files
|
||||
// -----------------------------------------------------------------------------
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "PCBA.h"
|
||||
|
||||
#include "Logger.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -46,7 +43,9 @@
|
||||
// File-scope variables
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static bool initialized = false;
|
||||
static struct Pcba* instance = NULL;
|
||||
static struct Pcba thisPCBA;
|
||||
|
||||
static const char nameArray[4][20] =
|
||||
{
|
||||
"Cathode/MCP repair ",
|
||||
@@ -59,30 +58,38 @@ static const char nameArray[4][20] =
|
||||
// Function declarations
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
static ErrorStatus PCBA_construct(struct Pcba* self);
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
ErrorStatus PCBA_construct(struct Pcba* self)
|
||||
struct Pcba* PCBA_getInstance(void)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
if (!initialized)
|
||||
if (instance == NULL)
|
||||
{
|
||||
instance = &thisPCBA;
|
||||
returnValue = PCBA_construct(instance);
|
||||
|
||||
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]);
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user