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.
pull/9971/head
robert-hh 2022-11-15 15:55:27 +01:00
rodzic 2a4825848c
commit 3459a4fa3d
2 zmienionych plików z 11 dodań i 9 usunięć

Wyświetl plik

@ -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
-------

Wyświetl plik

@ -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.