From 3459a4fa3d511179e46e1953bd860c851e9c6653 Mon Sep 17 00:00:00 2001 From: robert-hh Date: Tue, 15 Nov 2022 15:55:27 +0100 Subject: [PATCH] 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. --- docs/library/network.LAN.rst | 12 +++++++----- ports/mimxrt/network_lan.c | 8 ++++---- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/docs/library/network.LAN.rst b/docs/library/network.LAN.rst index 58bd61ebbd..375e02cefe 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=, phy_addr=, phy_clock=) +.. class:: LAN(id, *, phy_type=, phy_addr=, ref_clk_mode=) 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 59c3310a5b..39565c5917 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.