Updated all GPIO to PCBA updated version
Added LED module git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@321 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
@@ -42,7 +42,7 @@
|
||||
#define MAINDISP_REFRESH_FEED_MS (1000)
|
||||
#define MAINDISP_REFRESH_PERIOD (5000)
|
||||
|
||||
#define MAINDISP_DEFAULT_BRIGHTNESS (5)
|
||||
#define MAINDISP_DEFAULT_BRIGHTNESS (8) // Set to MAX to avoid background light issue
|
||||
#define MAINDISP_DEFAULT_CONTRAST (40)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Type definitions
|
||||
@@ -61,6 +61,7 @@ struct Display* const mainDisplay = &_mainDisplay;
|
||||
// Function declarations
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static ErrorStatus Displays_initMainDisplay(void);
|
||||
static ErrorStatus Displays_mainDisplayObserverFromISR(const void* const data);
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -71,6 +72,26 @@ ErrorStatus Displays_construct(void)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
returnValue = Displays_initMainDisplay();
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
extern void Displays_destruct(void)
|
||||
{
|
||||
Observable_deleteObserver(RTC_getObservable(rtc), Displays_mainDisplayObserverFromISR);
|
||||
Display_destruct(mainDisplay);
|
||||
}
|
||||
|
||||
|
||||
static ErrorStatus Displays_initMainDisplay(void)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
returnValue = Display_construct(mainDisplay, &nhd0420->displayDevice, HSB_MAINDISP_TASK_PRIORITY, HSB_MAINDISP_TASK_STACKSIZE, MAINDISP_MAX_CHAR_CHUNK, MAINDISP_REFRESH_FEED_MS, MAINDISP_REFRESH_PERIOD);
|
||||
@@ -105,13 +126,6 @@ ErrorStatus Displays_construct(void)
|
||||
}
|
||||
|
||||
|
||||
extern void Displays_destruct(void)
|
||||
{
|
||||
Observable_deleteObserver(RTC_getObservable(rtc), Displays_mainDisplayObserverFromISR);
|
||||
Display_destruct(mainDisplay);
|
||||
}
|
||||
|
||||
|
||||
static ErrorStatus Displays_mainDisplayObserverFromISR(const void* const data)
|
||||
{
|
||||
Display_feedRefreshCounterFromISR(mainDisplay);
|
||||
|
||||
@@ -173,7 +173,7 @@ static void MenuCore_task(void* parameters)
|
||||
MenuCore_printCursor(self);
|
||||
}
|
||||
}
|
||||
vTaskDelay(100);
|
||||
vTaskDelay(50);
|
||||
}
|
||||
|
||||
LOGGER_INFO(mainLog, "Deleting MenuCore task");
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
#include "CathodeMCP.h"
|
||||
#include "CoverSolenoid.h"
|
||||
#include "Interlock.h"
|
||||
#include "Leds.h"
|
||||
#include "Logger.h"
|
||||
#include "nhd0420.h"
|
||||
#include "TeslaGunSafety.h"
|
||||
@@ -73,7 +74,7 @@ tick hook. */
|
||||
|
||||
struct LedTaskArguments
|
||||
{
|
||||
struct Gpio* led;
|
||||
Led led;
|
||||
int frequency;
|
||||
};
|
||||
|
||||
@@ -119,7 +120,7 @@ int main (void)
|
||||
|
||||
// Create TaskHandles
|
||||
|
||||
ledTaskArguments.led = ledOrange;
|
||||
ledTaskArguments.led = LED_ONBOARD_ORANGE;
|
||||
ledTaskArguments.frequency = 1;
|
||||
|
||||
xTaskCreate(initTask, (const char* const)"initTask", 1024, NULL, 5, &initTaskHandle);
|
||||
@@ -192,6 +193,12 @@ static void initTask(void* parameters)
|
||||
initPlatform();
|
||||
}
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
// Construct the LEDs
|
||||
Led_construct();
|
||||
}
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
// Construct the displays
|
||||
@@ -235,7 +242,7 @@ static void initTask(void* parameters)
|
||||
hwTestItems.display = &nhd0420->displayDevice;
|
||||
hwTestItems.internalADC = adc1;
|
||||
hwTestItems.externalDAC = max5715;
|
||||
hwTestItems.power6v5Enable = Power6V5Supply_getGPIO();
|
||||
// hwTestItems.power6v5Enable = Power6V5Supply_getGPIO();
|
||||
hwTestItems.interlockNO = interlock->NO.io;
|
||||
hwTestItems.interlockNC = interlock->NC.io;
|
||||
hwTestItems.TeslaSecurity = TeslaGunSafety_getGpio();
|
||||
@@ -249,7 +256,7 @@ static void initTask(void* parameters)
|
||||
hwTestItems.pcba = PCBA_getInstance();
|
||||
hwTestItems.keypad = keypad;
|
||||
// EEPROM TO BE DONE
|
||||
HwValidationMenu_construct(hwValidation, &uart1->device, &hwTestItems, 1, 1024);
|
||||
HwValidationMenu_construct(hwValidation, &uart3->device, &hwTestItems, 1, 1024);
|
||||
}
|
||||
#endif
|
||||
if (returnValue == SUCCESS)
|
||||
@@ -273,17 +280,15 @@ static void initTask(void* parameters)
|
||||
|
||||
static void ledBlinkTask (void* parameters)
|
||||
{
|
||||
char high = 1;
|
||||
char low = 0;
|
||||
char indicator[2];
|
||||
indicator[0] = ' ';
|
||||
indicator[1] = '\0';
|
||||
struct LedTaskArguments* arguments = (struct LedTaskArguments*) parameters;
|
||||
struct Gpio* gpio = arguments->led;
|
||||
int frequency = arguments->frequency;
|
||||
while (1)
|
||||
{
|
||||
IODevice_write(&gpio->device, &high, 1);
|
||||
Led_on(arguments->led);
|
||||
|
||||
if (PCBA_getInstance()->pcba == PCBA_CathodeMCP)
|
||||
{
|
||||
indicator[0] = CathodeMCP_getInstance()->name[0];
|
||||
@@ -296,7 +301,7 @@ static void ledBlinkTask (void* parameters)
|
||||
}
|
||||
|
||||
vTaskDelay(configTICK_RATE_HZ / (frequency * 2));
|
||||
IODevice_write(&gpio->device, &low, 1);
|
||||
Led_off(arguments->led);
|
||||
indicator[0] = ' ';
|
||||
// Display_write(mainDisplay, indicator, 1, 20);
|
||||
vTaskDelay(configTICK_RATE_HZ / (frequency * 2));
|
||||
|
||||
Reference in New Issue
Block a user