控制OK
This commit is contained in:
parent
9df68e778f
commit
9629d0d5df
@ -685,7 +685,7 @@
|
||||
<data>
|
||||
<extensions></extensions>
|
||||
<cmdline></cmdline>
|
||||
<hasPrio>232</hasPrio>
|
||||
<hasPrio>1</hasPrio>
|
||||
<buildSequence>inputOutputBased</buildSequence>
|
||||
</data>
|
||||
</settings>
|
||||
@ -1112,6 +1112,9 @@
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Src\bstim32.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Src\hwctrl.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Src\iwdt.c</name>
|
||||
</file>
|
||||
|
@ -1448,6 +1448,9 @@
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Src\bstim32.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Src\hwctrl.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Src\iwdt.c</name>
|
||||
</file>
|
||||
|
@ -150,8 +150,8 @@
|
||||
<MemConfigValue>E:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\config\debugger\FMSH\FM33LG02x.ddf</MemConfigValue>
|
||||
</PlDriver>
|
||||
<ArmDriver>
|
||||
<EnableCache>0</EnableCache>
|
||||
<EnforceMemoryConfiguration>1</EnforceMemoryConfiguration>
|
||||
<EnableCache>0</EnableCache>
|
||||
</ArmDriver>
|
||||
<Jet>
|
||||
<JetConnSerialNo>CMSIS-DAP v2:000000800671FF515256656767161348A5A5A5A597969908</JetConnSerialNo>
|
||||
|
File diff suppressed because one or more lines are too long
@ -22,7 +22,8 @@
|
||||
******************************************************************************/
|
||||
typedef enum
|
||||
{
|
||||
DCF1, DCF2, DCF3, DCF4, DCF5, DCF6, DCF7, DCF8, DCF9, DCF10
|
||||
DCF1, DCF2, DCF3, DCF4, DCF5, DCF6, DCF7, DCF8, DCF9, DCF10,
|
||||
DCF_NUM
|
||||
}DCFCH_TypeDef;
|
||||
|
||||
|
||||
|
@ -158,7 +158,7 @@ typedef struct {
|
||||
#define LIN_SLP_DISABLE() FL_GPIO_SetOutputPin(LIN_SLP_GPIO, LIN_SLP_PIN)
|
||||
|
||||
/* 用户处理 */
|
||||
#define LIN_CMD0_LENGTH 8
|
||||
#define LIN_CMD0_LENGTH 2
|
||||
#define LIN_CMD1_LENGTH 8
|
||||
#define LIN_CMD2_LENGTH 8
|
||||
|
||||
|
@ -38,6 +38,10 @@ uint8_t Txbuf[8] = {0};
|
||||
/*******************************************************************************
|
||||
* the functions
|
||||
******************************************************************************/
|
||||
static void MsgCtrlIO_task(void);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief 掉电监控,用于执行掉电事件
|
||||
@ -80,7 +84,7 @@ void appTaskInit(void)
|
||||
V2_12V_control(V2_12V_OFF);
|
||||
AP_control(AP_OFF);
|
||||
|
||||
for (uint8_t i = 0; i < count; i++)
|
||||
for (uint8_t i = 0; i < DCF_NUM; i++)
|
||||
{
|
||||
DCF_control(i, DCF_OFF);
|
||||
}
|
||||
@ -95,9 +99,9 @@ void appTask(void)
|
||||
gSystick1msEvent--;
|
||||
gSystick1msCnt++;
|
||||
|
||||
if (gSystick1msCnt % 2 == 0)
|
||||
if (gSystick1msCnt % 5 == 0)
|
||||
{
|
||||
|
||||
MsgCtrlIO_task();
|
||||
}
|
||||
|
||||
if (gSystick1msCnt % 1000 == 0)
|
||||
@ -107,13 +111,13 @@ void appTask(void)
|
||||
gSystick1SCnt++;
|
||||
Txbuf[0] = gSystick1SCnt;
|
||||
SetSlaveData(Txbuf);
|
||||
LED1_TOG();
|
||||
//LED1_TOG();
|
||||
|
||||
}
|
||||
|
||||
if (gSystick1msCnt % 100 == 0)
|
||||
{
|
||||
LED0_TOG();
|
||||
//LED0_TOG();
|
||||
/* 清狗 */
|
||||
IWDT_Clr();
|
||||
|
||||
@ -134,8 +138,47 @@ void appTask(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MsgCtrlIO_task(void)
|
||||
uint8_t msgRxBuf[8] = {0};
|
||||
static void MsgCtrlIO_task(void)
|
||||
{
|
||||
MsgCtrlIO();
|
||||
GetMasterData(msgRxBuf);
|
||||
for (uint8_t i = 0; i < 8; i++)
|
||||
{
|
||||
if (msgRxBuf[0] & (0x01<<i))
|
||||
{
|
||||
DCF_control(i,DCF_ON);
|
||||
}
|
||||
else
|
||||
{
|
||||
DCF_control(i,DCF_OFF);
|
||||
}
|
||||
}
|
||||
for (uint8_t i = 0; i < 2; i++)
|
||||
{
|
||||
if (msgRxBuf[1] & (0x01<<i))
|
||||
{
|
||||
DCF_control(i+8,DCF_ON);
|
||||
}
|
||||
else
|
||||
{
|
||||
DCF_control(i+8,DCF_OFF);
|
||||
}
|
||||
}
|
||||
if (msgRxBuf[1] & 0x80)
|
||||
{
|
||||
V2_12V_control(V2_12V_ON);
|
||||
}
|
||||
else
|
||||
{
|
||||
V2_12V_control(V2_12V_OFF);
|
||||
}
|
||||
if (msgRxBuf[1] & 0x40)
|
||||
{
|
||||
AP_control(AP_ON);
|
||||
}
|
||||
else
|
||||
{
|
||||
AP_control(AP_OFF);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -24,9 +24,9 @@
|
||||
#define DCF8_GPIO GPIOB
|
||||
#define DCF8_PIN FL_GPIO_PIN_9
|
||||
#define DCF9_GPIO GPIOA
|
||||
#define DCF9_PIN FL_GPIO_PIN_2
|
||||
#define DCF9_PIN FL_GPIO_PIN_15
|
||||
#define DCF10_GPIO GPIOA
|
||||
#define DCF10_PIN FL_GPIO_PIN_15
|
||||
#define DCF10_PIN FL_GPIO_PIN_2
|
||||
|
||||
#define V2_12V_CTRL_GPIO GPIOB
|
||||
#define V2_12V_CTRL_PIN FL_GPIO_PIN_12
|
||||
@ -65,7 +65,7 @@
|
||||
|
||||
void hw_gpio_init(void)
|
||||
{
|
||||
|
||||
FL_GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||
FL_GPIO_ResetOutputPin(DCF1_GPIO, DCF1_PIN);
|
||||
FL_GPIO_ResetOutputPin(DCF2_GPIO, DCF2_PIN);
|
||||
FL_GPIO_ResetOutputPin(DCF3_GPIO, DCF3_PIN);
|
||||
@ -76,6 +76,10 @@ void hw_gpio_init(void)
|
||||
FL_GPIO_ResetOutputPin(DCF8_GPIO, DCF8_PIN);
|
||||
FL_GPIO_ResetOutputPin(DCF9_GPIO, DCF9_PIN);
|
||||
FL_GPIO_ResetOutputPin(DCF10_GPIO, DCF10_PIN);
|
||||
FL_GPIO_ResetOutputPin(V2_12V_CTRL_GPIO, V2_12V_CTRL_PIN);
|
||||
FL_GPIO_ResetOutputPin(V2_12V_DEN_GPIO, V2_12V_DEN_PIN);
|
||||
FL_GPIO_ResetOutputPin(AP_CTRL_GPIO, AP_CTRL_PIN);
|
||||
FL_GPIO_ResetOutputPin(AP_DEN_GPIO, AP_DEN_PIN);
|
||||
|
||||
GPIO_InitStruct.pin = DCF1_PIN;
|
||||
GPIO_InitStruct.mode = FL_GPIO_MODE_OUTPUT;
|
||||
@ -104,6 +108,15 @@ void hw_gpio_init(void)
|
||||
GPIO_InitStruct.pin = DCF10_PIN;
|
||||
FL_GPIO_Init(DCF10_GPIO, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.pin = V2_12V_CTRL_PIN;
|
||||
FL_GPIO_Init(V2_12V_CTRL_GPIO, &GPIO_InitStruct);
|
||||
GPIO_InitStruct.pin = V2_12V_DEN_PIN;
|
||||
FL_GPIO_Init(V2_12V_DEN_GPIO, &GPIO_InitStruct);
|
||||
GPIO_InitStruct.pin = AP_CTRL_PIN;
|
||||
FL_GPIO_Init(AP_CTRL_GPIO, &GPIO_InitStruct);
|
||||
GPIO_InitStruct.pin = AP_DEN_PIN;
|
||||
FL_GPIO_Init(AP_DEN_GPIO, &GPIO_InitStruct);
|
||||
|
||||
}
|
||||
|
||||
void DCF_control(DCFCH_TypeDef channel, uint8_t state)
|
||||
|
Loading…
x
Reference in New Issue
Block a user