Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiancetai
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
陈家乐
jiancetai
Commits
574f6c86
Commit
574f6c86
authored
Feb 22, 2025
by
李梓源
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✨
feat:一线通(暂时)
parent
9741bdae
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
7 deletions
+63
-7
RTE_GPIO.c
YueJin_test_bench/source/Appliciation/RTE_GPIO.c
+6
-0
RTE_GPIO.h
YueJin_test_bench/source/Appliciation/RTE_GPIO.h
+2
-0
Task.c
YueJin_test_bench/source/Appliciation/Task.c
+55
-7
No files found.
YueJin_test_bench/source/Appliciation/RTE_GPIO.c
View file @
574f6c86
...
...
@@ -167,6 +167,12 @@ void RTE_GPIO_Init(void)
gpio_temp
.
enGPIODir
=
GPIO_DIR_IN
;
gpio_temp
.
enGPIOAltFun
=
GPIO_ALTER_FUN_1
;
GPIO_Config
(
&
gpio_temp
);
gpio_temp
.
enGPIOPort
=
GPIO_PORT_GROUP_0
;
gpio_temp
.
enGPIOPIN
=
GPIO_PIN_8
;
gpio_temp
.
enGPIOMode
=
GPIO_MODE_PORT
;
gpio_temp
.
enGPIODir
=
GPIO_DIR_OUT
;
gpio_temp
.
enGPIOAltFun
=
GPIO_ALTER_FUN_1
;
GPIO_Config
(
&
gpio_temp
);
// queren = 0;
// LINE_OUT_NEG_01 = 1;
// LINE_OUT_NEG_02 = 1;
...
...
YueJin_test_bench/source/Appliciation/RTE_GPIO.h
View file @
574f6c86
...
...
@@ -40,6 +40,8 @@
#define ZXSW_AD GPIO_IN_APORT00_PIN13
#define ZYS_B GPIO_IN_APORT00_PIN14 //坐桶锁B
#define ZYS_A GPIO_IN_APORT00_PIN15 //坐桶锁A
#define TX_OUT GPIO_OUT_PORT00_PIN08 //一线通TX输出
/* ---------------------旧的-------------------------- */
...
...
YueJin_test_bench/source/Appliciation/Task.c
View file @
574f6c86
...
...
@@ -478,6 +478,7 @@ void Sys_Run_Mode_100ms_Tasks_Group(void)
/*==============================================================================
��ȷ��50us��ʱ���� ��ֹ�������б��е�����
------------------------------------------------------------------------------*/
uint8_t
flag_sync
;
uint8_t
flag_1
;
uint8_t
flag_0
;
uint8_t
flag_fin
;
...
...
@@ -487,7 +488,32 @@ void Sys_Exact_50us_Tasks(void)
static
uint8_t
flag1_flag
=
0
;
static
uint8_t
flag0_count
=
0
;
static
uint8_t
flag0_flag
=
0
;
static
uint32_t
flag_fin_count
=
0
;
static
uint16_t
flag_fin_count
=
0
;
static
uint8_t
sync_flag
=
0
;
static
uint16_t
sync_count
=
0
;
if
(
flag_sync
==
1
)
{
if
(
sync_count
<
220
)
{
sync_count
++
;
}
else
{
sync_count
=
0
;
flag_sync
=
0
;
}
if
(
sync_count
<
200
)
{
TX_OUT
=
1
;
}
else
if
(
sync_count
<
20
)
{
TX_OUT
=
0
;
}
return
;
}
if
(
flag_1
==
1
)
{
...
...
@@ -503,11 +529,11 @@ void Sys_Exact_50us_Tasks(void)
if
(
flag1_count
<
30
)
{
// set_pin_high()
;
TX_OUT
=
1
;
}
else
if
(
flag1_count
<
40
)
{
// set_pin_low()
;
TX_OUT
=
0
;
}
}
...
...
@@ -525,11 +551,11 @@ void Sys_Exact_50us_Tasks(void)
if
(
flag0_count
<
10
)
{
// set_pin_high()
;
TX_OUT
=
1
;
}
else
if
(
flag0_count
<
40
)
{
// set_pin_low()
;
TX_OUT
=
0
;
}
}
...
...
@@ -547,17 +573,39 @@ void Sys_Exact_50us_Tasks(void)
if
(
flag_fin_count
<
10
)
{
// set_pin_high();
TX_OUT
=
1
;
}
else
if
(
flag_fin_count
<
40
)
{
// set_pin_low()
;
TX_OUT
=
0
;
}
}
GenDelay_Tick
(
);
DoCAN_Timer_Update
(
50u
);
}
// 发送单个比特(逻辑"1"或"0")
void
send_bit
(
uint8_t
bit
)
{
if
(
bit
)
{
flag_1
=
1
;
}
else
{
flag_0
=
1
;
}
}
// 发送完整数据(按字节发送,高位优先)
void
send_data
(
const
uint8_t
*
data
,
uint32_t
len
)
{
flag_sync
==
1
;
// 发送同步信号
for
(
uint32_t
i
=
0
;
i
<
len
;
i
++
)
{
uint8_t
byte
=
data
[
i
];
for
(
int
j
=
7
;
j
>=
0
;
j
--
)
{
// 高位先发
send_bit
((
byte
>>
j
)
&
0x01
);
}
}
flag_fin
==
1
;
// 发送停止信号
}
/*============================================================================*/
/*******************************************************************************
...
...
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