Going on with structure

Added observer/observable for RTC

git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@251 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
mmi
2017-10-12 20:53:05 +00:00
parent 54b6afe5a3
commit c323bfd04e
23 changed files with 1067 additions and 513 deletions

View File

@@ -33,9 +33,11 @@
#include "FreeRTOS.h"
#include "task.h"
#include "Display.h"
#include "Displays.h"
#include "hsb-mrts.h"
#include "hwValidationMenu.h"
#include "repairMenu.h"
#include "repairMenus.h"
#include "repairProcess.h"
#include "misc.h"
@@ -45,9 +47,9 @@
#include "KeyboardDevice.h"
#include "MAX5715.h"
#include "nhd0420.h"
#include "storm700.h"
#include "platform.h"
#include "Interlock.h"
#include "internalADC.h"
#include "gpio.h"
#include "IODevice.h"
@@ -57,7 +59,6 @@
#include "uart.h"
#include "spi.h"
#include "spiDevice.h"
#include "Version.h"
// -----------------------------------------------------------------------------
// Constant and macro definitions
@@ -91,23 +92,13 @@ static xTaskHandle initTaskHandle;
static xTaskHandle ledTaskHandle;
static xTaskHandle sysTaskHandle;
static struct Display _display = {.initialized = false};
struct Display* display = &_display;
static struct NHD0420 nhd0420 = {.initialized = false};
static struct MAX5715 max5715 = {.initialized = false};
static struct RepairMenu _rm = {.initialized = false};
static struct HwValidationMenu _hwValidation = {.initialized = false};
static struct HwValidationMenuItems hwTestItems;
struct MAX5715* dac = &max5715;
struct RepairMenu* rm = &_rm;
struct HwValidationMenu* hwValidation = &_hwValidation;
static struct Storm700 _storm700 = {.initialized = false};
struct Storm700* storm700 = &_storm700;
// -----------------------------------------------------------------------------
// Function declarations
@@ -175,72 +166,35 @@ static ErrorStatus systeminfoCommandHandler(void)
OS_logTaskInfo(ledTaskHandle);
vTaskDelay(10);
OS_logTaskInfo(sysTaskHandle);
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(rm->taskHandle);
vTaskDelay(10);
OS_logTaskInfo(hwValidation->taskHandle);
return errorStatus;
}
static void initTask(void* parameters)
{
// Initialize the platform first
// All IO is initialized here
// Also, all periphery and platform-specifics are initialized here
// IRQs are defined here
initPlatform();
// Create a small task that only blinks a LED and flashes the identification letter on the display
xTaskCreate(ledBlinkTask, (const char* const)"ledTask", 100, &ledTaskArguments, 0, &ledTaskHandle);
Logger_construct(mainLog, &uart1->device, 1, 512);
Storm700_construct(storm700, &keypad->device);
NHD0420_construct(&nhd0420, &spiDisplay->device);
Display_construct(display, &nhd0420.displayDevice, 2, 256, 10, 1000, 10000);
Display_clearScreen(display);
Display_setBrightness(display, 6);
Display_setContrast(display, 40);
Display_write(display, pcba->name, strlen(pcba->name), 1, 1);
char buffer[20];
snprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), "SW V. %d.%d.%d.%d", Version_getInstance()->major,
Version_getInstance()->minor,
Version_getInstance()->branch,
Version_getInstance()->patch);
Display_write(display, buffer, strlen(buffer), 3, 4);
MAX5715_construct(&max5715, &spiDAC->device);
MAX5715_writeREF_ON_2V5(&max5715);
MAX5715_writePOWER_NORMAL(&max5715, MAX5715_SEL_DACA | MAX5715_SEL_DACB | MAX5715_SEL_DACC);
MAX5715_writeCONFIG_LATCH_OFF(&max5715, MAX5715_SEL_DACA | MAX5715_SEL_DACB | MAX5715_SEL_DACC);
MAX5715Channel_construct(&dac->dac[0], dac, 0);
MAX5715Channel_construct(&dac->dac[1], dac, 1);
MAX5715Channel_construct(&dac->dac[2], dac, 2);
// Construct the displays
Displays_construct();
// xTaskCreate(printSystemInfoTask, (const char* const)"SysInfoTask", 512, NULL, 0, &sysTaskHandle);
hsb_generateStartScreen(mainDisplay);
// Let start screen stay for 5 seconds
vTaskDelay(INIT_START_SCREEN_DELAY);
hwTestItems.display = &nhd0420.displayDevice;
hwTestItems.display = &nhd0420->displayDevice;
hwTestItems.internalADC = adc1;
hwTestItems.externalDAC = &max5715;
hwTestItems.externalDAC = max5715;
hwTestItems.power6v5Enable = power6v5Enable;
hwTestItems.interlockNO = interlockNO;
hwTestItems.interlockNC = interlockNC;
@@ -258,8 +212,14 @@ static void initTask(void* parameters)
// EEPROM TO BE DONE
// HwValidationMenu_construct(hwValidation, &uart1->device, &hwTestItems, 1, 1024);
Interlock_setEXTI(interlock, ENABLE);
if (PCBA_getInstance()->pcba == Tesla)
{
Interlock_setEXTI(teslalock, ENABLE);
}
// Construct the repair menu
repairMenu_construct(rm, display, 2, 512);
repairMenus_construct();
// Delete this init task
vTaskDelete(NULL);
@@ -276,10 +236,10 @@ static void ledBlinkTask (void* parameters)
while (1)
{
IODevice_write(&gpio->device, &high, 1);
Display_write(display, pcba->name, 1, 1, 20);
Display_write(mainDisplay, pcba->name, 1, 1, 20);
vTaskDelay(configTICK_RATE_HZ / (frequency * 2));
IODevice_write(&gpio->device, &low, 1);
Display_write(display, " ", 1, 1, 20);
Display_write(mainDisplay, " ", 1, 1, 20);
vTaskDelay(configTICK_RATE_HZ / (frequency * 2));
}
}