update for SWO - hw validation menu integrated

git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@239 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
mmi
2017-10-06 07:46:54 +00:00
parent ab3301889c
commit 5105d55089
12 changed files with 143 additions and 84 deletions

View File

@@ -34,7 +34,8 @@
#include "task.h"
#include "Display.h"
#include "Logger.h"
#include "hwValidationMenu.h"
#include "repairProcess.h"
#include "misc.h"
#include "stm32f10x_rcc.h"
@@ -48,6 +49,7 @@
#include "gpio.h"
#include "IODevice.h"
#include "keypadMatrix.h"
#include "Logger.h"
#include "PCBA.h"
#include "uart.h"
#include "spi.h"
@@ -88,8 +90,14 @@ static xTaskHandle sysTaskHandle;
static struct Display _display;
struct Display* display = &_display;
static struct NHD0420 nhd0420;
static struct NHD0420 nhd0420 = {.initialized = false};
static struct MAX5715 max5715 = {.initialized = false};
static struct RepairProcess _rp = {.initialized = false};
static struct HwValidationMenu _hwValidation = {.initialized = false};
static struct HwValidationMenuItems hwTestItems;
struct RepairProcess* rp = &_rp;
struct HwValidationMenu* hwValidation = &_hwValidation;
// -----------------------------------------------------------------------------
// Function declarations
@@ -139,7 +147,7 @@ static void printSystemInfoTask(void* parameters)
{
LOGGER_INFO(mainLog, "---------------------------------------");
systeminfoCommandHandler();
vTaskDelay(60000);
vTaskDelay(20000);
}
}
@@ -153,12 +161,20 @@ static ErrorStatus systeminfoCommandHandler(void)
snprintf(text, sizeof(text), "Free heap memory: %d bytes", freeMemory);
LOGGER_INFO(mainLog, text);
OS_logTaskInfo(display->taskHandle);
vTaskDelay(100);
vTaskDelay(10);
OS_logTaskInfo(ledTaskHandle);
vTaskDelay(100);
vTaskDelay(10);
OS_logTaskInfo(sysTaskHandle);
vTaskDelay(100);
vTaskDelay(10);
OS_logTaskInfo(display->taskHandle);
vTaskDelay(10);
OS_logTaskInfo(mainLog->taskHandle);
vTaskDelay(10);
OS_logTaskInfo(keypad->taskHandle);
vTaskDelay(10);
OS_logTaskInfo(rp->taskHandle);
vTaskDelay(10);
OS_logTaskInfo(hwValidation->taskHandle);
return errorStatus;
}
@@ -167,18 +183,20 @@ static void initTask(void* parameters)
{
initPlatform();
xTaskCreate(ledBlinkTask, (const char* const)"ledTask", 50, &ledTaskArguments, 0, &ledTaskHandle);
xTaskCreate(ledBlinkTask, (const char* const)"ledTask", 100, &ledTaskArguments, 0, &ledTaskHandle);
Logger_construct(mainLog, &uart1->device, 2, 512);
IODevice_write(&uart1->device, pcba->name, strlen(pcba->name));
Logger_construct(mainLog, &uart3->device, 2, 512);
NHD0420_construct(&nhd0420, &spiDisplay->device);
Display_construct(display, &nhd0420.displayDevice, 0, 1024, 10, 1000, 5000);
Display_construct(display, &nhd0420.displayDevice, 0, 256, 10, 1000, 5000);
Display_clearScreen(display);
Display_setBrightness(display, 6);
Display_setContrast(display, 40);
Display_write(display, pcba->name, strlen(pcba->name), 1, 1);
char buffer[20];
@@ -188,11 +206,31 @@ static void initTask(void* parameters)
Version_getInstance()->patch);
Display_write(display, buffer, strlen(buffer), 3, 4);
hwTestItems.display = &nhd0420.displayDevice;
hwTestItems.internalADC = adc1;
hwTestItems.externalDAC = &max5715;
hwTestItems.power6v5Enable = NULL;
hwTestItems.interlock1 = NULL;
hwTestItems.interlock2 = NULL;
hwTestItems.solenoid = NULL;
hwTestItems.mcp0Relay = NULL;
hwTestItems.mcp1Relay = NULL;
hwTestItems.mcp2Relay = NULL;
hwTestItems.cat0Relay = NULL;
hwTestItems.cat1Relay = NULL;
hwTestItems.cat2Relay = NULL;
hwTestItems.pcba = pcba;
// EEPROM TO BE DONE
HwValidationMenu_construct(hwValidation, &uart1->device, &hwTestItems, 2, 1024);
MAX5715_construct(&max5715, &spiDAC->device);
MAX5715_writeCODEn(&max5715, (MAX5715_SEL_DACA | MAX5715_SEL_DACC), 0x579B);
MAX5715_writeREF_ON_2V5(&max5715, MAX5715_SEL_DACA | MAX5715_SEL_DACB | MAX5715_SEL_DACC);
repairProcess_construct(rp, 3, 1024);
xTaskCreate(printSystemInfoTask, (const char* const)"SysInfoTask", 512, NULL, 1, &sysTaskHandle);
// Delete this init task
vTaskDelete(NULL);
@@ -209,8 +247,10 @@ static void ledBlinkTask (void* parameters)
while (1)
{
IODevice_write(&gpio->device, &high, 1);
Display_write(display, pcba->name, 1, 1, 20);
vTaskDelay(configTICK_RATE_HZ / (frequency * 2));
IODevice_write(&gpio->device, &low, 1);
Display_write(display, " ", 1, 1, 20);
vTaskDelay(configTICK_RATE_HZ / (frequency * 2));
}
}