summaryrefslogtreecommitdiffstatshomepage
path: root/docs/library
diff options
context:
space:
mode:
Diffstat (limited to 'docs/library')
-rw-r--r--docs/library/machine.HeartBeat.rst47
-rw-r--r--docs/library/machine.Pin.rst9
-rw-r--r--docs/library/machine.SD.rst9
-rw-r--r--docs/library/machine.Timer.rst19
-rw-r--r--docs/library/machine.UART.rst2
-rw-r--r--docs/library/machine.WDT.rst3
-rw-r--r--docs/library/machine.rst1
-rw-r--r--docs/library/network.rst4
-rw-r--r--docs/library/ussl.rst5
9 files changed, 33 insertions, 66 deletions
diff --git a/docs/library/machine.HeartBeat.rst b/docs/library/machine.HeartBeat.rst
deleted file mode 100644
index 033d7311fb..0000000000
--- a/docs/library/machine.HeartBeat.rst
+++ /dev/null
@@ -1,47 +0,0 @@
-.. _machine.HeartBeat:
-
-class HeartBeat -- heart beat LED
-=================================
-
-The HeartBeat class controls the heart beat led which by default
-flashes once every 5s. The user can disable the HeartBeat and then
-is free to control this LED manually through GP25 using the Pin
-class. The GP25 can also be remapped as a PWM output, an this
-can be used to control the light intesity of the heart beat LED.
-
-Example usage::
-
- hb = machine.HeartBeat()
- hb.disable() # disable the heart beat
- hb.enable() # enable the heart beat
-
-Constructors
-------------
-
-.. class:: machine.HeartBeat()
-
- Create a HeartBeat object.
-
-Methods
--------
-
-.. method:: heartbeat.enable()
-
- Enable the heart beat. The LED will flash once every 5 seconds.
-
-.. method:: heartbeat.disable()
-
- Disable the heart beat. The LED can then be controlled manually.
-
- Example::
-
- from machine import HeartBeat
- from machine import Pin
-
- # disable the heart beat
- HeartBeat().disable()
- # init GP25 as output
- led = Pin('GP25', mode=Pin.OUT)
- # toggle the led
- led.toggle()
- ...
diff --git a/docs/library/machine.Pin.rst b/docs/library/machine.Pin.rst
index f7b783c191..452e2234e3 100644
--- a/docs/library/machine.Pin.rst
+++ b/docs/library/machine.Pin.rst
@@ -13,15 +13,18 @@ Usage Model:
Board pins are identified by their string id::
- g = machine.Pin('GP9', mode=machine.Pin.OUT, pull=None, drive=machine.Pin.MED_POWER, alt=-1)
+ from machine import Pin
+ g = machine.Pin('GP9', mode=Pin.OUT, pull=None, drive=Pin.MED_POWER, alt=-1)
You can also configure the Pin to generate interrupts. For instance::
+ from machine import Pin
+
def pincb(pin):
print(pin.id())
- pin_int = machine.Pin('GP10', mode=Pin.IN, pull=machine.Pin.PULL_DOWN)
- pin_int.irq(mode=machine.Pin.IRQ_RISING, handler=pincb)
+ pin_int = Pin('GP10', mode=Pin.IN, pull=Pin.PULL_DOWN)
+ pin_int.irq(mode=Pin.IRQ_RISING, handler=pincb)
# the callback can be triggered manually
pin_int.irq()()
# to disable the callback
diff --git a/docs/library/machine.SD.rst b/docs/library/machine.SD.rst
index 19d8d655bd..da60121d07 100644
--- a/docs/library/machine.SD.rst
+++ b/docs/library/machine.SD.rst
@@ -26,16 +26,15 @@ Constructors
.. class:: machine.SD(id,... )
- Create a SD card object. See init for parameters if initialization.
+ Create a SD card object. See ``init()`` for parameters if initialization.
Methods
-------
-.. method:: sd.init(id, pins=('GP10', 'GP11', 'GP15'))
+.. method:: sd.init(id=0, pins=('GP10', 'GP11', 'GP15'))
- Enable the SD card.
- In order to initalize the card, give it a 3-tuple ``(clk_pin, cmd_pin, dat0_pin)``
- ID defaults to zero.
+ Enable the SD card. In order to initalize the card, give it a 3-tuple:
+ ``(clk_pin, cmd_pin, dat0_pin)``.
.. method:: sd.deinit()
diff --git a/docs/library/machine.Timer.rst b/docs/library/machine.Timer.rst
index 4814da8603..5d357ca079 100644
--- a/docs/library/machine.Timer.rst
+++ b/docs/library/machine.Timer.rst
@@ -19,13 +19,15 @@ class Timer -- control internal timers
Example usage to toggle an LED at a fixed frequency::
- tim = machine.Timer(4) # create a timer object using timer 4
- tim.init(mode=Timer.PERIODIC) # initialize it in periodic mode
- tim_ch = tim.channel(Timer.A, freq=2) # configure channel A at a frequency of 2Hz
- tim_ch.callback(handler=lambda t:led.toggle()) # toggle a LED on every cycle of the timer
+ from machine import Timer
+ tim = Timer(4) # create a timer object using timer 4
+ tim.init(mode=Timer.PERIODIC) # initialize it in periodic mode
+ tim_ch = tim.channel(Timer.A, freq=2) # configure channel A at a frequency of 2Hz
+ tim_ch.callback(handler=lambda t:led.toggle()) # toggle a LED on every cycle of the timer
Example using named function for the callback::
+ from machine import Timer
tim = Timer(1, mode=Timer.PERIODIC)
tim_a = tim.channel(Timer.A, freq=1000)
@@ -39,8 +41,9 @@ class Timer -- control internal timers
Further examples::
- tim1 = machine.Timer(2, mode=Timer.EVENT_COUNT) # initialize it capture mode
- tim2 = machine.Timer(1, mode=Timer.PWM) # initialize it in PWM mode
+ from machine import Timer
+ tim1 = Timer(2, mode=Timer.EVENT_COUNT) # initialize it capture mode
+ tim2 = Timer(1, mode=Timer.PWM) # initialize it in PWM mode
tim_ch = tim1.channel(Timer.A, freq=1, polarity=Timer.POSITIVE) # start the event counter with a frequency of 1Hz and triggered by positive edges
tim_ch = tim2.channel(Timer.B, freq=10000, duty_cycle=50) # start the PWM on channel B with a 50% duty cycle
tim_ch.time() # get the current time in usec (can also be set)
@@ -54,8 +57,8 @@ class Timer -- control internal timers
.. note::
- Memory can't be allocated during a callback (an interrupt) and so
- exceptions raised within a callback don't give much information. See
+ Memory can't be allocated inside irq handlers (an interrupt) and so
+ exceptions raised within a handler don't give much information. See
:func:`micropython.alloc_emergency_exception_buf` for how to get around this
limitation.
diff --git a/docs/library/machine.UART.rst b/docs/library/machine.UART.rst
index 034492717c..732b30788d 100644
--- a/docs/library/machine.UART.rst
+++ b/docs/library/machine.UART.rst
@@ -155,7 +155,7 @@ Methods
This means that when the handler function is called there will be between 1 to 8
characters waiting.
- Returns a irq object.
+ Returns an irq object.
Constants
---------
diff --git a/docs/library/machine.WDT.rst b/docs/library/machine.WDT.rst
index 9ce0a96ac3..dca74f70f6 100644
--- a/docs/library/machine.WDT.rst
+++ b/docs/library/machine.WDT.rst
@@ -10,7 +10,8 @@ watchdog periodically to prevent it from expiring and resetting the system.
Example usage::
- wdt = machine.WDT(timeout=2000) # enable with a timeout of 2s
+ from machine import WDT
+ wdt = WDT(timeout=2000) # enable it with a timeout of 2s
wdt.feed()
Constructors
diff --git a/docs/library/machine.rst b/docs/library/machine.rst
index f94454359b..c78b7c1b67 100644
--- a/docs/library/machine.rst
+++ b/docs/library/machine.rst
@@ -121,7 +121,6 @@ Classes
:maxdepth: 1
machine.ADC.rst
- machine.HeartBeat.rst
machine.I2C.rst
machine.Pin.rst
machine.RTC.rst
diff --git a/docs/library/network.rst b/docs/library/network.rst
index 0b9acf6423..8522ee2948 100644
--- a/docs/library/network.rst
+++ b/docs/library/network.rst
@@ -34,6 +34,10 @@ For example::
class server
============
+ The server class controls the behaviour and the configuration of the FTP and telnet
+ services running on the WiPy. Any changes performed using this class' methods will
+ affect both.
+
Constructors
------------
diff --git a/docs/library/ussl.rst b/docs/library/ussl.rst
index 9e97fac502..ce9fd01e27 100644
--- a/docs/library/ussl.rst
+++ b/docs/library/ussl.rst
@@ -31,6 +31,11 @@ Functions
- The certificate to authenticate ourselves goes in: **'/flash/cert/cert.pem'**
- The key for our own certificate goes in: **'/flash/cert/private.key'**
+ .. note::
+
+ When these files are stored, they are placed inside the internal **hidden** file system
+ (just like firmware updates), and therefore they are never visible.
+
For instance to connect to the Blynk servers using certificates, take the file ``ca.pem`` located
in the `blynk examples folder <https://github.com/wipy/wipy/tree/master/examples/blynk>`_
and put it in '/flash/cert/'. Then do::