docs/library: Remove "only" directive from all pyb module docs.
By virtue of its name, the pyb module would only be available on a pyboard and so does not need to have conditional "only" directives throughout its documentation. These conditionals were added mostly incfcf47c064
in the initial development of the cc3200 port, which had the pyb module before it switched to the machine module. And wipy only conditionals were removed from the pyb module documentation in4542643025
, so there's no need to retain any more conditionals.
This commit is contained in:
parent
419eb86074
commit
805fd0cfe6
|
@ -4,8 +4,6 @@
|
|||
class ADC -- analog to digital conversion
|
||||
=========================================
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
Usage::
|
||||
|
||||
import pyb
|
||||
|
@ -25,9 +23,6 @@ class ADC -- analog to digital conversion
|
|||
Constructors
|
||||
------------
|
||||
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
.. class:: pyb.ADC(pin)
|
||||
|
||||
Create an ADC object associated with the given pin.
|
||||
|
@ -36,8 +31,6 @@ Constructors
|
|||
Methods
|
||||
-------
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
.. method:: ADC.read()
|
||||
|
||||
Read the value on the analog pin and return it. The returned value
|
||||
|
@ -133,8 +126,6 @@ Methods
|
|||
The ADCAll Object
|
||||
-----------------
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
Instantiating this changes all masked ADC pins to analog inputs. The preprocessed MCU temperature,
|
||||
VREF and VBAT data can be accessed on ADC channels 16, 17 and 18 respectively.
|
||||
Appropriate scaling is handled according to reference voltage used (usually 3.3V).
|
||||
|
|
|
@ -10,8 +10,6 @@ level it consists of 2 wires: SCL and SDA, the clock and data lines respectively
|
|||
I2C objects are created attached to a specific bus. They can be initialised
|
||||
when created, or initialised later on.
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
Example::
|
||||
|
||||
from pyb import I2C
|
||||
|
@ -24,8 +22,6 @@ when created, or initialised later on.
|
|||
|
||||
Printing the i2c object gives you information about its configuration.
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
The basic methods are send and recv::
|
||||
|
||||
i2c.send('abc') # send 3 bytes
|
||||
|
@ -60,8 +56,6 @@ Printing the i2c object gives you information about its configuration.
|
|||
Constructors
|
||||
------------
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
.. class:: pyb.I2C(bus, ...)
|
||||
|
||||
Construct an I2C object on the given bus. ``bus`` can be 1 or 2, 'X' or
|
||||
|
@ -90,8 +84,6 @@ Methods
|
|||
|
||||
Turn off the I2C bus.
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
.. method:: I2C.init(mode, \*, addr=0x12, baudrate=400000, gencall=False, dma=False)
|
||||
|
||||
Initialise the I2C bus with the given parameters:
|
||||
|
@ -168,8 +160,6 @@ Constants
|
|||
|
||||
for initialising the bus to master mode
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
.. data:: I2C.SLAVE
|
||||
|
||||
for initialising the bus to slave mode
|
||||
|
|
|
@ -10,8 +10,6 @@ digital logic level. For analog control of a pin, see the ADC class.
|
|||
|
||||
Usage Model:
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
All Board Pins are predefined as pyb.Pin.board.Name::
|
||||
|
||||
x1_pin = pyb.Pin.board.X1
|
||||
|
@ -81,8 +79,6 @@ Constructors
|
|||
Create a new Pin object associated with the id. If additional arguments are given,
|
||||
they are used to initialise the pin. See :meth:`pin.init`.
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
Class methods
|
||||
-------------
|
||||
|
||||
|
@ -102,8 +98,6 @@ Constructors
|
|||
Methods
|
||||
-------
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
.. method:: Pin.init(mode, pull=Pin.PULL_NONE, af=-1)
|
||||
|
||||
Initialise the pin:
|
||||
|
@ -137,8 +131,6 @@ Methods
|
|||
anything that converts to a boolean. If it converts to ``True``, the pin
|
||||
is set high, otherwise it is set low.
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
.. method:: Pin.__str__()
|
||||
|
||||
Return a string describing the pin object.
|
||||
|
@ -188,8 +180,6 @@ Methods
|
|||
Constants
|
||||
---------
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
.. data:: Pin.AF_OD
|
||||
|
||||
initialise the pin to alternate-function mode with an open-drain drive
|
||||
|
@ -226,8 +216,6 @@ Constants
|
|||
|
||||
enable the pull-up resistor on the pin
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
class PinAF -- Pin Alternate Functions
|
||||
======================================
|
||||
|
||||
|
|
|
@ -33,8 +33,6 @@ Methods
|
|||
date and time. With 1 argument (being an 8-tuple) it sets the date
|
||||
and time (and ``subseconds`` is reset to 255).
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
The 8-tuple has the following format:
|
||||
|
||||
(year, month, day, weekday, hours, minutes, seconds, subseconds)
|
||||
|
@ -43,8 +41,6 @@ Methods
|
|||
|
||||
``subseconds`` counts down from 255 to 0
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
.. method:: RTC.wakeup(timeout, callback=None)
|
||||
|
||||
Set the RTC wakeup timer to trigger repeatedly at every ``timeout``
|
||||
|
@ -80,4 +76,3 @@ Methods
|
|||
ppm; likewise the RTC clock it slowed by negative values. The
|
||||
usable calibration range is:
|
||||
(-511 * 0.954) ~= -487.5 ppm up to (512 * 0.954) ~= 488.5 ppm
|
||||
|
||||
|
|
|
@ -7,8 +7,6 @@ class SPI -- a master-driven serial protocol
|
|||
SPI is a serial protocol that is driven by a master. At the physical level
|
||||
there are 3 lines: SCK, MOSI, MISO.
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
See usage model of I2C; SPI is very similar. Main difference is
|
||||
parameters to init the SPI bus::
|
||||
|
||||
|
@ -30,8 +28,6 @@ there are 3 lines: SCK, MOSI, MISO.
|
|||
Constructors
|
||||
------------
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
.. class:: pyb.SPI(bus, ...)
|
||||
|
||||
Construct an SPI object on the given bus. ``bus`` can be 1 or 2, or
|
||||
|
@ -55,8 +51,6 @@ Methods
|
|||
|
||||
Turn off the SPI bus.
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
.. method:: SPI.init(mode, baudrate=328125, \*, prescaler, polarity=1, phase=0, bits=8, firstbit=SPI.MSB, ti=False, crc=None)
|
||||
|
||||
Initialise the SPI bus with the given parameters:
|
||||
|
@ -82,8 +76,6 @@ Methods
|
|||
Printing the SPI object will show you the computed baudrate and the chosen
|
||||
prescaler.
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
.. method:: SPI.recv(recv, \*, timeout=5000)
|
||||
|
||||
Receive data on the bus:
|
||||
|
@ -119,8 +111,6 @@ Methods
|
|||
Constants
|
||||
---------
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
.. data:: SPI.MASTER
|
||||
.. data:: SPI.SLAVE
|
||||
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
class Timer -- control internal timers
|
||||
======================================
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
Timers can be used for a great variety of tasks. At the moment, only
|
||||
the simplest case is implemented: that of calling a function periodically.
|
||||
|
||||
|
@ -57,8 +55,6 @@ Constructors
|
|||
|
||||
.. class:: pyb.Timer(id, ...)
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
Construct a new timer object of the given id. If additional
|
||||
arguments are given, then the timer is initialised by ``init(...)``.
|
||||
``id`` can be 1 to 14.
|
||||
|
@ -66,8 +62,6 @@ Constructors
|
|||
Methods
|
||||
-------
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
.. method:: Timer.init(\*, freq, prescaler, period)
|
||||
|
||||
Initialise the timer. Initialisation must be either by frequency (in Hz)
|
||||
|
@ -119,23 +113,17 @@ Methods
|
|||
|
||||
Deinitialises the timer.
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
Disables the callback (and the associated irq).
|
||||
|
||||
Disables any channel callbacks (and the associated irq).
|
||||
Stops the timer, and disables the timer peripheral.
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
.. method:: Timer.callback(fun)
|
||||
|
||||
Set the function to be called when the timer triggers.
|
||||
``fun`` is passed 1 argument, the timer object.
|
||||
If ``fun`` is ``None`` then the callback will be disabled.
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
.. method:: Timer.channel(channel, mode, ...)
|
||||
|
||||
If only a channel number is passed, then a previously initialized channel
|
||||
|
@ -210,20 +198,14 @@ Methods
|
|||
ch2 = timer.channel(2, pyb.Timer.PWM, pin=pyb.Pin.board.X2, pulse_width=8000)
|
||||
ch3 = timer.channel(3, pyb.Timer.PWM, pin=pyb.Pin.board.X3, pulse_width=16000)
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
.. method:: Timer.counter([value])
|
||||
|
||||
Get or set the timer counter.
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
.. method:: Timer.freq([value])
|
||||
|
||||
Get or set the frequency for the timer (changes prescaler and period if set).
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
.. method:: Timer.period([value])
|
||||
|
||||
Get or set the period of the timer.
|
||||
|
@ -246,16 +228,12 @@ TimerChannel objects are created using the Timer.channel() method.
|
|||
Methods
|
||||
-------
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
.. method:: timerchannel.callback(fun)
|
||||
|
||||
Set the function to be called when the timer channel triggers.
|
||||
``fun`` is passed 1 argument, the timer object.
|
||||
If ``fun`` is ``None`` then the callback will be disabled.
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
.. method:: timerchannel.capture([value])
|
||||
|
||||
Get or set the capture value associated with a channel.
|
||||
|
|
|
@ -16,8 +16,6 @@ UART objects can be created and initialised using::
|
|||
uart = UART(1, 9600) # init with given baudrate
|
||||
uart.init(9600, bits=8, parity=None, stop=1) # init with given parameters
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
Bits can be 7, 8 or 9. Parity can be None, 0 (even) or 1 (odd). Stop can be 1 or 2.
|
||||
|
||||
*Note:* with parity=None, only 8 and 9 bits are supported. With parity enabled,
|
||||
|
@ -32,8 +30,6 @@ using the standard stream methods::
|
|||
uart.readinto(buf) # read and store into the given buffer
|
||||
uart.write('abc') # write the 3 characters
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
Individual characters can be read/written using::
|
||||
|
||||
uart.readchar() # read 1 character and returns it as an integer
|
||||
|
@ -50,8 +46,6 @@ using the standard stream methods::
|
|||
Constructors
|
||||
------------
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
.. class:: pyb.UART(bus, ...)
|
||||
|
||||
Construct a UART object on the given bus. ``bus`` can be 1-6, or 'XA', 'XB', 'YA', or 'YB'.
|
||||
|
@ -75,8 +69,6 @@ Constructors
|
|||
Methods
|
||||
-------
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
.. method:: UART.init(baudrate, bits=8, parity=None, stop=1, \*, timeout=1000, flow=0, timeout_char=0, read_buf_len=64)
|
||||
|
||||
Initialise the UART bus with the given parameters:
|
||||
|
@ -105,8 +97,6 @@ Methods
|
|||
|
||||
Turn off the UART bus.
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
.. method:: UART.any()
|
||||
|
||||
Returns the number of bytes waiting (may be 0).
|
||||
|
@ -120,8 +110,6 @@ Methods
|
|||
If ``nbytes`` is not given then the method reads as much data as possible. It
|
||||
returns after the timeout has elapsed.
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
*Note:* for 9 bit characters each character takes two bytes, ``nbytes`` must
|
||||
be even, and the number of characters is ``nbytes/2``.
|
||||
|
||||
|
@ -152,8 +140,6 @@ Methods
|
|||
|
||||
.. method:: UART.write(buf)
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
Write the buffer of bytes to the bus. If characters are 7 or 8 bits wide
|
||||
then each byte is one character. If characters are 9 bits wide then two
|
||||
bytes are used for each character (little endian), and ``buf`` must contain
|
||||
|
@ -162,8 +148,6 @@ Methods
|
|||
Return value: number of bytes written. If a timeout occurs and no bytes
|
||||
were written returns ``None``.
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
.. method:: UART.writechar(char)
|
||||
|
||||
Write a single character on the bus. ``char`` is an integer to write.
|
||||
|
@ -178,18 +162,14 @@ Methods
|
|||
Constants
|
||||
---------
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
.. data:: UART.RTS
|
||||
.. data:: UART.CTS
|
||||
UART.CTS
|
||||
|
||||
to select the flow control type.
|
||||
|
||||
Flow Control
|
||||
------------
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
On Pyboards V1 and V1.1 ``UART(2)`` and ``UART(3)`` support RTS/CTS hardware flow control
|
||||
using the following pins:
|
||||
|
||||
|
|
|
@ -114,8 +114,6 @@ Interrupt related functions
|
|||
Power related functions
|
||||
-----------------------
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
.. function:: freq([sysclk[, hclk[, pclk1[, pclk2]]]])
|
||||
|
||||
If given no arguments, returns a tuple of clock frequencies:
|
||||
|
@ -188,8 +186,6 @@ Power related functions
|
|||
Miscellaneous functions
|
||||
-----------------------
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
.. function:: have_cdc()
|
||||
|
||||
Return True if USB is connected as a serial device, False otherwise.
|
||||
|
@ -214,8 +210,6 @@ Miscellaneous functions
|
|||
|
||||
It only makes sense to call this function from within boot.py.
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
.. function:: mount(device, mountpoint, \*, readonly=False, mkfs=False)
|
||||
|
||||
Mount a block device and make it available as part of the filesystem.
|
||||
|
@ -251,8 +245,6 @@ Miscellaneous functions
|
|||
|
||||
Get or set the UART object where the REPL is repeated on.
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
.. function:: rng()
|
||||
|
||||
Return a 30-bit hardware generated random number.
|
||||
|
@ -261,8 +253,6 @@ Miscellaneous functions
|
|||
|
||||
Sync all file systems.
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
.. function:: unique_id()
|
||||
|
||||
Returns a string of 12 bytes (96 bits), which is the unique ID of the MCU.
|
||||
|
@ -298,8 +288,6 @@ Miscellaneous functions
|
|||
Classes
|
||||
-------
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
|
|
Loading…
Reference in New Issue