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 in
cfcf47c0644952358e1a260db159e807872a37e6 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 in 4542643025c77a7272bde348b89d5039aea28d23, so there's no
need to retain any more conditionals.
This commit is contained in:
Damien George 2018-07-18 15:47:44 +10:00
parent 419eb86074
commit 805fd0cfe6
8 changed files with 966 additions and 1066 deletions

View File

@ -4,8 +4,6 @@
class ADC -- analog to digital conversion class ADC -- analog to digital conversion
========================================= =========================================
.. only:: port_pyboard
Usage:: Usage::
import pyb import pyb
@ -25,9 +23,6 @@ class ADC -- analog to digital conversion
Constructors Constructors
------------ ------------
.. only:: port_pyboard
.. class:: pyb.ADC(pin) .. class:: pyb.ADC(pin)
Create an ADC object associated with the given pin. Create an ADC object associated with the given pin.
@ -36,8 +31,6 @@ Constructors
Methods Methods
------- -------
.. only:: port_pyboard
.. method:: ADC.read() .. method:: ADC.read()
Read the value on the analog pin and return it. The returned value Read the value on the analog pin and return it. The returned value
@ -133,8 +126,6 @@ Methods
The ADCAll Object The ADCAll Object
----------------- -----------------
.. only:: port_pyboard
Instantiating this changes all masked ADC pins to analog inputs. The preprocessed MCU temperature, 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. 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). Appropriate scaling is handled according to reference voltage used (usually 3.3V).

View File

@ -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 I2C objects are created attached to a specific bus. They can be initialised
when created, or initialised later on. when created, or initialised later on.
.. only:: port_pyboard
Example:: Example::
from pyb import I2C from pyb import I2C
@ -24,8 +22,6 @@ when created, or initialised later on.
Printing the i2c object gives you information about its configuration. Printing the i2c object gives you information about its configuration.
.. only:: port_pyboard
The basic methods are send and recv:: The basic methods are send and recv::
i2c.send('abc') # send 3 bytes i2c.send('abc') # send 3 bytes
@ -60,8 +56,6 @@ Printing the i2c object gives you information about its configuration.
Constructors Constructors
------------ ------------
.. only:: port_pyboard
.. class:: pyb.I2C(bus, ...) .. class:: pyb.I2C(bus, ...)
Construct an I2C object on the given bus. ``bus`` can be 1 or 2, 'X' or 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. Turn off the I2C bus.
.. only:: port_pyboard
.. method:: I2C.init(mode, \*, addr=0x12, baudrate=400000, gencall=False, dma=False) .. method:: I2C.init(mode, \*, addr=0x12, baudrate=400000, gencall=False, dma=False)
Initialise the I2C bus with the given parameters: Initialise the I2C bus with the given parameters:
@ -168,8 +160,6 @@ Constants
for initialising the bus to master mode for initialising the bus to master mode
.. only:: port_pyboard
.. data:: I2C.SLAVE .. data:: I2C.SLAVE
for initialising the bus to slave mode for initialising the bus to slave mode

View File

@ -10,8 +10,6 @@ digital logic level. For analog control of a pin, see the ADC class.
Usage Model: Usage Model:
.. only:: port_pyboard
All Board Pins are predefined as pyb.Pin.board.Name:: All Board Pins are predefined as pyb.Pin.board.Name::
x1_pin = pyb.Pin.board.X1 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, 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`. they are used to initialise the pin. See :meth:`pin.init`.
.. only:: port_pyboard
Class methods Class methods
------------- -------------
@ -102,8 +98,6 @@ Constructors
Methods Methods
------- -------
.. only:: port_pyboard
.. method:: Pin.init(mode, pull=Pin.PULL_NONE, af=-1) .. method:: Pin.init(mode, pull=Pin.PULL_NONE, af=-1)
Initialise the pin: Initialise the pin:
@ -137,8 +131,6 @@ Methods
anything that converts to a boolean. If it converts to ``True``, the pin anything that converts to a boolean. If it converts to ``True``, the pin
is set high, otherwise it is set low. is set high, otherwise it is set low.
.. only:: port_pyboard
.. method:: Pin.__str__() .. method:: Pin.__str__()
Return a string describing the pin object. Return a string describing the pin object.
@ -188,8 +180,6 @@ Methods
Constants Constants
--------- ---------
.. only:: port_pyboard
.. data:: Pin.AF_OD .. data:: Pin.AF_OD
initialise the pin to alternate-function mode with an open-drain drive 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 enable the pull-up resistor on the pin
.. only:: port_pyboard
class PinAF -- Pin Alternate Functions class PinAF -- Pin Alternate Functions
====================================== ======================================

View File

@ -33,8 +33,6 @@ Methods
date and time. With 1 argument (being an 8-tuple) it sets the date date and time. With 1 argument (being an 8-tuple) it sets the date
and time (and ``subseconds`` is reset to 255). and time (and ``subseconds`` is reset to 255).
.. only:: port_pyboard
The 8-tuple has the following format: The 8-tuple has the following format:
(year, month, day, weekday, hours, minutes, seconds, subseconds) (year, month, day, weekday, hours, minutes, seconds, subseconds)
@ -43,8 +41,6 @@ Methods
``subseconds`` counts down from 255 to 0 ``subseconds`` counts down from 255 to 0
.. only:: port_pyboard
.. method:: RTC.wakeup(timeout, callback=None) .. method:: RTC.wakeup(timeout, callback=None)
Set the RTC wakeup timer to trigger repeatedly at every ``timeout`` 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 ppm; likewise the RTC clock it slowed by negative values. The
usable calibration range is: usable calibration range is:
(-511 * 0.954) ~= -487.5 ppm up to (512 * 0.954) ~= 488.5 ppm (-511 * 0.954) ~= -487.5 ppm up to (512 * 0.954) ~= 488.5 ppm

View File

@ -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 SPI is a serial protocol that is driven by a master. At the physical level
there are 3 lines: SCK, MOSI, MISO. there are 3 lines: SCK, MOSI, MISO.
.. only:: port_pyboard
See usage model of I2C; SPI is very similar. Main difference is See usage model of I2C; SPI is very similar. Main difference is
parameters to init the SPI bus:: parameters to init the SPI bus::
@ -30,8 +28,6 @@ there are 3 lines: SCK, MOSI, MISO.
Constructors Constructors
------------ ------------
.. only:: port_pyboard
.. class:: pyb.SPI(bus, ...) .. class:: pyb.SPI(bus, ...)
Construct an SPI object on the given bus. ``bus`` can be 1 or 2, or 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. 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) .. 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: 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 Printing the SPI object will show you the computed baudrate and the chosen
prescaler. prescaler.
.. only:: port_pyboard
.. method:: SPI.recv(recv, \*, timeout=5000) .. method:: SPI.recv(recv, \*, timeout=5000)
Receive data on the bus: Receive data on the bus:
@ -119,8 +111,6 @@ Methods
Constants Constants
--------- ---------
.. only:: port_pyboard
.. data:: SPI.MASTER .. data:: SPI.MASTER
.. data:: SPI.SLAVE .. data:: SPI.SLAVE

View File

@ -4,8 +4,6 @@
class Timer -- control internal timers class Timer -- control internal timers
====================================== ======================================
.. only:: port_pyboard
Timers can be used for a great variety of tasks. At the moment, only 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. the simplest case is implemented: that of calling a function periodically.
@ -57,8 +55,6 @@ Constructors
.. class:: pyb.Timer(id, ...) .. class:: pyb.Timer(id, ...)
.. only:: port_pyboard
Construct a new timer object of the given id. If additional Construct a new timer object of the given id. If additional
arguments are given, then the timer is initialised by ``init(...)``. arguments are given, then the timer is initialised by ``init(...)``.
``id`` can be 1 to 14. ``id`` can be 1 to 14.
@ -66,8 +62,6 @@ Constructors
Methods Methods
------- -------
.. only:: port_pyboard
.. method:: Timer.init(\*, freq, prescaler, period) .. method:: Timer.init(\*, freq, prescaler, period)
Initialise the timer. Initialisation must be either by frequency (in Hz) Initialise the timer. Initialisation must be either by frequency (in Hz)
@ -119,23 +113,17 @@ Methods
Deinitialises the timer. Deinitialises the timer.
.. only:: port_pyboard
Disables the callback (and the associated irq). Disables the callback (and the associated irq).
Disables any channel callbacks (and the associated irq). Disables any channel callbacks (and the associated irq).
Stops the timer, and disables the timer peripheral. Stops the timer, and disables the timer peripheral.
.. only:: port_pyboard
.. method:: Timer.callback(fun) .. method:: Timer.callback(fun)
Set the function to be called when the timer triggers. Set the function to be called when the timer triggers.
``fun`` is passed 1 argument, the timer object. ``fun`` is passed 1 argument, the timer object.
If ``fun`` is ``None`` then the callback will be disabled. If ``fun`` is ``None`` then the callback will be disabled.
.. only:: port_pyboard
.. method:: Timer.channel(channel, mode, ...) .. method:: Timer.channel(channel, mode, ...)
If only a channel number is passed, then a previously initialized channel 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) 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) ch3 = timer.channel(3, pyb.Timer.PWM, pin=pyb.Pin.board.X3, pulse_width=16000)
.. only:: port_pyboard
.. method:: Timer.counter([value]) .. method:: Timer.counter([value])
Get or set the timer counter. Get or set the timer counter.
.. only:: port_pyboard
.. method:: Timer.freq([value]) .. method:: Timer.freq([value])
Get or set the frequency for the timer (changes prescaler and period if set). Get or set the frequency for the timer (changes prescaler and period if set).
.. only:: port_pyboard
.. method:: Timer.period([value]) .. method:: Timer.period([value])
Get or set the period of the timer. Get or set the period of the timer.
@ -246,16 +228,12 @@ TimerChannel objects are created using the Timer.channel() method.
Methods Methods
------- -------
.. only:: port_pyboard
.. method:: timerchannel.callback(fun) .. method:: timerchannel.callback(fun)
Set the function to be called when the timer channel triggers. Set the function to be called when the timer channel triggers.
``fun`` is passed 1 argument, the timer object. ``fun`` is passed 1 argument, the timer object.
If ``fun`` is ``None`` then the callback will be disabled. If ``fun`` is ``None`` then the callback will be disabled.
.. only:: port_pyboard
.. method:: timerchannel.capture([value]) .. method:: timerchannel.capture([value])
Get or set the capture value associated with a channel. Get or set the capture value associated with a channel.

View File

@ -16,8 +16,6 @@ UART objects can be created and initialised using::
uart = UART(1, 9600) # init with given baudrate uart = UART(1, 9600) # init with given baudrate
uart.init(9600, bits=8, parity=None, stop=1) # init with given parameters 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. 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, *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.readinto(buf) # read and store into the given buffer
uart.write('abc') # write the 3 characters uart.write('abc') # write the 3 characters
.. only:: port_pyboard
Individual characters can be read/written using:: Individual characters can be read/written using::
uart.readchar() # read 1 character and returns it as an integer uart.readchar() # read 1 character and returns it as an integer
@ -50,8 +46,6 @@ using the standard stream methods::
Constructors Constructors
------------ ------------
.. only:: port_pyboard
.. class:: pyb.UART(bus, ...) .. class:: pyb.UART(bus, ...)
Construct a UART object on the given bus. ``bus`` can be 1-6, or 'XA', 'XB', 'YA', or 'YB'. 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 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) .. 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: Initialise the UART bus with the given parameters:
@ -105,8 +97,6 @@ Methods
Turn off the UART bus. Turn off the UART bus.
.. only:: port_pyboard
.. method:: UART.any() .. method:: UART.any()
Returns the number of bytes waiting (may be 0). 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 If ``nbytes`` is not given then the method reads as much data as possible. It
returns after the timeout has elapsed. returns after the timeout has elapsed.
.. only:: port_pyboard
*Note:* for 9 bit characters each character takes two bytes, ``nbytes`` must *Note:* for 9 bit characters each character takes two bytes, ``nbytes`` must
be even, and the number of characters is ``nbytes/2``. be even, and the number of characters is ``nbytes/2``.
@ -152,8 +140,6 @@ Methods
.. method:: UART.write(buf) .. method:: UART.write(buf)
.. only:: port_pyboard
Write the buffer of bytes to the bus. If characters are 7 or 8 bits wide 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 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 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 Return value: number of bytes written. If a timeout occurs and no bytes
were written returns ``None``. were written returns ``None``.
.. only:: port_pyboard
.. method:: UART.writechar(char) .. method:: UART.writechar(char)
Write a single character on the bus. ``char`` is an integer to write. Write a single character on the bus. ``char`` is an integer to write.
@ -178,18 +162,14 @@ Methods
Constants Constants
--------- ---------
.. only:: port_pyboard
.. data:: UART.RTS .. data:: UART.RTS
.. data:: UART.CTS UART.CTS
to select the flow control type. to select the flow control type.
Flow Control Flow Control
------------ ------------
.. only:: port_pyboard
On Pyboards V1 and V1.1 ``UART(2)`` and ``UART(3)`` support RTS/CTS hardware flow control On Pyboards V1 and V1.1 ``UART(2)`` and ``UART(3)`` support RTS/CTS hardware flow control
using the following pins: using the following pins:

View File

@ -114,8 +114,6 @@ Interrupt related functions
Power related functions Power related functions
----------------------- -----------------------
.. only:: port_pyboard
.. function:: freq([sysclk[, hclk[, pclk1[, pclk2]]]]) .. function:: freq([sysclk[, hclk[, pclk1[, pclk2]]]])
If given no arguments, returns a tuple of clock frequencies: If given no arguments, returns a tuple of clock frequencies:
@ -188,8 +186,6 @@ Power related functions
Miscellaneous functions Miscellaneous functions
----------------------- -----------------------
.. only:: port_pyboard
.. function:: have_cdc() .. function:: have_cdc()
Return True if USB is connected as a serial device, False otherwise. 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. It only makes sense to call this function from within boot.py.
.. only:: port_pyboard
.. function:: mount(device, mountpoint, \*, readonly=False, mkfs=False) .. function:: mount(device, mountpoint, \*, readonly=False, mkfs=False)
Mount a block device and make it available as part of the filesystem. 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. Get or set the UART object where the REPL is repeated on.
.. only:: port_pyboard
.. function:: rng() .. function:: rng()
Return a 30-bit hardware generated random number. Return a 30-bit hardware generated random number.
@ -261,8 +253,6 @@ Miscellaneous functions
Sync all file systems. Sync all file systems.
.. only:: port_pyboard
.. function:: unique_id() .. function:: unique_id()
Returns a string of 12 bytes (96 bits), which is the unique ID of the MCU. Returns a string of 12 bytes (96 bits), which is the unique ID of the MCU.
@ -298,8 +288,6 @@ Miscellaneous functions
Classes Classes
------- -------
.. only:: port_pyboard
.. toctree:: .. toctree::
:maxdepth: 1 :maxdepth: 1