Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
37f682dd
Commit
37f682dd
authored
Sep 09, 2021
by
Johny Mattsson
Browse files
More ethernet module fixes.
parent
8c69b155
Changes
2
Show whitespace changes
Inline
Side-by-side
components/modules/eth.c
View file @
37f682dd
// When this isn't enabled, the esp_eth.h header isn't available
#ifdef CONFIG_ETH_ENABLED
#include <string.h>
#include "module.h"
...
...
@@ -9,6 +7,9 @@
#include "nodemcu_esp_event.h"
#include "ip_fmt.h"
#include "common.h"
// When this isn't enabled, the esp_eth.h header isn't available
#if defined(CONFIG_ETH_ENABLED)
#include "esp_netif.h"
#include "esp_eth.h"
#include "esp_eth_phy.h"
...
...
@@ -275,6 +276,13 @@ cleanup_mac_phy:
return
luaL_error
(
L
,
"failed to init ethernet, code %d"
,
err
);
}
static
int
init_eth
(
lua_State
*
L
)
{
for
(
unsigned
i
=
0
;
i
<
ARRAY_LEN
(
event_cb
);
++
i
)
event_cb
[
i
]
=
LUA_NOREF
;
return
0
;
}
LROT_BEGIN
(
eth
,
NULL
,
0
)
LROT_FUNCENTRY
(
init
,
leth_init
)
...
...
@@ -291,5 +299,5 @@ LROT_BEGIN(eth, NULL, 0)
LROT_NUMENTRY
(
PHY_RTL8201
,
ETH_PHY_RTL8201
)
LROT_END
(
eth
,
NULL
,
0
)
NODEMCU_MODULE
(
ETH
,
"eth"
,
eth
,
NULL
);
NODEMCU_MODULE
(
ETH
,
"eth"
,
eth
,
init_eth
);
#endif
docs/modules/eth.md
View file @
37f682dd
...
...
@@ -92,6 +92,11 @@ eth.init({phy = eth.PHY_LAN8720,
addr
=
0
,
mdc
=
16
,
mdio
=
17
})
-- Initialise wt32-eth01
eth
.
init
({
phy
=
eth
.
PHY_LAN8720
,
addr
=
1
,
mdc
=
23
,
mdio
=
18
,
power
=
16
})
```
...
...
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