summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrobert-hh <robert@hammelrath.com>2022-11-15 15:55:27 +0100
committerrobert-hh <robert@hammelrath.com>2022-11-17 08:55:16 +0100
commit3459a4fa3d511179e46e1953bd860c851e9c6653 (patch)
tree881b95110a5c8fefa59c2b919de4188c9e5a80b3
parent2a4825848caa20df158ab3634ba36d763505ab8d (diff)
mimxrt/network: Rename the argument clock_mode to ref_clk_mode.
The definitions for LAN.IN and LAN.OUT are kept, but in the code Pin.IN and Pin.OUT can be used as well as values for the ref_clk_mode argument.
-rw-r--r--docs/library/network.LAN.rst12
-rw-r--r--ports/mimxrt/network_lan.c8
2 files changed, 11 insertions, 9 deletions
diff --git a/docs/library/network.LAN.rst b/docs/library/network.LAN.rst
index 58bd61ebb..375e02cef 100644
--- a/docs/library/network.LAN.rst
+++ b/docs/library/network.LAN.rst
@@ -19,7 +19,7 @@ Example usage::
Constructors
------------
-.. class:: LAN(id, *, phy_type=<board_default>, phy_addr=<board_default>, phy_clock=<board_default>)
+.. class:: LAN(id, *, phy_type=<board_default>, phy_addr=<board_default>, ref_clk_mode=<board_default>)
Create a LAN driver object, initialise the LAN module using the given
PHY driver name, and return the LAN object.
@@ -31,13 +31,15 @@ Constructors
is the default. Suitable values are port specific.
- *phy_addr* specifies the address of the PHY interface. As with *phy_type*, the hardwired value has
to be used for most boards and that value is the default.
- - *phy_clock* specifies, whether the data clock is provided by the Ethernet controller or the PYH interface.
- The default value is the one that matches the board. If set to ``True``, the clock is driven by the
- Ethernet controller, otherwise by the PHY interface.
+ - *ref_clk_mode* specifies, whether the data clock is provided by the Ethernet controller or
+ the PYH interface.
+ The default value is the one that matches the board. If set to ``LAN.OUT`` or ``Pin.OUT``
+ or ``True``, the clock is driven by the Ethernet controller, if set to ``LAN.IN``
+ or ``Pin.IN`` or ``False``, the clock is driven by the PHY interface.
For example, with the Seeed Arch Mix board you can use::
- nic = LAN(0, phy_type=LAN.PHY_LAN8720, phy_addr=2, phy_clock=False)
+ nic = LAN(0, phy_type=LAN.PHY_LAN8720, phy_addr=1, ref_clk_mode=Pin.IN)
Methods
-------
diff --git a/ports/mimxrt/network_lan.c b/ports/mimxrt/network_lan.c
index 59c3310a5..39565c591 100644
--- a/ports/mimxrt/network_lan.c
+++ b/ports/mimxrt/network_lan.c
@@ -75,12 +75,12 @@ STATIC void network_lan_print(const mp_print_t *print, mp_obj_t self_in, mp_prin
}
STATIC mp_obj_t network_lan_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
- enum { ARG_id, ARG_phy_type, ARG_phy_addr, ARG_phy_clock};
+ enum { ARG_id, ARG_phy_type, ARG_phy_addr, ARG_ref_clk_mode};
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_id, MP_ARG_INT, {.u_int = 0} },
{ MP_QSTR_phy_type, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = -1} },
{ MP_QSTR_phy_addr, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = -1} },
- { MP_QSTR_phy_clock, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = -1} },
+ { MP_QSTR_ref_clk_mode, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = -1} },
};
// Parse args.
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
@@ -125,8 +125,8 @@ STATIC mp_obj_t network_lan_make_new(const mp_obj_type_t *type, size_t n_args, s
phy_addr = args[ARG_phy_addr].u_int;
}
- if (args[ARG_phy_clock].u_int != -1) {
- phy_clock = args[ARG_phy_clock].u_int;
+ if (args[ARG_ref_clk_mode].u_int != -1) {
+ phy_clock = args[ARG_ref_clk_mode].u_int;
}
// Prepare for two ETH interfaces.