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
5682ac8c
Commit
5682ac8c
authored
Nov 04, 2024
by
梁百峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🐞
fix:修改485发送函数延时
parent
be7022b9
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
49 additions
and
51 deletions
+49
-51
api_RS485.c
source/api_RS485.c
+18
-22
api_RS485.h
source/api_RS485.h
+1
-1
io_config.c
source/app/api_gpio/io_config.c
+2
-2
io_config.h
source/app/api_gpio/io_config.h
+2
-2
api_timer.c
source/app/api_timer/api_timer.c
+6
-5
bsp_button.c
source/bsp_source/bsp_button/bsp_button.c
+20
-19
No files found.
source/api_RS485.c
View file @
5682ac8c
...
...
@@ -19,6 +19,8 @@ static uint8_t RS485DataBuf[RS485_RX_BUF_LEN];
static
uint32_t
u32RS485RxDataValidLen
=
0
;
static
uint8_t
RS485ValidData
[
RS485_RX_DATA_LEN
];
static
uint8_t
u8RS485RecVldID
[
RS485_Rx_ID_Idx_Max
];
uint32_t
RS485_send_time
=
0
;
uint32_t
RS485_send_num
=
0
;
// static RS485_Tx_Data_Ctrl_st_t stRS485TxData[RS485_Tx_ID_Idx_Max];
_ID0X40h_Data
R485_ID40h
;
_ID0X48h_Data
R485_ID48h
;
...
...
@@ -317,45 +319,37 @@ uint32_t R485_Send(const uint16_t cmdID, const uint8_t* pData, uint8_t len)
void
RS485_User_Tx_Data
(
void
)
{
for
(
uint8_t
i
=
0
;
i
<
RS485_Tx_ID_Idx_Max
+
1
;
)
{
// if (stRS485TxData[i].u8TxEnable)
// {
// if (stRS485TxData[i].u8TxTime > 0)
// {
// stRS485TxData[i].u8TxTime--;
// }
// else
// { /*发送数据*/
uint8_t
flag
=
0
;
if
(
Time_100us
>
3000
)
uint8_t
flag
=
0
;
if
(
RS485_send_time
>
3000
)
{
Port_SetPortPinLevel
(
1
,
4
,
PortGpioHigh
);
switch
(
i
)
switch
(
RS485_send_num
)
{
case
RS485_Tx_ID48_Idx
:
R485_Send_0x40
();
Time_100us
=
0
;
i
++
;
RS485_send_time
=
0
;
RS485_send_num
++
;
// uart_wait_tx_done(R485_UART_PORT, 100);
break
;
case
RS485_Tx_ID49_Idx
:
R485_Send_0x41
();
Time_100us
=
0
;
i
++
;
RS485_send_time
=
0
;
RS485_send_num
++
;
// uart_wait_tx_done(R485_UART_PORT, 100);
break
;
case
RS485_Tx_ID4A_Idx
:
R485_Send_0x42
();
Time_100us
=
0
;
i
++
;
RS485_send_time
=
0
;
RS485_send_num
++
;
// uart_wait_tx_done(R485_UART_PORT, 100);
break
;
default:
flag
=
1
;
i
++
;
RS485_send_num
=
0
;
break
;
}
...
...
@@ -363,12 +357,14 @@ void RS485_User_Tx_Data(void)
if
(
flag
==
1
)
{
Port_SetPortPinLevel
(
1
,
4
,
PortGpioLow
);
// 设置引脚s
}
//
}
//
// }
// }
// }
}
}
/**
...
...
source/api_RS485.h
View file @
5682ac8c
...
...
@@ -51,6 +51,6 @@ typedef struct
uint16_t
u16LostTime
;
uint8_t
u8ReceivedFlag
;
}
RS485ValidDataPacket_st_t
;
extern
uint32_t
RS485_send_time
;
extern
uint32_t
R485_Send
(
const
uint16_t
cmdID
,
const
uint8_t
*
pData
,
uint8_t
len
);
#endif
/* API_ADC_H_ */
source/app/api_gpio/io_config.c
View file @
5682ac8c
...
...
@@ -63,9 +63,9 @@ void Api_GPIO_Init(void)
Port_SetPinConfig
(
0
,
24
,
&
stc_IN_pin_config
);
// 30 1
Port_SetPinConfig
(
1
,
26
,
&
stc_IN_pin_config
);
// 15 2
Port_SetPinConfig
(
1
,
27
,
&
stc_IN_pin_config
);
// AUTO 3
//
Port_SetPinConfig(1, 27, &stc_IN_pin_config); // AUTO 3
Port_SetPinConfig
(
0
,
5
,
&
stc_IN_pin_config
);
// EOL 4
Port_SetPinConfig
(
1
,
29
,
&
stc_IN_pin_config
);
// SPEED UP 5
//
Port_SetPinConfig(1, 29, &stc_IN_pin_config); // SPEED UP 5
Port_SetPinConfig
(
1
,
30
,
&
stc_IN_pin_config
);
// SPEED DOWN 6
Port_SetPinConfig
(
1
,
28
,
&
stc_IN_pin_config
);
// LED 7
Port_SetPinConfig
(
1
,
31
,
&
stc_IN_pin_config
);
// IOL UP 8
...
...
source/app/api_gpio/io_config.h
View file @
5682ac8c
...
...
@@ -32,13 +32,13 @@ extern en_port_gpio_level_t BUTTON_Back_light_IN;
#define GET_BUTTON_Back_light_LEVEL Port_GetPortPinLevel(2, 11, &BUTTON_Back_light_IN)
extern
en_port_gpio_level_t
BUTTON_AUTO_IN
;
#define GET_BUTTON_AUTO_LEVEL Port_GetPortPinLevel(1, 27, &BUTTON_AUTO_IN)
//
#define GET_BUTTON_AUTO_LEVEL Port_GetPortPinLevel(1, 27, &BUTTON_AUTO_IN)
extern
en_port_gpio_level_t
BUTTON_EOL_IN
;
#define GET_BUTTON_EOL_LEVEL Port_GetPortPinLevel(0, 5, &BUTTON_EOL_IN)
extern
en_port_gpio_level_t
BUTTON_SPEED_UP_IN
;
#define GET_BUTTON_SPEED_UP_LEVEL Port_GetPortPinLevel(1, 29, &BUTTON_SPEED_UP_IN)
//
#define GET_BUTTON_SPEED_UP_LEVEL Port_GetPortPinLevel(1, 29, &BUTTON_SPEED_UP_IN)
extern
en_port_gpio_level_t
BUTTON_SPEED_DOWN_IN
;
#define GET_BUTTON_SPEED_DOWN_LEVEL Port_GetPortPinLevel(1, 30, &BUTTON_SPEED_DOWN_IN)
...
...
source/app/api_timer/api_timer.c
View file @
5682ac8c
...
...
@@ -410,11 +410,11 @@ static void TIMER_1MS_ISR(void)
else
Botton
.
Other
.
Flag
=
0
;
GET_BUTTON_SPEED_UP_LEVEL
;
if
(
BUTTON_SPEED_UP_IN
==
0
)
Botton
.
SpeedUp
.
Flag
=
1
;
else
Botton
.
SpeedUp
.
Flag
=
0
;
//
GET_BUTTON_SPEED_UP_LEVEL;
//
if(BUTTON_SPEED_UP_IN == 0)
//
Botton.SpeedUp.Flag = 1;
//
else
//
Botton.SpeedUp.Flag = 0;
GET_BUTTON_SPEED_DOWN_LEVEL
;
if
(
BUTTON_SPEED_DOWN_IN
==
0
)
...
...
@@ -505,6 +505,7 @@ static void TIMER4_50US_ISR(void)
if
(
Time_100us
<
0xffffffff
)
Time_100us
++
;
RS485_send_time
++
;
if
(
Time_100us_Uart9
<
0xffffffff
)
Time_100us_Uart9
++
;
...
...
source/bsp_source/bsp_button/bsp_button.c
View file @
5682ac8c
...
...
@@ -167,15 +167,15 @@ void Get_Button_Value()//��ȡ����AD
}
#endif
#if (FUNCTION_KEY_AUTO)
GET_BUTTON_AUTO_LEVEL
;
if
(
BUTTON_AUTO_IN
==
0
){
if
(
CheckOkTimerCnts
==
0
)
{
Botton
.
Auto
.
Flag
=
1
;
}
}
else
{
CheckOkTimerCnts
=
0
;
Botton
.
Auto
.
Flag
=
0
;
}
//
GET_BUTTON_AUTO_LEVEL;
//
if(BUTTON_AUTO_IN == 0){
//
if (CheckOkTimerCnts == 0) {
//
Botton.Auto.Flag = 1;
//
}
//
} else {
//
CheckOkTimerCnts = 0;
//
Botton.Auto.Flag = 0;
//
}
#endif
#if (FUNCTION_KEY_EOL)
GET_BUTTON_EOL_LEVEL
;
...
...
@@ -186,18 +186,18 @@ void Get_Button_Value()//��ȡ����AD
Botton
.
EOL
.
Flag
=
0
;
#endif
#if (FUNCTION_KEY_SPEED_UP)
GET_BUTTON_SPEED_UP_LEVEL
;
if
(
BUTTON_SPEED_UP_IN
==
0
)
Botton
.
SpeedUp
.
Flag
=
1
;
else
Botton
.
SpeedUp
.
Flag
=
0
;
//
GET_BUTTON_SPEED_UP_LEVEL;
//
if(BUTTON_SPEED_UP_IN == 0)
//
Botton.SpeedUp.Flag = 1;
//
else
//
Botton.SpeedUp.Flag = 0;
#endif
#if (FUNCTION_KEY_SPEED_DOWN)
GET_BUTTON_SPEED_DOWN_LEVEL
;
if
(
BUTTON_SPEED_DOWN_IN
==
0
)
Botton
.
SpeedDown
.
Flag
=
1
;
else
Botton
.
SpeedDown
.
Flag
=
0
;
//
GET_BUTTON_SPEED_DOWN_LEVEL;
//
if(BUTTON_SPEED_DOWN_IN == 0)
//
Botton.SpeedDown.Flag = 1;
//
else
//
Botton.SpeedDown.Flag = 0;
#endif
#if (FUNCTION_KEY_LED)
GET_BUTTON_LED_LEVEL
;
...
...
@@ -2686,6 +2686,7 @@ void Stage_Manage()
g_Stage
=
STAGE_Other
;
HJ_OtherKeyCurrent
.
count
++
;
Line_Temp
();
RS485_User_Tx_Data
();
ClearOtherSWFlagFun
();
ClearOtherFlagFun
();
Othercount
=
0
;
...
...
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