diff options
author | Radomir Dopieralski <openstack@sheep.art.pl> | 2015-10-04 12:24:20 +0200 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-10-06 23:25:35 +0100 |
commit | 37ab061f4d274a909e1a14db07c61110b13512a4 (patch) | |
tree | a3a8c9da69dbce7541ccc8bf93aeefde938ac7cd | |
parent | aaa8867d4a4a1274ea43429c00e8bdfa6b28a015 (diff) | |
download | micropython-37ab061f4d274a909e1a14db07c61110b13512a4.tar.gz micropython-37ab061f4d274a909e1a14db07c61110b13512a4.zip |
docs: Update esp8266 documentation to match the code.
* Move the esp.status() to network module.
* Describe the wifi.isconnected() method.
* Describe esp.mac(), esp.wifi_mode(), esp.phy_mode(), esp.sleep_type(),
esp.deepsleep(), and esp.flash_id() functions.
-rw-r--r-- | docs/library/esp.rst | 69 | ||||
-rw-r--r-- | docs/library/network.rst | 20 |
2 files changed, 79 insertions, 10 deletions
diff --git a/docs/library/esp.rst b/docs/library/esp.rst index 54f06b02d0..3411067e24 100644 --- a/docs/library/esp.rst +++ b/docs/library/esp.rst @@ -10,18 +10,12 @@ The ``esp`` module contains specific functions related to the ESP8266 module. Functions --------- -.. function:: status() +.. function:: mac([address]) - Return the current status of the wireless connection. + Get or set the network interface's MAC address. - The possible statuses are defined as constants: - - * ``STAT_IDLE`` -- no connection and no activity, - * ``STAT_CONNECTING`` -- connecting in progress, - * ``STAT_WRONG_PASSWORD`` -- failed due to incorrect password, - * ``STAT_NO_AP_FOUND`` -- failed because no access point replied, - * ``STAT_CONNECT_FAIL`` -- failed due to other problems, - * ``STAT_GOT_IP`` -- connection susccessful. + If the ``address`` parameter is provided, sets the address to its value. If + the function is called wihout parameters, returns the current address. .. function:: getaddrinfo((hostname, port, lambda)) @@ -31,6 +25,61 @@ Functions called with two arguments, first being the hostname being resolved, second a tuple with information about that hostname. +.. 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. + Classes ------- diff --git a/docs/library/network.rst b/docs/library/network.rst index 1b00c4f0d0..1044814ffa 100644 --- a/docs/library/network.rst +++ b/docs/library/network.rst @@ -236,6 +236,26 @@ class WLAN * 0 -- visible * 1 -- hidden + .. method:: status() + + Return the current status of the wireless connection. + + The possible statuses are defined as constants: + + * ``STAT_IDLE`` -- no connection and no activity, + * ``STAT_CONNECTING`` -- connecting in progress, + * ``STAT_WRONG_PASSWORD`` -- failed due to incorrect password, + * ``STAT_NO_AP_FOUND`` -- failed because no access point replied, + * ``STAT_CONNECT_FAIL`` -- failed due to other problems, + * ``STAT_GOT_IP`` -- connection susccessful. + + .. method:: wlan.isconnected() + + In case of STA mode, returns ``True`` if connected to a wifi access + point and has a valid IP address. In AP mode returns ``True`` when a + station is connected. Returns ``False`` otherwise. + + .. only:: port_wipy This class provides a driver for WiFi network processor in the WiPy. Example usage:: |