Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
TianYing_ty100
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
baizhengyuan
TianYing_ty100
Commits
ff4d7d95
Commit
ff4d7d95
authored
May 25, 2024
by
李俭双
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🐞
fix:蓝牙功能调试
parent
f64ae345
Changes
15
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
823 additions
and
62 deletions
+823
-62
BlueTooth.c
Firmware/Source/Application/BLUETOOTH/BlueTooth.c
+1
-1
BlueTooth.h
Firmware/Source/Application/BLUETOOTH/BlueTooth.h
+7
-4
Protocol_Lib.h
Firmware/Source/Application/BLUETOOTH/Protocol_Lib.h
+2
-2
Protocol_User.c
Firmware/Source/Application/BLUETOOTH/Protocol_User.c
+30
-35
Data_Coolant.h
Firmware/Source/Application/Data_Coolant/Data_Coolant.h
+2
-2
Data_ESpeed.h
Firmware/Source/Application/Data_ESpeed/Data_ESpeed.h
+3
-3
Data_TPMS.h
Firmware/Source/Application/Data_TPMS/Data_TPMS.h
+1
-1
Data_VSpeed.h
Firmware/Source/Application/Data_VSpeed/Data_VSpeed.h
+2
-2
Data_Fuel.h
Firmware/Source/Application/Fuel/Data_Fuel.h
+2
-1
Analog_Circuits.h
Firmware/Source/Component/Analog/Analog_Circuits.h
+1
-1
PowerManag_user.c
Firmware/Source/Component/PowerManagement/PowerManag_user.c
+4
-0
System_Monitor.c
Firmware/Source/Component/System_Monitor/System_Monitor.c
+753
-0
uart.c
...urce/Device/Cmsemicon/BAT32A239/Library/Driver/src/uart.c
+5
-5
UART_DEMO.c
...re/Source/Device/Cmsemicon/BAT32A239/RTE/UART/UART_DEMO.c
+1
-1
Sys_Task_List.c
Firmware/Source/System/Sys_Task_List.c
+9
-4
No files found.
Firmware/Source/Application/BLUETOOTH/BlueTooth.c
View file @
ff4d7d95
...
@@ -11,7 +11,7 @@ void BlueTooth_KL30_KL15_Wakeup_Init(void)
...
@@ -11,7 +11,7 @@ void BlueTooth_KL30_KL15_Wakeup_Init(void)
}
}
void
Send_UUID_To_Esp32
(
void
)
void
Send_UUID_To_Esp32
(
void
)
{
{
Protocol_Send
(
MCU_ESP32_0x03
,
Protocol_NULL
,
0
);
Protocol_Send
(
MCU_ESP32_0x03
,
UUIDData
,
32
);
}
}
uint8_t
Get_Navigation_St_Dis
(
void
)
uint8_t
Get_Navigation_St_Dis
(
void
)
{
{
...
...
Firmware/Source/Application/BLUETOOTH/BlueTooth.h
View file @
ff4d7d95
...
@@ -17,7 +17,7 @@ enum
...
@@ -17,7 +17,7 @@ enum
BLUE_STATE_ON
,
//蓝牙模组启动完成
BLUE_STATE_ON
,
//蓝牙模组启动完成
BLUE_STATE_OFF
,
BLUE_STATE_OFF
,
};
};
typedef
struct
typedef
struct
__attribute__
((
aligned
(
4
)))
{
{
uint8_t
BlueTooth_St
;
/*蓝牙模组启动状态 0启动中 1启动完成*/
uint8_t
BlueTooth_St
;
/*蓝牙模组启动状态 0启动中 1启动完成*/
uint8_t
Navigation_St
;
/*导航状态 0x35 未导航或导航结束 0x33 正在导航*/
uint8_t
Navigation_St
;
/*导航状态 0x35 未导航或导航结束 0x33 正在导航*/
...
@@ -26,17 +26,20 @@ typedef struct
...
@@ -26,17 +26,20 @@ typedef struct
uint8_t
BLE_St
;
uint8_t
BLE_St
;
}
BlueTooth_t
;
}
BlueTooth_t
;
typedef
enum
{
typedef
enum
__attribute__
((
aligned
(
4
)))
{
EM_ESP32_BT_STARTUP_ST_STANDBY
=
0
,
EM_ESP32_BT_STARTUP_ST_STANDBY
=
0
,
EM_ESP32_BT_STARTUP_ST_SUCCESS
,
EM_ESP32_BT_STARTUP_ST_SUCCESS
,
}
EM_ESP32_BT_STARTUP_ST_T
;
}
EM_ESP32_BT_STARTUP_ST_T
;
typedef
enum
{
typedef
enum
__attribute__
((
aligned
(
4
)))
{
EM_ESP32_NAVI_ST_STANDBY
=
0
,
EM_ESP32_NAVI_ST_STANDBY
=
0
,
EM_ESP32_NAVI_ST_NAVIGATING
,
EM_ESP32_NAVI_ST_NAVIGATING
,
}
EM_ESP32_NAVI_ST_T
;
}
EM_ESP32_NAVI_ST_T
;
typedef
struct
{
typedef
struct
__attribute__
((
aligned
(
4
)))
{
EM_ESP32_BT_STARTUP_ST_T
Startup
;
EM_ESP32_BT_STARTUP_ST_T
Startup
;
EM_ESP32_NAVI_ST_T
NaviSt
;
EM_ESP32_NAVI_ST_T
NaviSt
;
uint8_t
NaviCode
;
uint8_t
NaviCode
;
...
...
Firmware/Source/Application/BLUETOOTH/Protocol_Lib.h
View file @
ff4d7d95
...
@@ -30,7 +30,7 @@ Platform_16Bit
...
@@ -30,7 +30,7 @@ Platform_16Bit
/**@struct Protocol_Data_t
/**@struct Protocol_Data_t
* @brief 解析后的协议数据
* @brief 解析后的协议数据
*/
*/
typedef
struct
typedef
struct
__attribute__
((
aligned
(
4
)))
{
{
Protocol_uint8_t
FrameNo
;
/**< 帧序号 */
Protocol_uint8_t
FrameNo
;
/**< 帧序号 */
Protocol_uint8_t
PowerSts
;
/**< 电源状态 */
Protocol_uint8_t
PowerSts
;
/**< 电源状态 */
...
@@ -49,7 +49,7 @@ typedef void (*UARTClose)(void);
...
@@ -49,7 +49,7 @@ typedef void (*UARTClose)(void);
/**@struct Protocol_Func_t
/**@struct Protocol_Func_t
* @brief 协议解析回调函数
* @brief 协议解析回调函数
*/
*/
typedef
struct
typedef
struct
__attribute__
((
aligned
(
4
)))
{
{
UARTOpen
UARTOpen_Cbk
;
/**< 串口打开回调 */
UARTOpen
UARTOpen_Cbk
;
/**< 串口打开回调 */
UARTSend
UARTSend_Cbk
;
/**< 串口发送回调 */
UARTSend
UARTSend_Cbk
;
/**< 串口发送回调 */
...
...
Firmware/Source/Application/BLUETOOTH/Protocol_User.c
View file @
ff4d7d95
...
@@ -7,14 +7,14 @@
...
@@ -7,14 +7,14 @@
#define UART_RX_MAX_DEPTH (2 * 1024UL) // 4K
#define UART_RX_MAX_DEPTH (2 * 1024UL) // 4K
#define UART_DATA_BUF_LEN (2 * 1024UL) // 4K
#define UART_DATA_BUF_LEN (2 * 1024UL) // 4K
typedef
struct
typedef
struct
__attribute__
((
aligned
(
4
)))
{
{
Protocol_uint32_t
read_pos
;
Protocol_uint32_t
read_pos
;
Protocol_uint32_t
write_pos
;
Protocol_uint32_t
write_pos
;
Protocol_uint8_t
Rx_Buffer
[
UART_RX_MAX_DEPTH
];
Protocol_uint8_t
Rx_Buffer
[
UART_RX_MAX_DEPTH
];
}
UARTRxBuf_t
;
}
UARTRxBuf_t
;
typedef
struct
typedef
struct
__attribute__
((
aligned
(
4
)))
{
{
Protocol_uint32_t
read_pos
;
Protocol_uint32_t
read_pos
;
Protocol_uint32_t
write_pos
;
Protocol_uint32_t
write_pos
;
...
@@ -54,41 +54,36 @@ void Protocol_Send_Service(void)
...
@@ -54,41 +54,36 @@ void Protocol_Send_Service(void)
Protocol_uint32_t
i
=
0u
;
Protocol_uint32_t
i
=
0u
;
Protocol_uint32_t
DataLen
=
0u
;
Protocol_uint32_t
DataLen
=
0u
;
Protocol_uint32_t
SendLen
=
0u
;
Protocol_uint32_t
SendLen
=
0u
;
//if ( UART_Ch1_Get_TX_Busy_Flag( ) == 0u
)
if
(
UARTTxBuf
.
write_pos
==
UARTTxBuf
.
read_pos
)
{
{
if
(
UARTTxBuf
.
write_pos
==
UARTTxBuf
.
read_pos
)
return
;
{
}
return
;
if
(
UARTTxBuf
.
write_pos
>
UARTTxBuf
.
read_pos
)
}
{
DataLen
=
UARTTxBuf
.
write_pos
-
UARTTxBuf
.
read_pos
;
if
(
UARTTxBuf
.
write_pos
>
UARTTxBuf
.
read_pos
)
{
DataLen
=
UARTTxBuf
.
write_pos
-
UARTTxBuf
.
read_pos
;
}
else
{
DataLen
=
UART_TX_MAX_DEPTH
-
(
UARTTxBuf
.
read_pos
-
UARTTxBuf
.
write_pos
);
}
if
(
DataLen
>
255
)
{
SendLen
=
255
;
}
else
{
SendLen
=
DataLen
;
}
for
(
i
=
0u
;
i
<
SendLen
;
i
++
)
{
UsartDataBuf
[
i
]
=
UARTTxBuf
.
Tx_Buffer
[
UARTTxBuf
.
read_pos
];
UARTTxBuf
.
read_pos
=
(
UARTTxBuf
.
read_pos
+
1
)
%
UART_TX_MAX_DEPTH
;
}
Uart0_IntSend
(
UsartDataBuf
,
SendLen
);
//UART_Ch1_Send_Multiple_Byte(UsartDataBuf, SendLen);
}
}
else
{
DataLen
=
UART_TX_MAX_DEPTH
-
(
UARTTxBuf
.
read_pos
-
UARTTxBuf
.
write_pos
);
}
if
(
DataLen
>
255
)
{
SendLen
=
255
;
}
else
{
SendLen
=
DataLen
;
}
for
(
i
=
0u
;
i
<
SendLen
;
i
++
)
{
UsartDataBuf
[
i
]
=
UARTTxBuf
.
Tx_Buffer
[
UARTTxBuf
.
read_pos
];
UARTTxBuf
.
read_pos
=
(
UARTTxBuf
.
read_pos
+
1
)
%
UART_TX_MAX_DEPTH
;
}
Uart0_IntSend
(
UsartDataBuf
,
SendLen
);
}
}
static
Protocol_uint8_t
Protocol_OpenUart
(
void
)
static
Protocol_uint8_t
Protocol_OpenUart
(
void
)
...
...
Firmware/Source/Application/Data_Coolant/Data_Coolant.h
View file @
ff4d7d95
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
/*** 控制结构 ***/
/*** 控制结构 ***/
typedef
struct
typedef
struct
__attribute__
((
aligned
(
4
)))
{
{
uint8_t
Dis_Valid
;
uint8_t
Dis_Valid
;
uint8_t
u8_DestSeg
;
uint8_t
u8_DestSeg
;
...
@@ -29,7 +29,7 @@ typedef struct
...
@@ -29,7 +29,7 @@ typedef struct
extern
DataCoolantTempDisStruct
DataCoolantTemp_Dis
;
extern
DataCoolantTempDisStruct
DataCoolantTemp_Dis
;
typedef
struct
typedef
struct
__attribute__
((
aligned
(
4
)))
{
{
uint16_t
Value
;
uint16_t
Value
;
uint8_t
Valid
;
uint8_t
Valid
;
...
...
Firmware/Source/Application/Data_ESpeed/Data_ESpeed.h
View file @
ff4d7d95
...
@@ -18,20 +18,20 @@
...
@@ -18,20 +18,20 @@
#define DATA_ESPEED_HYSTERESIS 80 //回差
#define DATA_ESPEED_HYSTERESIS 80 //回差
/*** 控制结构 ***/
/*** 控制结构 ***/
typedef
struct
typedef
struct
__attribute__
((
aligned
(
4
)))
{
{
uint16_t
Buffer
[
5
];
uint16_t
Buffer
[
5
];
uint8_t
Cnt
;
uint8_t
Cnt
;
}
DataESpeedSamplerStruct
;
//转速采样结构
}
DataESpeedSamplerStruct
;
//转速采样结构
typedef
struct
typedef
struct
__attribute__
((
aligned
(
4
)))
{
{
uint16_t
Speed
;
uint16_t
Speed
;
uint16_t
Delta
;
uint16_t
Delta
;
uint8_t
Dir
;
uint8_t
Dir
;
}
DataESPeedDampingStruct
;
//转速阻尼结构
}
DataESPeedDampingStruct
;
//转速阻尼结构
typedef
struct
typedef
struct
__attribute__
((
aligned
(
4
)))
{
{
uint16_t
ESpeedBackup
;
uint16_t
ESpeedBackup
;
uint16_t
Timer
;
uint16_t
Timer
;
...
...
Firmware/Source/Application/Data_TPMS/Data_TPMS.h
View file @
ff4d7d95
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
#define _DATA_TPMS_H_
#define _DATA_TPMS_H_
#include "common.h"
#include "common.h"
typedef
struct
typedef
struct
__attribute__
((
aligned
(
4
)))
{
{
uint32_t
Front_Press_Value
;
uint32_t
Front_Press_Value
;
uint32_t
Rear_Press_Value
;
uint32_t
Rear_Press_Value
;
...
...
Firmware/Source/Application/Data_VSpeed/Data_VSpeed.h
View file @
ff4d7d95
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
#define DATA_VSPEED_HYSTERESIS 15 //回差
#define DATA_VSPEED_HYSTERESIS 15 //回差
/*** 控制结构 ***/
/*** 控制结构 ***/
typedef
struct
typedef
struct
__attribute__
((
aligned
(
4
)))
{
{
uint16_t
Timer
;
uint16_t
Timer
;
uint16_t
Timer1
;
uint16_t
Timer1
;
...
@@ -23,7 +23,7 @@ typedef struct
...
@@ -23,7 +23,7 @@ typedef struct
uint8_t
Cnt
;
uint8_t
Cnt
;
}
DataVSpeedSamplerStruct
;
//车速采样结构
}
DataVSpeedSamplerStruct
;
//车速采样结构
typedef
struct
typedef
struct
__attribute__
((
aligned
(
4
)))
{
{
uint16_t
Speed
;
uint16_t
Speed
;
uint16_t
Delta
;
uint16_t
Delta
;
...
...
Firmware/Source/Application/Fuel/Data_Fuel.h
View file @
ff4d7d95
...
@@ -4,7 +4,8 @@
...
@@ -4,7 +4,8 @@
#include "Components.h"
#include "Components.h"
typedef
enum
{
typedef
enum
__attribute__
((
aligned
(
4
)))
{
FuelSensorNormal
=
0
,
FuelSensorNormal
=
0
,
FuelSensorShortCircuit
,
FuelSensorShortCircuit
,
FuelSensorOpenCircuit
,
FuelSensorOpenCircuit
,
...
...
Firmware/Source/Component/Analog/Analog_Circuits.h
View file @
ff4d7d95
...
@@ -22,7 +22,7 @@ extern {
...
@@ -22,7 +22,7 @@ extern {
#endif
#endif
/* Exported types ------------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
typedef
struct
typedef
struct
__attribute__
((
aligned
(
4
)))
{
{
uint32_t
u32Res1
;
uint32_t
u32Res1
;
uint32_t
u32Res2
;
uint32_t
u32Res2
;
...
...
Firmware/Source/Component/PowerManagement/PowerManag_user.c
View file @
ff4d7d95
...
@@ -54,6 +54,7 @@ static void Power_KL30_Init(void)
...
@@ -54,6 +54,7 @@ static void Power_KL30_Init(void)
BU98R10_Init
();
BU98R10_Init
();
Uart0_Init
(
115200
);
Uart0_Init
(
115200
);
Protocol_KL30_Wakeup_Init
();
Protocol_KL30_Wakeup_Init
();
BlueTooth_KL30_KL15_Wakeup_Init
();
Sys_KL30_Init
();
Sys_KL30_Init
();
Checkself_Init
();
Checkself_Init
();
Data_Vehicle_Speed_KL30_Init
();
Data_Vehicle_Speed_KL30_Init
();
...
@@ -112,6 +113,8 @@ static void Power_Wakeup_Init(void)
...
@@ -112,6 +113,8 @@ static void Power_Wakeup_Init(void)
//Light_Sensor_Init_Example();//注意顺序1
//Light_Sensor_Init_Example();//注意顺序1
LED_Driver_Init_Example
();
//注意顺序2
LED_Driver_Init_Example
();
//注意顺序2
Protocol_KL30_Wakeup_Init
();
Protocol_KL30_Wakeup_Init
();
Uart0_Init
(
115200
);
BlueTooth_KL30_KL15_Wakeup_Init
();
Fuel_KL30_Init
();
Fuel_KL30_Init
();
Data_Voltage_Init
();
Data_Voltage_Init
();
TimerM_PWM_counter_Output_Init
(
TIMERM_COUNTER0
,
400
,
64000000
);
TimerM_PWM_counter_Output_Init
(
TIMERM_COUNTER0
,
400
,
64000000
);
...
@@ -153,6 +156,7 @@ static void Power_IG_ON_Init(void)
...
@@ -153,6 +156,7 @@ static void Power_IG_ON_Init(void)
Data_Voltage_Init
();
Data_Voltage_Init
();
MenuData_TCS_Init
();
MenuData_TCS_Init
();
Data_Coolant_Temp_KL15_Init
();
Data_Coolant_Temp_KL15_Init
();
BlueTooth_KL30_KL15_Wakeup_Init
();
CAN_TX_SetEnable
(
&
CAN_CH0_CanMsgTxOp
,
CAN_N_TX_Enable
);
CAN_TX_SetEnable
(
&
CAN_CH0_CanMsgTxOp
,
CAN_N_TX_Enable
);
}
}
...
...
Firmware/Source/Component/System_Monitor/System_Monitor.c
0 → 100644
View file @
ff4d7d95
This diff is collapsed.
Click to expand it.
Firmware/Source/Device/Cmsemicon/BAT32A239/Library/Driver/src/uart.c
View file @
ff4d7d95
...
@@ -49,11 +49,11 @@
...
@@ -49,11 +49,11 @@
*/
*/
static
uint32_t
UART_GetSysClock
(
void
)
static
uint32_t
UART_GetSysClock
(
void
)
{
{
if
(
USE_HSE_SYSTYEM_CLOCK
==
SYSTYEM_CLOCK_OPEN
)
//
if (USE_HSE_SYSTYEM_CLOCK == SYSTYEM_CLOCK_OPEN)
{
//
{
return
64
000000
;
// return 32
000000;
}
//
}
else
//
else
{
{
return
SystemCoreClock
;
return
SystemCoreClock
;
}
}
...
...
Firmware/Source/Device/Cmsemicon/BAT32A239/RTE/UART/UART_DEMO.c
View file @
ff4d7d95
...
@@ -159,7 +159,7 @@ void uart0_interrupt_receive(void)
...
@@ -159,7 +159,7 @@ void uart0_interrupt_receive(void)
uart_callback_error
(
err_type
);
uart_callback_error
(
err_type
);
}
}
UART_Put
((
uint
8
_t
)
UART0_RX
);
UART_Put
((
uint
16
_t
)
UART0_RX
);
...
...
Firmware/Source/System/Sys_Task_List.c
View file @
ff4d7d95
...
@@ -35,12 +35,14 @@ void Sys_2ms_Tasks(void)
...
@@ -35,12 +35,14 @@ void Sys_2ms_Tasks(void)
void
Sys_5ms_Tasks
(
void
)
void
Sys_5ms_Tasks
(
void
)
{
{
Flash_Sync_Signal_Generation_Service
();
Flash_Sync_Signal_Generation_Service
();
}
}
uint8_t
ljs_buf
[
200
]
=
{
0
};
void
Sys_10ms_Tasks
(
void
)
void
Sys_10ms_Tasks
(
void
)
{
{
Line_In_Debounce_Service
(
10u
);
memset
(
ljs_buf
,
0x55
,
200
);
Line_In_Debounce_Service
(
10u
);
Key_Service
();
Key_Service
();
Data_Mileage_Write_EEPROM
();
Data_Mileage_Write_EEPROM
();
Can_BusOff_Recover
(
10u
);
Can_BusOff_Recover
(
10u
);
...
@@ -48,7 +50,9 @@ void Sys_10ms_Tasks(void)
...
@@ -48,7 +50,9 @@ void Sys_10ms_Tasks(void)
Fuel_R_Cal
(
10u
);
Fuel_R_Cal
(
10u
);
TYW_Check_Count
();
TYW_Check_Count
();
Data_TPMS_Processing_Service
();
Data_TPMS_Processing_Service
();
Protocol_Send_Service
();
Protocol_Service
();
Protocol_Send_Service
();
//Uart0_IntSend(ljs_buf, 200) ;
}
}
void
Sys_20ms_Tasks
(
void
)
void
Sys_20ms_Tasks
(
void
)
...
@@ -58,7 +62,7 @@ void Sys_20ms_Tasks(void)
...
@@ -58,7 +62,7 @@ void Sys_20ms_Tasks(void)
Data_Vehicle_Speed_Processing_Service
();
Data_Vehicle_Speed_Processing_Service
();
Data_Engine_Speed_Processing_Service
();
Data_Engine_Speed_Processing_Service
();
Data_Coolant_Temp_Processing_Service
();
Data_Coolant_Temp_Processing_Service
();
Protocol_Service
();
}
}
...
@@ -118,4 +122,5 @@ void Sys_Exact_50us_Tasks(void)
...
@@ -118,4 +122,5 @@ void Sys_Exact_50us_Tasks(void)
task_1ms
=
0U
;
task_1ms
=
0U
;
eeprom_1ms_timeCount
(
);
eeprom_1ms_timeCount
(
);
}
}
}
}
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