Replaced verification of voltageFree rows with HighVoltageDetection module
Added LED module git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@338 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
@@ -37,6 +37,8 @@
|
||||
#include "stm32f10x_rcc.h"
|
||||
#include "stm32f10x_it.h"
|
||||
|
||||
#include "HighVoltageDetection.h"
|
||||
#include "Leds.h"
|
||||
#include "Logger.h"
|
||||
|
||||
#include "platform.h"
|
||||
@@ -194,7 +196,16 @@ struct Gpio* const ledInternGreen = &_ledInternGreen;
|
||||
struct Gpio* const ledInternOrange = &_ledInternOrange;
|
||||
struct Gpio* const ledBicolourGreen = &_ledBicolourGreen;
|
||||
struct Gpio* const ledBicolourRed = &_ledBicolourRed;
|
||||
struct Gpio* const solenoid = &_solenoid;
|
||||
struct Gpio* const buzzer = &_buzzer;
|
||||
struct Gpio* const mcp0Relay = &_mcp0Relay;
|
||||
struct Gpio* const mcp1Relay = &_mcp1Relay;
|
||||
struct Gpio* const mcp2Relay = &_mcp2Relay;
|
||||
struct Gpio* const cat0Relay = &_cat0Relay;
|
||||
struct Gpio* const cat1Relay = &_cat1Relay;
|
||||
struct Gpio* const cat2Relay = &_cat2Relay;
|
||||
struct Gpio* const teslaRelay = &_teslaRelay;
|
||||
|
||||
struct Gpio* const hv0Present = &_hv0Present;
|
||||
struct Gpio* const hv1Present = &_hv1Present;
|
||||
struct Gpio* const hv2Present = &_hv2Present;
|
||||
@@ -622,10 +633,14 @@ static ErrorStatus initPeriphery(void)
|
||||
/* --------------------------------------------------------------------*/
|
||||
/* GPIOs */
|
||||
/* --------------------------------------------------------------------*/
|
||||
// Green LED
|
||||
// Green onboard LED
|
||||
GPIO_construct(ledInternGreen, OUTPUT, ledInternGreen->gpio);
|
||||
// Orange LED
|
||||
// Orange onboard LED
|
||||
GPIO_construct(ledInternOrange, OUTPUT, ledInternOrange->gpio);
|
||||
// Bicolour green
|
||||
GPIO_construct(ledBicolourGreen, OUTPUT, ledBicolourGreen->gpio);
|
||||
// Bicolour red
|
||||
GPIO_construct(ledBicolourRed, OUTPUT, ledBicolourRed->gpio);
|
||||
|
||||
IRQ_setInterruptProperties(EXTI0_IRQn, 12, 0, ENABLE);
|
||||
IRQ_setInterruptProperties(EXTI1_IRQn, 12, 0, ENABLE);
|
||||
@@ -637,27 +652,32 @@ static ErrorStatus initPeriphery(void)
|
||||
GPIO_construct(&_interlockNC, INPUT, _interlockNC.gpio);
|
||||
|
||||
// Solenoid
|
||||
GPIO_construct(&_solenoid, OUTPUT, _solenoid.gpio);
|
||||
GPIO_construct(solenoid, OUTPUT, solenoid->gpio);
|
||||
|
||||
// HV detection
|
||||
GPIO_construct(hv0Present, INPUT, hv0Present->gpio);
|
||||
GPIO_construct(hv1Present, INPUT, hv1Present->gpio);
|
||||
GPIO_construct(hv2Present, INPUT, hv2Present->gpio);
|
||||
|
||||
|
||||
if (PCBA_getInstance()->pcba == PCBA_CathodeMCP)
|
||||
{
|
||||
// MCP0Relay
|
||||
GPIO_construct(&_mcp0Relay, OUTPUT, _mcp0Relay.gpio);
|
||||
GPIO_construct(mcp0Relay, OUTPUT, mcp0Relay->gpio);
|
||||
// MCP1Relay
|
||||
GPIO_construct(&_mcp1Relay, OUTPUT, _mcp1Relay.gpio);
|
||||
GPIO_construct(mcp1Relay, OUTPUT, mcp1Relay->gpio);
|
||||
// MCP2Relay
|
||||
GPIO_construct(&_mcp2Relay, OUTPUT, _mcp2Relay.gpio);
|
||||
GPIO_construct(mcp2Relay, OUTPUT, mcp2Relay->gpio);
|
||||
// CAT0Relay
|
||||
GPIO_construct(&_cat0Relay, OUTPUT, _cat0Relay.gpio);
|
||||
GPIO_construct(cat0Relay, OUTPUT, cat0Relay->gpio);
|
||||
// CAT1Relay
|
||||
GPIO_construct(&_cat1Relay, OUTPUT, _cat1Relay.gpio);
|
||||
GPIO_construct(cat1Relay, OUTPUT, cat1Relay->gpio);
|
||||
// CAT2Relay
|
||||
GPIO_construct(&_cat2Relay, OUTPUT, _cat2Relay.gpio);
|
||||
GPIO_construct(cat2Relay, OUTPUT, cat2Relay->gpio);
|
||||
}
|
||||
if (PCBA_getInstance()->pcba == PCBA_Tesla)
|
||||
{
|
||||
GPIO_construct(&_teslaRelay, OUTPUT, _teslaRelay.gpio);
|
||||
GPIO_construct(teslaRelay, OUTPUT, teslaRelay->gpio);
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
@@ -668,63 +688,96 @@ static ErrorStatus initPlatformDevices (void)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
/* --------------------------------------------------------------------*/
|
||||
/* LEDs */
|
||||
/* --------------------------------------------------------------------*/
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
CathodeMCP_setIO(&_mcp0Relay, &_mcp1Relay, &_mcp2Relay, &_cat0Relay, &_cat1Relay, &_cat2Relay);
|
||||
// Construct the LEDs
|
||||
returnValue = Led_construct(ledInternGreen, ledInternOrange, ledBicolourGreen, ledBicolourRed);
|
||||
}
|
||||
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
Interlock_construct(interlock, COMMON_INTERLOCK, &_interlockNO, _interlockNOEXTI, &_interlockNC, _interlockNCEXTI, INTERLOCK_DEBOUNCE_TIME_MS);
|
||||
returnValue = HighVoltageDetection_construct(hv0Present, hv1Present, hv2Present);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------*/
|
||||
/* CathodeMCP switches */
|
||||
/* --------------------------------------------------------------------*/
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
CoverSolenoid_construct(&_solenoid);
|
||||
if (PCBA_getInstance()->pcba == PCBA_CathodeMCP)
|
||||
{
|
||||
returnValue = CathodeMCP_setIO(mcp0Relay, mcp1Relay, mcp2Relay, cat0Relay, cat1Relay, cat2Relay);
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------*/
|
||||
/* Interlock */
|
||||
/* --------------------------------------------------------------------*/
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
TeslaGunSafety_construct(&_teslaRelay);
|
||||
returnValue = Interlock_construct(interlock, COMMON_INTERLOCK, &_interlockNO, _interlockNOEXTI, &_interlockNC, _interlockNCEXTI, INTERLOCK_DEBOUNCE_TIME_MS);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------*/
|
||||
/* Solenoids */
|
||||
/* --------------------------------------------------------------------*/
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
returnValue = CoverSolenoid_construct(solenoid);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------*/
|
||||
/* TeslaGun Safety */
|
||||
/* --------------------------------------------------------------------*/
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
if (PCBA_getInstance()->pcba == PCBA_Tesla)
|
||||
{
|
||||
returnValue = TeslaGunSafety_construct(teslaRelay);
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------*/
|
||||
/* LOGGER */
|
||||
/* --------------------------------------------------------------------*/
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
/* --------------------------------------------------------------------*/
|
||||
/* LOGGER */
|
||||
/* --------------------------------------------------------------------*/
|
||||
returnValue = Logger_construct(mainLog, &uart1->device, 1, 512);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------*/
|
||||
/* KEYPAD MATRIX */
|
||||
/* --------------------------------------------------------------------*/
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
/* --------------------------------------------------------------------*/
|
||||
/* KEYPAD MATRIX */
|
||||
/* --------------------------------------------------------------------*/
|
||||
returnValue = Keypad_construct(keypad, STORM700_NUMBER_OF_ROWS, STORM700_NUMBER_OF_COLUMNS, KEYPAD_DEBOUNCE_TIME_MS, KEYPAD_TASK_PRIORITY, KEYPAD_STACK_SIZE, KEYPAD_DEF_QUEUESIZE);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------*/
|
||||
/* STORM700 Keypad */
|
||||
/* --------------------------------------------------------------------*/
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
/* --------------------------------------------------------------------*/
|
||||
/* STORM700 Keypad */
|
||||
/* --------------------------------------------------------------------*/
|
||||
returnValue = Storm700_construct(storm700, &keypad->device);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------*/
|
||||
/* NewHavenDispplay 04 20 */
|
||||
/* --------------------------------------------------------------------*/
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
/* --------------------------------------------------------------------*/
|
||||
/* NewHavenDispplay 04 20 */
|
||||
/* --------------------------------------------------------------------*/
|
||||
returnValue = NHD0420_construct(nhd0420, &spiDisplay->device);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------*/
|
||||
/* MAX5715 external Quad DAC */
|
||||
/* --------------------------------------------------------------------*/
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
/* --------------------------------------------------------------------*/
|
||||
/* MAX5715 external Quad DAC */
|
||||
/* --------------------------------------------------------------------*/
|
||||
// Construct MAX5715
|
||||
returnValue = MAX5715_construct(max5715, &spiDAC->device);
|
||||
// Set external DAC reference to 2V5, always ON
|
||||
|
||||
Reference in New Issue
Block a user