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:
@@ -82,8 +82,10 @@ extern struct Storm700* const storm700;
|
||||
// internal FLASH
|
||||
extern struct InternalFlash* const iFlash;
|
||||
// Export of GPIOs
|
||||
extern struct Gpio* const ledGreen;
|
||||
extern struct Gpio* const ledOrange;
|
||||
extern struct Gpio* const ledInternGreen;
|
||||
extern struct Gpio* const ledInternOrange;
|
||||
extern struct Gpio* const ledBicolourGreen;
|
||||
extern struct Gpio* const ledBicolourRed;
|
||||
|
||||
extern struct Interlock* const interlock;
|
||||
|
||||
|
||||
@@ -135,8 +135,11 @@ static struct Storm700 _storm700 = {.initialized = false};
|
||||
static struct InternalFlash _iFlash = {.initialized = false};
|
||||
|
||||
// GPIOs
|
||||
static struct Gpio _ledGreen = {.initialized = false};
|
||||
static struct Gpio _ledOrange = {.initialized = false};
|
||||
static struct Gpio _ledInternGreen = {.initialized = false};
|
||||
static struct Gpio _ledInternOrange = {.initialized = false};
|
||||
static struct Gpio _ledBicolourGreen = {.initialized = false};
|
||||
static struct Gpio _ledBicolourRed = {.initialized = false};
|
||||
static struct Gpio _buzzer = {.initialized = false};
|
||||
static struct Gpio _interlockNO = {.initialized = false};
|
||||
static EXTI_InitTypeDef _interlockNOEXTI;
|
||||
static struct Gpio _interlockNC = {.initialized = false};
|
||||
@@ -149,6 +152,9 @@ static struct Gpio _cat0Relay = {.initialized = false};
|
||||
static struct Gpio _cat1Relay = {.initialized = false};
|
||||
static struct Gpio _cat2Relay = {.initialized = false};
|
||||
static struct Gpio _teslaRelay = {.initialized = false};
|
||||
static struct Gpio _hv0Present = {.initialized = false};
|
||||
static struct Gpio _hv1Present = {.initialized = false};
|
||||
static struct Gpio _hv2Present = {.initialized = false};
|
||||
|
||||
static struct Interlock _interlock = {.initialized = false};
|
||||
|
||||
@@ -184,9 +190,14 @@ struct Storm700* const storm700 = &_storm700;
|
||||
|
||||
struct InternalFlash* const iFlash = &_iFlash;
|
||||
|
||||
struct Gpio* const ledGreen = &_ledGreen;
|
||||
struct Gpio* const ledOrange = &_ledOrange;
|
||||
|
||||
struct Gpio* const ledInternGreen = &_ledInternGreen;
|
||||
struct Gpio* const ledInternOrange = &_ledInternOrange;
|
||||
struct Gpio* const ledBicolourGreen = &_ledBicolourGreen;
|
||||
struct Gpio* const ledBicolourRed = &_ledBicolourRed;
|
||||
struct Gpio* const buzzer = &_buzzer;
|
||||
struct Gpio* const hv0Present = &_hv0Present;
|
||||
struct Gpio* const hv1Present = &_hv1Present;
|
||||
struct Gpio* const hv2Present = &_hv2Present;
|
||||
|
||||
struct Interlock* const interlock = &_interlock;
|
||||
|
||||
@@ -322,11 +333,25 @@ static ErrorStatus initIO (void)
|
||||
|
||||
|
||||
/*LED IO initialisation --------------------------------------------------*/
|
||||
// Init LED Green
|
||||
ledGreen->gpio = configureGPIO(GPIOC, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_Pin_6);
|
||||
// Init LED Green on DevKit
|
||||
ledInternGreen->gpio = configureGPIO(GPIOC, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_Pin_6);
|
||||
// Init LED Orange on DevKit
|
||||
ledInternOrange->gpio = configureGPIO(GPIOC, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_Pin_7);
|
||||
// Init LED Green of BiColour led
|
||||
ledBicolourGreen->gpio = configureGPIO(GPIOE, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_PinSource11);
|
||||
// Init LED Red of BiColour led
|
||||
ledBicolourRed->gpio = configureGPIO(GPIOE, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_PinSource13);
|
||||
|
||||
// Init LED Orange
|
||||
ledOrange->gpio = configureGPIO(GPIOC, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_Pin_7);
|
||||
/* BUZZER initialisation -------------------------------------------------*/
|
||||
buzzer->gpio = configureGPIO(GPIOE, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_PinSource12);
|
||||
|
||||
/* HIGH VOLTAGE PRESENT initialisation -----------------------------------*/
|
||||
// HV0 Present
|
||||
hv0Present->gpio = configureGPIO(GPIOB, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_PinSource12);
|
||||
// HV1 Present
|
||||
hv1Present->gpio = configureGPIO(GPIOB, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_PinSource13);
|
||||
// HV2 Present
|
||||
hv2Present->gpio = configureGPIO(GPIOB, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_PinSource14);
|
||||
|
||||
/* ADC1 initialisation ---------------------------------------------------*/
|
||||
// Channel 0 - PA0
|
||||
@@ -346,22 +371,11 @@ static ErrorStatus initIO (void)
|
||||
GPIO_PinRemapConfig(GPIO_Remap_USART1, ENABLE);
|
||||
|
||||
/* USART3 initialisation -------------------------------------------------*/
|
||||
// For PCBA 0 (Cathode/MCP) and 2 (Anode), use the common USART3 IO
|
||||
if ((PCBA_getInstance()->pcba == PCBA_Anode) || (PCBA_getInstance()->pcba == PCBA_CathodeMCP))
|
||||
{
|
||||
// Init TX line
|
||||
uart3->USART_TX = configureGPIO(GPIOB, GPIO_Mode_AF_PP, GPIO_Speed_50MHz, GPIO_Pin_10);
|
||||
// Init RX line
|
||||
uart1->USART_RX = configureGPIO(GPIOB, GPIO_Mode_IN_FLOATING, GPIO_Speed_50MHz, GPIO_Pin_11);
|
||||
}
|
||||
else if (PCBA_getInstance()->pcba == PCBA_Tesla)
|
||||
{
|
||||
// Init TX line
|
||||
uart3->USART_TX = configureGPIO(GPIOD, GPIO_Mode_AF_PP, GPIO_Speed_50MHz, GPIO_Pin_8);
|
||||
// Init RX line
|
||||
uart1->USART_RX = configureGPIO(GPIOD, GPIO_Mode_IN_FLOATING, GPIO_Speed_50MHz, GPIO_Pin_9);
|
||||
GPIO_PinRemapConfig(GPIO_FullRemap_USART3, ENABLE);
|
||||
}
|
||||
// Init TX line
|
||||
uart3->USART_TX = configureGPIO(GPIOB, GPIO_Mode_AF_PP, GPIO_Speed_50MHz, GPIO_Pin_10);
|
||||
// Init RX line
|
||||
uart1->USART_RX = configureGPIO(GPIOB, GPIO_Mode_IN_FLOATING, GPIO_Speed_50MHz, GPIO_Pin_11);
|
||||
|
||||
|
||||
/* SPI initialisation ----------------------------------------------------*/
|
||||
// SPI1 CLK
|
||||
@@ -403,13 +417,13 @@ static ErrorStatus initIO (void)
|
||||
keypad->row[3].gpio = configureGPIO(GPIOD, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_Pin_3);
|
||||
|
||||
// Column1
|
||||
keypad->column[0].gpio = configureGPIO(GPIOD, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_Pin_4);
|
||||
keypad->column[0].gpio = configureGPIO(GPIOD, GPIO_Mode_IPU, GPIO_Speed_50MHz, GPIO_Pin_4);
|
||||
// Column2
|
||||
keypad->column[1].gpio = configureGPIO(GPIOD, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_Pin_5);
|
||||
keypad->column[1].gpio = configureGPIO(GPIOD, GPIO_Mode_IPU, GPIO_Speed_50MHz, GPIO_Pin_5);
|
||||
// Column3
|
||||
keypad->column[2].gpio = configureGPIO(GPIOD, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_Pin_6);
|
||||
keypad->column[2].gpio = configureGPIO(GPIOD, GPIO_Mode_IPU, GPIO_Speed_50MHz, GPIO_Pin_6);
|
||||
// Column4
|
||||
keypad->column[3].gpio = configureGPIO(GPIOD, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_Pin_7);
|
||||
keypad->column[3].gpio = configureGPIO(GPIOD, GPIO_Mode_IPU, GPIO_Speed_50MHz, GPIO_Pin_7);
|
||||
|
||||
/* GPIO initialisation ---------------------------------------------------*/
|
||||
// Interlock1 - PB0 input
|
||||
@@ -441,7 +455,7 @@ static ErrorStatus initIO (void)
|
||||
if (PCBA_getInstance()->pcba == PCBA_Tesla)
|
||||
{
|
||||
// Tesla Gun relay PB9
|
||||
_teslaRelay.gpio = configureGPIO(GPIOB, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_Pin_9);
|
||||
_teslaRelay.gpio = configureGPIO(GPIOE, GPIO_Mode_Out_PP, GPIO_Speed_50MHz, GPIO_Pin_3);
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
@@ -583,29 +597,17 @@ static ErrorStatus initPeriphery(void)
|
||||
/* KEYPAD COLUMNS */
|
||||
/* --------------------------------------------------------------------*/
|
||||
// Set-up the interrupts for the Keypad columns
|
||||
keypad->column[0].EXTI_InitStruct.EXTI_Line = EXTI_Line4;
|
||||
keypad->column[0].EXTI_InitStruct.EXTI_Mode = EXTI_Mode_Interrupt;
|
||||
keypad->column[0].EXTI_InitStruct.EXTI_Trigger = EXTI_Trigger_Rising_Falling;
|
||||
keypad->column[0].EXTI_InitStruct.EXTI_LineCmd = ENABLE;
|
||||
EXTI_Init(&keypad->column[0].EXTI_InitStruct);
|
||||
GPIO_EXTILineConfig(GPIO_PortSourceGPIOD, GPIO_PinSource4);
|
||||
keypad->column[0].EXTI_InitStruct = configureEXTI(EXTI_Line4, EXTI_Mode_Interrupt, EXTI_Trigger_Rising_Falling, ENABLE);
|
||||
// Enable the interrupts for the Keypad columns
|
||||
keypad->column[1].EXTI_InitStruct.EXTI_Line = EXTI_Line5;
|
||||
keypad->column[1].EXTI_InitStruct.EXTI_Mode = EXTI_Mode_Interrupt;
|
||||
keypad->column[1].EXTI_InitStruct.EXTI_Trigger = EXTI_Trigger_Rising_Falling;
|
||||
keypad->column[1].EXTI_InitStruct.EXTI_LineCmd = ENABLE;
|
||||
EXTI_Init(&keypad->column[1].EXTI_InitStruct);
|
||||
GPIO_EXTILineConfig(GPIO_PortSourceGPIOD, GPIO_PinSource5);
|
||||
keypad->column[1].EXTI_InitStruct = configureEXTI(EXTI_Line5, EXTI_Mode_Interrupt, EXTI_Trigger_Rising_Falling, ENABLE);
|
||||
// Enable the interrupts for the Keypad columns
|
||||
keypad->column[2].EXTI_InitStruct.EXTI_Line = EXTI_Line6;
|
||||
keypad->column[2].EXTI_InitStruct.EXTI_Mode = EXTI_Mode_Interrupt;
|
||||
keypad->column[2].EXTI_InitStruct.EXTI_Trigger = EXTI_Trigger_Rising_Falling;
|
||||
keypad->column[2].EXTI_InitStruct.EXTI_LineCmd = ENABLE;
|
||||
EXTI_Init(&keypad->column[2].EXTI_InitStruct);
|
||||
GPIO_EXTILineConfig(GPIO_PortSourceGPIOD, GPIO_PinSource6);
|
||||
keypad->column[2].EXTI_InitStruct = configureEXTI(EXTI_Line6, EXTI_Mode_Interrupt, EXTI_Trigger_Rising_Falling, ENABLE);
|
||||
// Enable the interrupts for the Keypad columns
|
||||
keypad->column[3].EXTI_InitStruct.EXTI_Line = EXTI_Line7;
|
||||
keypad->column[3].EXTI_InitStruct.EXTI_Mode = EXTI_Mode_Interrupt;
|
||||
keypad->column[3].EXTI_InitStruct.EXTI_Trigger = EXTI_Trigger_Rising_Falling;
|
||||
keypad->column[3].EXTI_InitStruct.EXTI_LineCmd = ENABLE;
|
||||
EXTI_Init(&keypad->column[3].EXTI_InitStruct);
|
||||
GPIO_EXTILineConfig(GPIO_PortSourceGPIOD, GPIO_PinSource7);
|
||||
keypad->column[3].EXTI_InitStruct = configureEXTI(EXTI_Line7, EXTI_Mode_Interrupt, EXTI_Trigger_Rising_Falling, ENABLE);
|
||||
|
||||
IRQ_setInterruptProperties(EXTI4_IRQn, 12, 12, ENABLE);
|
||||
IRQ_setInterruptProperties(EXTI9_5_IRQn, 12, 12, ENABLE);
|
||||
@@ -621,9 +623,9 @@ static ErrorStatus initPeriphery(void)
|
||||
/* GPIOs */
|
||||
/* --------------------------------------------------------------------*/
|
||||
// Green LED
|
||||
GPIO_construct(ledGreen, OUTPUT, ledGreen->gpio);
|
||||
GPIO_construct(ledInternGreen, OUTPUT, ledInternGreen->gpio);
|
||||
// Orange LED
|
||||
GPIO_construct(ledOrange, OUTPUT, ledOrange->gpio);
|
||||
GPIO_construct(ledInternOrange, OUTPUT, ledInternOrange->gpio);
|
||||
|
||||
IRQ_setInterruptProperties(EXTI0_IRQn, 12, 0, ENABLE);
|
||||
IRQ_setInterruptProperties(EXTI1_IRQn, 12, 0, ENABLE);
|
||||
|
||||
Reference in New Issue
Block a user