Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
V
VC66_7C
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ISUZU
VC66_7C
Commits
5eab9da6
Commit
5eab9da6
authored
2 years ago
by
hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加过压保护的部分逻辑,逻辑不全,没有定时器
parent
d3cc359f
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
222 additions
and
33 deletions
+222
-33
Application.gpj
ghs/group/Application.gpj
+2
-0
GenDelay.c
source/Application/APP/PowerManagement/GenDelay.c
+130
-0
GenDelay.h
source/Application/APP/PowerManagement/GenDelay.h
+24
-0
PowerManagement_user.c
...ce/Application/APP/PowerManagement/PowerManagement_user.c
+40
-4
COM_CAN.c
source/Application/CAN_APP_NM/CAN_App/COM_CAN.c
+17
-9
GUI.c
source/Application/Graphic/GUI/GUI.c
+2
-12
GUI.h
source/Application/Graphic/GUI/GUI.h
+0
-8
init.c
source/System/init.c
+4
-0
tasks.c
source/System/tasks.c
+3
-0
No files found.
ghs/group/Application.gpj
View file @
5eab9da6
...
...
@@ -108,6 +108,8 @@
.\APP\PowerManagement\System_Monitor.c
.\APP\PowerManagement\System_Monitor.h
.\APP\PowerManagement\System_Monitor_user.c
.\APP\PowerManagement\GenDelay.h
.\APP\PowerManagement\GenDelay.c
.\APP\SEG_LCD\SEG_DISPLAY.c
.\APP\SEG_LCD\SEG_DISPLAY.h
.\APP\SEG_LCD\Seg_Ref.c
...
...
This diff is collapsed.
Click to expand it.
source/Application/APP/PowerManagement/GenDelay.c
0 → 100644
View file @
5eab9da6
/**
* @file GenDelay.c
* @brief 通用延时函数
* @details 通用延时函数
* @author 赵建智
* @date 2022.5.4
* @version V1.0
* @copyright 赵建智
*/
#include "GenDelay.h"
static
volatile
Delaylib_uint32_t
s_osif_tick_cnt
=
0u
;
static
Delaylib_uint32_t
Gendelay_GetCurrentTickCount
(
void
);
static
Delaylib_uint32_t
MSEC_TO_TICK
(
Delaylib_uint32_t
msec
,
Delaylib_uint32_t
TimBase
);
FeedDog
pFunc
;
/**
* @brief 延时函数初始化
* @param[in] pfunction 看门狗喂狗函数
* @warning 先于Gen_TimeDelay调用,越早初始化越好
*
* 示例
@code
GenDelay_Init(WDT_Clear);
@endcode
*
* @since 1.0.0
*/
void
GenDelay_Init
(
FeedDog
pfunction
)
{
pFunc
=
pfunction
;
}
/**
* @brief 延时计时,至于中断中
* @warning None
*
* 示例
@code
GenDelay_Tick();
@endcode
*
* @since 1.0.0
*/
void
GenDelay_Tick
(
void
)
{
s_osif_tick_cnt
++
;
}
static
Delaylib_uint32_t
Gendelay_GetCurrentTickCount
(
void
)
{
return
s_osif_tick_cnt
;
}
static
Delaylib_uint32_t
MSEC_TO_TICK
(
Delaylib_uint32_t
msec
,
Delaylib_uint32_t
TimBase
)
{
Delaylib_uint32_t
Ret
;
if
(
TimBase
!=
0u
)
{
Ret
=
msec
/
TimBase
;
}
else
{
Ret
=
msec
;
}
return
Ret
;
}
/**
* @brief 延时指定时间
* @param[in] delay 延时函数时间基准,单位us.
* @param[in] TickBase 延时时间数值,单位us.
* @warning 要在初始化之后调用
*
* 示例
@code
Gen_TimeDelay(25000ul,50ul);//延时25ms. GenDelay_Tick 函数在50us中断内
Gen_TimeDelay(25000ul,64ul);//延时25ms. GenDelay_Tick 函数在64us中断内
@endcode
*
* @since 1.0.0
*/
void
Gen_TimeDelay
(
const
Delaylib_uint32_t
delay
,
const
Delaylib_uint32_t
TickBase
)
{
Delaylib_uint32_t
Tickstart
;
Delaylib_uint32_t
crt_ticks
;
Delaylib_uint32_t
delta
;
Delaylib_uint32_t
delay_ticks
;
s_osif_tick_cnt
=
0u
;
Tickstart
=
Gendelay_GetCurrentTickCount
(
);
crt_ticks
=
Gendelay_GetCurrentTickCount
(
);
delta
=
crt_ticks
-
Tickstart
;
delay_ticks
=
MSEC_TO_TICK
(
delay
,
TickBase
);
while
(
delta
<
delay_ticks
)
{
crt_ticks
=
Gendelay_GetCurrentTickCount
(
);
delta
=
crt_ticks
-
Tickstart
;
if
(
pFunc
!=
((
void
*
)
0
)
)
{
pFunc
(
);
}
}
}
/*FUNCTION**********************************************************************
*
* Function Name : OSIF_GetMilliseconds
* Description : This function returns the number of miliseconds elapsed since
* starting the internal timer. To initialize the internal timer
* (Systick) in bare-metal, call either OSIF_TimeDelay or
* OSIF_SemaWait functions. Calling OSIF_TimeDelay(0) will initialize
* the timer without any side-effects (no delay).
*
* Implements : OSIF_GetMilliseconds_baremetal_Activity
*END**************************************************************************/
Delaylib_uint32_t
OSIF_GetMilliseconds
(
const
Delaylib_uint32_t
TickBase
)
{
/*
* Please make sure the timer is initialized before calling this function.
* For example, calling OSIF_TimeDelay(0) ensures that the timer is initialized
* without any other side-effects. If OSIF_TimeDelay or OSIF_SemaWait functions
* have been called, the timer is already initialized.
*/
Delaylib_uint32_t
Ret
;
Ret
=
Gendelay_GetCurrentTickCount
(
);
return
(
Delaylib_uint32_t
)(
Ret
*
TickBase
);
/* This assumes that 1 tick = 1 millisecond */
}
This diff is collapsed.
Click to expand it.
source/Application/APP/PowerManagement/GenDelay.h
0 → 100644
View file @
5eab9da6
#ifndef Delay_LIB_H_
#define Delay_LIB_H_
/* #define Platform_16Bit
#define Platform_32Bit*/
#ifdef Platform_16Bit
#define Delaylib_uint8_t unsigned char
#define Delaylib_uint16_t unsigned int
#define Delaylib_uint32_t unsigned long
#else
#define Delaylib_uint8_t unsigned char
#define Delaylib_uint16_t unsigned short
#define Delaylib_uint32_t unsigned int
#define Delaylib_uint64_t unsigned long long
#endif
typedef
void
(
*
FeedDog
)(
void
);
extern
void
GenDelay_Init
(
FeedDog
pfunction
);
extern
void
GenDelay_Tick
(
void
);
extern
void
Gen_TimeDelay
(
const
Delaylib_uint32_t
delay
,
const
Delaylib_uint32_t
TickBase
);
extern
Delaylib_uint32_t
OSIF_GetMilliseconds
(
const
Delaylib_uint32_t
TickBase
);
#endif
\ No newline at end of file
This diff is collapsed.
Click to expand it.
source/Application/APP/PowerManagement/PowerManagement_user.c
View file @
5eab9da6
...
...
@@ -49,6 +49,11 @@
#include "kwp2000_service.h"
#include "RTE_TIME.h"
#include "Watchdog.h"
#include "GenDelay.h"
#include "DoCAN_ISO15765.h"
#include "UDS_ISO14229_Server.h"
#include "Analog_Signals.h"
#define POWER_NM_SLEEP 0U
#define POWER_NM_WAKEUP 1U
...
...
@@ -339,11 +344,42 @@ Power_Status_t Power_Stay_OFF(void)
Power_Status_t
Power_Stay_Protect
(
void
)
{
Power_Status_t
u8PowerSts
=
m_IGN_OFF_Init
;
uint32_t
Delaycnt
=
0
;
/*关应用 123……*/
//if (SYS_OPR_STAT_RUN)
//{
// u8PowerSts = m_IGN_ON;
//}
for
(;;)
{
/*喂狗*/
WDT_Clear
(
);
//CAN_SET_APP_SEND(1u);
//CAN_SET_NM_SEND(1u);
CAN_TX_SetEnable
(
0
);
/*一定周期调用2ms*/
//Gen_TimeDelay(2000u, 50u);
DoCAN_Communication_Service
(
);
UDS_Server_Application_Service
(
);
UDS_10ms_Service
(
);
//RTE_ADC_Services( );
Analog_Signal_Conv_Service
();
Sys_Status_Update_Service
(
);
Delaycnt
++
;
if
(
Delaycnt
>=
5u
)
{
Delaycnt
=
0u
;
Can_BusOff_Fun
();
}
/*- 电源模式正常,退出 -*/
if
(
SYS_OPR_STAT_RUN
)
{
//CAN_SET_APP_SEND(0u);
//CAN_SET_NM_SEND(0u);
CAN_TX_SetEnable
(
0x55
);
/*初始化需要*/
//BackLight_30_Init( );
return
u8PowerSts
;
}
}
return
u8PowerSts
;
}
...
...
This diff is collapsed.
Click to expand it.
source/Application/CAN_APP_NM/CAN_App/COM_CAN.c
View file @
5eab9da6
...
...
@@ -9,14 +9,14 @@
uint8_t
BusOffEvent
;
uint8_t
BUS_OFF_FLAG
;
#pragma alignvar(8)
static
uint32_t
pTXBuff
[
CAN_TX_MSG_Block
*
ID_SEND_TOTAL
];
static
uint32_t
pTXBuff
[
CAN_TX_MSG_Block
*
ID_SEND_TOTAL
];
#pragma alignvar(8)
static
uint32_t
pRXBuff
[
CAN_RX_MSG_Block
*
ID_TOTAL_MAX
];
static
uint32_t
pRXBuff
[
CAN_RX_MSG_Block
*
ID_TOTAL_MAX
];
void
COM_CAN_Init
(
void
)
{
/*CAN APP BUFFER INIT*/
Can_TX_BuffInit
((
uint8_t
*
)
pTXBuff
,
st_CANSendAttr
,
ID_SEND_TOTAL
,
Can_Write
);
Can_RX_BuffInit
((
uint8_t
*
)
pRXBuff
,
CAN_MSG_CONST_ARRAY
,
ID_TOTAL_MAX
);
Can_TX_BuffInit
((
uint8_t
*
)
pTXBuff
,
st_CANSendAttr
,
ID_SEND_TOTAL
,
Can_Write
);
Can_RX_BuffInit
((
uint8_t
*
)
pRXBuff
,
CAN_MSG_CONST_ARRAY
,
ID_TOTAL_MAX
);
CAN_RX_SetEnable
(
0u
);
CAN_TX_SetEnable
(
CAN_APP_TX_ENABLE
);
/*NM INIT & BSP INIT*/
...
...
@@ -63,7 +63,7 @@ void COM_NM_ACT(void)
}
else
{
}
}
...
...
@@ -114,9 +114,9 @@ void CAN_QuickTimer_Init ( void )
uint8_t
i
=
0u
;
for
(
i
=
0u
;
i
<
ID_SEND_TOTAL
;
i
++
)
{
// CanMsg[i].u32Timer = st_CANSendAttribute[i].u32MsgCycleOffset;
// CanMsg[i].u32MsgCycle = st_CANSendAttribute[i].u32MsgCycle;
// CanMsg[i].u32SendCnt = st_CANSendAttribute[i].u32InitSendCnt;
// CanMsg[i].u32Timer = st_CANSendAttribute[i].u32MsgCycleOffset;
// CanMsg[i].u32MsgCycle = st_CANSendAttribute[i].u32MsgCycle;
// CanMsg[i].u32SendCnt = st_CANSendAttribute[i].u32InitSendCnt;
}
}
...
...
@@ -124,7 +124,15 @@ void CAN_QuickTimer_Init ( void )
void
Can_BusOff_Fun
(
void
)
{
/*需要增加BusOff恢复*/
//if (RSCAN0_CH0_Get_Busoff_Status() != 0)
//{
// RSCAN0_CH0_Busoff_Recover();
//}
//if (RSCAN0_CH0_Get_Busoff_Status() != 0)
//{
// RSCAN0_CH0_Busoff_Recover();
//}
}
void
Can_BusOffRecover
(
void
)
...
...
This diff is collapsed.
Click to expand it.
source/Application/Graphic/GUI/GUI.c
View file @
5eab9da6
...
...
@@ -36,8 +36,6 @@
#include "DisplaySch_user.h"
#include "DispSch.h"
#pragma alignvar(8)
Display_Modular_St
Display_DTC
[
DTCNumeber
+
1u
];
#pragma alignvar(8)
uint32_t
EolNUM
[
10u
][
8u
];
...
...
@@ -313,14 +311,6 @@ void GUI_Display_Value_Init(void)
DisDTCNumRetarder
=
0u
;
DPD_Display_Time
=
0u
;
Display_DTC
[
0u
].
Disp_Mod_Menu_Cbk
=
GUI_BG_DTCEngine_Display
;
/*发动机故障*/
Display_DTC
[
1u
].
Disp_Mod_Menu_Cbk
=
GUI_BG_DTCBrake_Display
;
/*刹车故障*/
Display_DTC
[
2u
].
Disp_Mod_Menu_Cbk
=
GUI_BG_DTCAMT_Display
;
/*变速箱故障*/
Display_DTC
[
3u
].
Disp_Mod_Menu_Cbk
=
GUI_BG_DTCRadar_Display
;
/*雷达故障码*/
Display_DTC
[
4u
].
Disp_Mod_Menu_Cbk
=
GUI_BG_DTCCamera_Display
;
/*摄像头故障码*/
Display_DTC
[
5u
].
Disp_Mod_Menu_Cbk
=
GUI_BG_DTCRetarder_Display
;
/*液力缓速器故障码*/
Display_DTC
[
6u
].
Disp_Mod_Menu_Cbk
=
GUI_Display_NULL
;
/*无故障*/
}
/*-------------------------------------------------------------------------
...
...
@@ -7584,7 +7574,7 @@ void GUI_BG_DTCEngine_Display(uint8_t Mode)
GUI_General_Display
(
MENU_Sprite
,
CN_fengexian
,
GUI_BLENDMODE_SRC_OVER
);
/*line*/
GUI_Translate_Display
(
MENU_Sprite
,
CN_Alarm_Fault_02_image
,
230u
,
154u
,
GUI_BLENDMODE_SRC_OVER
);
GUI_Translate_Display
(
MENU_Sprite
,
CN_Alarm_Fault_0
2
_wenzi
,
346u
,
154u
,
GUI_BLENDMODE_SRC_OVER
);
GUI_Translate_Display
(
MENU_Sprite
,
CN_Alarm_Fault_0
4
_wenzi
,
346u
,
154u
,
GUI_BLENDMODE_SRC_OVER
);
switch
(
DTCNumCode
)
{
...
...
@@ -7741,7 +7731,7 @@ void GUI_BG_MenuDTCEngine_Display(uint8_t Mode)
GUI_General_Display
(
MENU_Sprite
,
CN_fengexian
,
GUI_BLENDMODE_SRC_OVER
);
/*line*/
GUI_Translate_Display
(
MENU_Sprite
,
CN_Alarm_Fault_02_image
,
230u
,
154u
,
GUI_BLENDMODE_SRC_OVER
);
GUI_Translate_Display
(
MENU_Sprite
,
CN_Alarm_Fault_0
2
_wenzi
,
346u
,
154u
,
GUI_BLENDMODE_SRC_OVER
);
GUI_Translate_Display
(
MENU_Sprite
,
CN_Alarm_Fault_0
4
_wenzi
,
346u
,
154u
,
GUI_BLENDMODE_SRC_OVER
);
GUI_Translate_Display
(
MENU_Sprite
,
CN_Alarm_Fault_D
,
311u
,
267u
,
GUI_BLENDMODE_SRC_OVER
);
/*D*/
GUI_Translate_Display
(
MENU_Sprite
,
CN_Alarm_Fault_T
,
341u
,
267u
,
GUI_BLENDMODE_SRC_OVER
);
/*T*/
...
...
This diff is collapsed.
Click to expand it.
source/Application/Graphic/GUI/GUI.h
View file @
5eab9da6
...
...
@@ -325,14 +325,6 @@ static const uint16_t GUIBGTestPosX[6] = {569u, 540u, 497u, 468u, 424u, 395u};
static
const
uint16_t
GUIBGDTCPosX
[
5
]
=
{
558u
,
528u
,
468u
,
438u
,
408u
};
static
const
uint16_t
GUIBGDTCMPosX
[
4
]
=
{
521u
,
491u
,
461u
,
431u
};
typedef
void
(
*
Disp_Mod_Menu
)
(
uint8_t
Mode
);
typedef
struct
{
uint8_t
Disp_True_False
;
uint8_t
Disp_Site
;
Disp_Mod_Menu
Disp_Mod_Menu_Cbk
;
}
Display_Modular_St
;
extern
void
GUI_Display_KL15_ON_Init
(
void
);
extern
void
GUI_Display_KL15_OFF_Init
(
void
);
extern
void
GUI_Display_backgroundOFF
(
void
);
...
...
This diff is collapsed.
Click to expand it.
source/System/init.c
View file @
5eab9da6
...
...
@@ -49,6 +49,8 @@
#include "r_fdl_types.h"
#include "Seg_Ref.h"
#include "GenDelay.h"
#define WITHOUT_BOOT 1
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
...
...
@@ -118,6 +120,8 @@ void Sys_Startup_Init(void)
WDT_Init
();
GenDelay_Init
(
WDT_Clear
);
/* init graphic tick driver */
R_TICK_Init
(
0
);
...
...
This diff is collapsed.
Click to expand it.
source/System/tasks.c
View file @
5eab9da6
...
...
@@ -92,6 +92,7 @@
#include "kwp2000_protocol.h"
#include "UART.h"
#include "GenDelay.h"
static
uint32_t
K_Line1ms_count
;
...
...
@@ -303,6 +304,8 @@ void Sys_Sleep_Mode_Tasks(void)
void
Sys_Exact_50us_Tasks
(
void
)
{
static
uint16_t
PerCounter
=
0u
;
//GenDelay_Tick();
Sys_Rolling
();
COM_NM_Process
();
COM_TX_Process
();
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment