esp.rst 2.65 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
:mod:`esp` --- functions related to the ESP8266
===============================================

.. module:: esp
    :synopsis: functions related to the ESP8266

The ``esp`` module contains specific functions related to the ESP8266 module.


Functions
---------

13
.. function:: mac([address])
14

15
    Get or set the network interface's MAC address.
16

17
18
    If the ``address`` parameter is provided, sets the address to its value. If
    the function is called wihout parameters, returns the current address.
19
20
21
22
23
24
25
26
27

.. function:: getaddrinfo((hostname, port, lambda))

    Initiate resolving of the given hostname.

    When the hostname is resolved, the provided ``lambda`` callback will be
    called with two arguments, first being the hostname being resolved,
    second a tuple with information about that hostname.

28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
.. function:: wifi_mode([mode])

    Get or set the wireless network operating mode.

    If the ``mode`` parameter is provided, sets the mode to its value. If
    the function is called wihout parameters, returns the current mode.

    The possible modes are defined as constants:

        * ``STA_MODE`` -- station mode,
        * ``AP_MODE`` -- software access point mode,
        * ``STA_AP_MODE`` -- mixed station and software access point mode.

.. function:: phy_mode([mode])

    Get or set the network interface mode.

    If the ``mode`` parameter is provided, sets the mode to its value. If
    the function is called wihout parameters, returns the current mode.

    The possible modes are defined as constants:
        * ``MODE_11B`` -- IEEE 802.11b,
        * ``MODE_11G`` -- IEEE 802.11g,
        * ``MODE_11N`` -- IEEE 802.11n.

.. function:: sleep_type([sleep_type])

    Get or set the sleep type.

    If the ``sleep_type`` parameter is provided, sets the sleep type to its
    value. If the function is called wihout parameters, returns the current
    sleep type.

    The possible sleep types are defined as constants:

        * ``SLEEP_NONE`` -- all functions enabled,
        * ``SLEEP_MODEM`` -- modem sleep, shuts down the WiFi Modem circuit.
        * ``SLEEP_LIGHT`` -- light sleep, shuts down the WiFi Modem circuit
          and suspends the processor periodically.

    The system enters the set sleep mode automatically when possible.

.. function:: deepsleep(time=0)

    Enter deep sleep.

    The whole module powers down, except for the RTC clock circuit, which can
    be used to restart the module after the specified time if the pin 16 is
    connected to the reset pin. Otherwise the module will sleep until manually
    reset.

.. function:: flash_id()

    Read the device ID of the flash memory.

83
84
85
86
87
88
89
Classes
-------

.. toctree::
    :maxdepth: 1

    esp.socket.rst