Skip to content

Commit b24e879

Browse files
authored
Merge pull request #137 from whj4674672/master
【修改】eth 复位引脚使用新的 pin 框架
2 parents bedeefb + b4e2861 commit b24e879

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

libraries/Kconfig

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -255,15 +255,13 @@ menu "On-chip Peripheral"
255255
default n
256256
select RT_USING_LWIP
257257
if BSP_USING_ETH
258-
comment "Notice: PA3 --> 3"
259258
config ETH_RESET_PIN
260-
int "ETH RESET PIN"
261-
range 0 175
262-
default 3
259+
string "ETH RESET PIN"
260+
default "PA.3"
263261
endif
264262
if BSP_USING_ETH
265263
choice
266-
prompt "Choose Eth PHY"
264+
prompt "Choose ETH PHY"
267265
default PHY_USING_LAN8720A
268266
config PHY_USING_LAN8720A
269267
bool "USING LAN8720A"

libraries/drivers/drv_eth.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ static ETH_HandleTypeDef EthHandle;
5858
static ETH_TxPacketConfig TxConfig;
5959
static struct rt_stm32_eth stm32_eth_device;
6060
static uint8_t PHY_ADDR = 0x1F;
61+
static rt_uint32_t reset_pin = 0;
6162

6263
#if defined ( __ICCARM__ ) /*!< IAR Compiler */
6364
#pragma location=0x30040000
@@ -106,9 +107,9 @@ static void dump_hex(const rt_uint8_t *ptr, rt_size_t buflen)
106107

107108
static void phy_reset(void)
108109
{
109-
rt_pin_write(ETH_RESET_PIN, PIN_LOW);
110+
rt_pin_write(reset_pin, PIN_LOW);
110111
rt_thread_mdelay(50);
111-
rt_pin_write(ETH_RESET_PIN, PIN_HIGH);
112+
rt_pin_write(reset_pin, PIN_HIGH);
112113
}
113114

114115

@@ -499,9 +500,10 @@ static void phy_monitor_thread_entry(void *parameter)
499500
static int rt_hw_stm32_eth_init(void)
500501
{
501502
rt_err_t state = RT_EOK;
503+
reset_pin = rt_pin_get(ETH_RESET_PIN);
502504

503-
rt_pin_mode(ETH_RESET_PIN, PIN_MODE_OUTPUT);
504-
rt_pin_write(ETH_RESET_PIN, PIN_HIGH);
505+
rt_pin_mode(reset_pin, PIN_MODE_OUTPUT);
506+
rt_pin_write(reset_pin, PIN_HIGH);
505507

506508
stm32_eth_device.ETH_Speed = ETH_SPEED_100M;
507509
stm32_eth_device.ETH_Mode = ETH_FULLDUPLEX_MODE;

0 commit comments

Comments
 (0)