更新hwctrl
This commit is contained in:
parent
f3f030b0a7
commit
9df68e778f
3
LIN Slave/.vscode/settings.json
vendored
3
LIN Slave/.vscode/settings.json
vendored
@ -77,5 +77,6 @@
|
|||||||
"files.associations": {
|
"files.associations": {
|
||||||
"bstim32.h": "c",
|
"bstim32.h": "c",
|
||||||
"main.h": "c"
|
"main.h": "c"
|
||||||
}
|
},
|
||||||
|
"Codegeex.GenerationPreference": "block"
|
||||||
}
|
}
|
@ -9,13 +9,21 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* the defines
|
* the defines
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
#define DCF_ON 1
|
||||||
|
#define DCF_OFF 0
|
||||||
|
#define V2_12V_ON 1
|
||||||
|
#define V2_12V_OFF 0
|
||||||
|
#define AP_ON 1
|
||||||
|
#define AP_OFF 0
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* the typedefs
|
* the typedefs
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
DCF1, DCF2, DCF3, DCF4, DCF5, DCF6, DCF7, DCF8, DCF9, DCF10
|
||||||
|
}DCFCH_TypeDef;
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
@ -29,8 +37,9 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
void hw_gpio_init(void);
|
void hw_gpio_init(void);
|
||||||
|
void DCF_control(DCFCH_TypeDef channel, uint8_t state);
|
||||||
|
void V2_12V_control(uint8_t state);
|
||||||
|
void AP_control(uint8_t state);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,12 +1,6 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* the includes
|
* the includes
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* the defines
|
|
||||||
******************************************************************************/
|
|
||||||
#include "appTask.h"
|
#include "appTask.h"
|
||||||
#include "uart.h"
|
#include "uart.h"
|
||||||
#include "lin.h"
|
#include "lin.h"
|
||||||
@ -16,6 +10,13 @@
|
|||||||
#include "iwdt.h"
|
#include "iwdt.h"
|
||||||
#include "rmu.h"
|
#include "rmu.h"
|
||||||
#include "bstim32.h"
|
#include "bstim32.h"
|
||||||
|
#include "hwctrl.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
* the defines
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* the typedefs
|
* the typedefs
|
||||||
@ -73,7 +74,17 @@ void TimebaseHandle(void)
|
|||||||
|
|
||||||
void appTaskInit(void)
|
void appTaskInit(void)
|
||||||
{
|
{
|
||||||
|
hw_gpio_init();
|
||||||
BSTIM32_Init();
|
BSTIM32_Init();
|
||||||
|
|
||||||
|
V2_12V_control(V2_12V_OFF);
|
||||||
|
AP_control(AP_OFF);
|
||||||
|
|
||||||
|
for (uint8_t i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
DCF_control(i, DCF_OFF);
|
||||||
|
}
|
||||||
|
|
||||||
gSystick1SCnt = 0;
|
gSystick1SCnt = 0;
|
||||||
}
|
}
|
||||||
void appTask(void)
|
void appTask(void)
|
||||||
@ -124,3 +135,7 @@ void appTask(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MsgCtrlIO_task(void)
|
||||||
|
{
|
||||||
|
MsgCtrlIO();
|
||||||
|
}
|
||||||
|
@ -28,6 +28,19 @@
|
|||||||
#define DCF10_GPIO GPIOA
|
#define DCF10_GPIO GPIOA
|
||||||
#define DCF10_PIN FL_GPIO_PIN_15
|
#define DCF10_PIN FL_GPIO_PIN_15
|
||||||
|
|
||||||
|
#define V2_12V_CTRL_GPIO GPIOB
|
||||||
|
#define V2_12V_CTRL_PIN FL_GPIO_PIN_12
|
||||||
|
#define V2_12V_DEN_GPIO GPIOC
|
||||||
|
#define V2_12V_DEN_PIN FL_GPIO_PIN_0
|
||||||
|
|
||||||
|
#define AP_CTRL_GPIO GPIOA
|
||||||
|
#define AP_CTRL_PIN FL_GPIO_PIN_5
|
||||||
|
#define AP_DEN_GPIO GPIOA
|
||||||
|
#define AP_DEN_PIN FL_GPIO_PIN_8
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* the typedefs
|
* the typedefs
|
||||||
@ -71,9 +84,173 @@ void hw_gpio_init(void)
|
|||||||
FL_GPIO_Init(DCF1_GPIO, &GPIO_InitStruct);
|
FL_GPIO_Init(DCF1_GPIO, &GPIO_InitStruct);
|
||||||
|
|
||||||
GPIO_InitStruct.pin = DCF1_PIN;
|
GPIO_InitStruct.pin = DCF1_PIN;
|
||||||
|
FL_GPIO_Init(DCF1_GPIO, &GPIO_InitStruct);
|
||||||
|
GPIO_InitStruct.pin = DCF2_PIN;
|
||||||
|
FL_GPIO_Init(DCF2_GPIO, &GPIO_InitStruct);
|
||||||
|
GPIO_InitStruct.pin = DCF3_PIN;
|
||||||
|
FL_GPIO_Init(DCF3_GPIO, &GPIO_InitStruct);
|
||||||
|
GPIO_InitStruct.pin = DCF4_PIN;
|
||||||
|
FL_GPIO_Init(DCF4_GPIO, &GPIO_InitStruct);
|
||||||
|
GPIO_InitStruct.pin = DCF5_PIN;
|
||||||
|
FL_GPIO_Init(DCF5_GPIO, &GPIO_InitStruct);
|
||||||
|
GPIO_InitStruct.pin = DCF6_PIN;
|
||||||
|
FL_GPIO_Init(DCF6_GPIO, &GPIO_InitStruct);
|
||||||
|
GPIO_InitStruct.pin = DCF7_PIN;
|
||||||
|
FL_GPIO_Init(DCF7_GPIO, &GPIO_InitStruct);
|
||||||
|
GPIO_InitStruct.pin = DCF8_PIN;
|
||||||
|
FL_GPIO_Init(DCF8_GPIO, &GPIO_InitStruct);
|
||||||
|
GPIO_InitStruct.pin = DCF9_PIN;
|
||||||
|
FL_GPIO_Init(DCF9_GPIO, &GPIO_InitStruct);
|
||||||
|
GPIO_InitStruct.pin = DCF10_PIN;
|
||||||
|
FL_GPIO_Init(DCF10_GPIO, &GPIO_InitStruct);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DCF_control(DCFCH_TypeDef channel, uint8_t state)
|
||||||
|
{
|
||||||
|
switch (channel)
|
||||||
|
{
|
||||||
|
case DCF1:
|
||||||
|
if (state == DCF_OFF)
|
||||||
|
{
|
||||||
|
FL_GPIO_ResetOutputPin(DCF1_GPIO, DCF1_PIN);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FL_GPIO_SetOutputPin(DCF1_GPIO, DCF1_PIN);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case DCF2:
|
||||||
|
if (state == DCF_OFF)
|
||||||
|
{
|
||||||
|
FL_GPIO_ResetOutputPin(DCF2_GPIO, DCF2_PIN);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FL_GPIO_SetOutputPin(DCF2_GPIO, DCF2_PIN);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DCF3:
|
||||||
|
if (state == DCF_OFF)
|
||||||
|
{
|
||||||
|
FL_GPIO_ResetOutputPin(DCF3_GPIO, DCF3_PIN);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FL_GPIO_SetOutputPin(DCF3_GPIO, DCF3_PIN);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DCF4:
|
||||||
|
if (state == DCF_OFF)
|
||||||
|
{
|
||||||
|
FL_GPIO_ResetOutputPin(DCF4_GPIO, DCF4_PIN);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FL_GPIO_SetOutputPin(DCF4_GPIO, DCF4_PIN);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DCF5:
|
||||||
|
if (state == DCF_OFF)
|
||||||
|
{
|
||||||
|
FL_GPIO_ResetOutputPin(DCF5_GPIO, DCF5_PIN);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FL_GPIO_SetOutputPin(DCF5_GPIO, DCF5_PIN);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DCF6:
|
||||||
|
if (state == DCF_OFF)
|
||||||
|
{
|
||||||
|
FL_GPIO_ResetOutputPin(DCF6_GPIO, DCF6_PIN);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FL_GPIO_SetOutputPin(DCF6_GPIO, DCF6_PIN);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DCF7:
|
||||||
|
if (state == DCF_OFF)
|
||||||
|
{
|
||||||
|
FL_GPIO_ResetOutputPin(DCF7_GPIO, DCF7_PIN);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FL_GPIO_SetOutputPin(DCF7_GPIO, DCF7_PIN);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DCF8:
|
||||||
|
if (state == DCF_OFF)
|
||||||
|
{
|
||||||
|
FL_GPIO_ResetOutputPin(DCF8_GPIO, DCF8_PIN);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FL_GPIO_SetOutputPin(DCF8_GPIO, DCF8_PIN);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DCF9:
|
||||||
|
if (state == DCF_OFF)
|
||||||
|
{
|
||||||
|
FL_GPIO_ResetOutputPin(DCF9_GPIO, DCF9_PIN);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FL_GPIO_SetOutputPin(DCF9_GPIO, DCF9_PIN);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DCF10:
|
||||||
|
if (state == DCF_OFF)
|
||||||
|
{
|
||||||
|
FL_GPIO_ResetOutputPin(DCF10_GPIO, DCF10_PIN);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FL_GPIO_SetOutputPin(DCF10_GPIO, DCF10_PIN);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void V2_12V_control(uint8_t state)
|
||||||
|
{
|
||||||
|
if (state == V2_12V_OFF)
|
||||||
|
{
|
||||||
|
FL_GPIO_ResetOutputPin(V2_12V_CTRL_GPIO, V2_12V_CTRL_PIN);
|
||||||
|
FL_GPIO_ResetOutputPin(V2_12V_DEN_GPIO, V2_12V_DEN_PIN);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FL_GPIO_SetOutputPin(V2_12V_CTRL_GPIO, V2_12V_CTRL_PIN);
|
||||||
|
FL_GPIO_SetOutputPin(V2_12V_DEN_GPIO, V2_12V_DEN_PIN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AP_control(uint8_t state)
|
||||||
|
{
|
||||||
|
if (state == AP_OFF)
|
||||||
|
{
|
||||||
|
FL_GPIO_ResetOutputPin(AP_CTRL_GPIO, AP_CTRL_PIN);
|
||||||
|
FL_GPIO_ResetOutputPin(AP_DEN_GPIO, AP_DEN_PIN);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FL_GPIO_SetOutputPin(AP_CTRL_GPIO, AP_CTRL_PIN);
|
||||||
|
FL_GPIO_SetOutputPin(AP_DEN_GPIO, AP_DEN_PIN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user