docs/pyb.*: Use proper class case in method headers.
Class designator will be used as is in indexes, so must match actual class name.
This commit is contained in:
parent
585aafc27e
commit
a384a53130
@ -36,12 +36,12 @@ Methods
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
.. method:: adc.read()
|
||||
.. method:: ADC.read()
|
||||
|
||||
Read the value on the analog pin and return it. The returned value
|
||||
will be between 0 and 4095.
|
||||
|
||||
.. method:: adc.read_timed(buf, timer)
|
||||
.. method:: ADC.read_timed(buf, timer)
|
||||
|
||||
Read analog values into ``buf`` at a rate set by the ``timer`` object.
|
||||
|
||||
|
@ -22,7 +22,7 @@ Constructors
|
||||
Methods
|
||||
-------
|
||||
|
||||
.. method:: accel.filtered_xyz()
|
||||
.. method:: Accel.filtered_xyz()
|
||||
|
||||
Get a 3-tuple of filtered x, y and z values.
|
||||
|
||||
@ -31,18 +31,18 @@ Methods
|
||||
with the sample from the current call. Returned values are therefore 4
|
||||
times the size of what they would be from the raw x(), y() and z() calls.
|
||||
|
||||
.. method:: accel.tilt()
|
||||
.. method:: Accel.tilt()
|
||||
|
||||
Get the tilt register.
|
||||
|
||||
.. method:: accel.x()
|
||||
.. method:: Accel.x()
|
||||
|
||||
Get the x-axis value.
|
||||
|
||||
.. method:: accel.y()
|
||||
.. method:: Accel.y()
|
||||
|
||||
Get the y-axis value.
|
||||
|
||||
.. method:: accel.z()
|
||||
.. method:: Accel.z()
|
||||
|
||||
Get the z-axis value.
|
||||
|
@ -48,7 +48,7 @@ Class Methods
|
||||
Methods
|
||||
-------
|
||||
|
||||
.. method:: can.init(mode, extframe=False, prescaler=100, \*, sjw=1, bs1=6, bs2=8)
|
||||
.. method:: CAN.init(mode, extframe=False, prescaler=100, \*, sjw=1, bs1=6, bs2=8)
|
||||
|
||||
Initialise the CAN bus with the given parameters:
|
||||
|
||||
@ -80,11 +80,11 @@ Methods
|
||||
|
||||
See page 680 of the STM32F405 datasheet for more details.
|
||||
|
||||
.. method:: can.deinit()
|
||||
.. method:: CAN.deinit()
|
||||
|
||||
Turn off the CAN bus.
|
||||
|
||||
.. method:: can.setfilter(bank, mode, fifo, params, \*, rtr)
|
||||
.. method:: CAN.setfilter(bank, mode, fifo, params, \*, rtr)
|
||||
|
||||
Configure a filter bank:
|
||||
|
||||
@ -126,17 +126,17 @@ Methods
|
||||
|CAN.MASK32 |1 |
|
||||
+-----------+----------------------+
|
||||
|
||||
.. method:: can.clearfilter(bank)
|
||||
.. method:: CAN.clearfilter(bank)
|
||||
|
||||
Clear and disables a filter bank:
|
||||
|
||||
- ``bank`` is the filter bank that is to be cleared.
|
||||
|
||||
.. method:: can.any(fifo)
|
||||
.. method:: CAN.any(fifo)
|
||||
|
||||
Return ``True`` if any message waiting on the FIFO, else ``False``.
|
||||
|
||||
.. method:: can.recv(fifo, \*, timeout=5000)
|
||||
.. method:: CAN.recv(fifo, \*, timeout=5000)
|
||||
|
||||
Receive data on the bus:
|
||||
|
||||
@ -150,7 +150,7 @@ Methods
|
||||
- The FMI (Filter Match Index) value.
|
||||
- An array containing the data.
|
||||
|
||||
.. method:: can.send(data, id, \*, timeout=0, rtr=False)
|
||||
.. method:: CAN.send(data, id, \*, timeout=0, rtr=False)
|
||||
|
||||
Send a message on the bus:
|
||||
|
||||
@ -170,7 +170,7 @@ Methods
|
||||
|
||||
Return value: ``None``.
|
||||
|
||||
.. method:: can.rxcallback(fifo, fun)
|
||||
.. method:: CAN.rxcallback(fifo, fun)
|
||||
|
||||
Register a function to be called when a message is accepted into a empty fifo:
|
||||
|
||||
|
@ -63,32 +63,32 @@ Constructors
|
||||
Methods
|
||||
-------
|
||||
|
||||
.. method:: dac.init(bits=8)
|
||||
.. method:: DAC.init(bits=8)
|
||||
|
||||
Reinitialise the DAC. ``bits`` can be 8 or 12.
|
||||
|
||||
.. method:: dac.deinit()
|
||||
.. method:: DAC.deinit()
|
||||
|
||||
De-initialise the DAC making its pin available for other uses.
|
||||
|
||||
.. method:: dac.noise(freq)
|
||||
.. method:: DAC.noise(freq)
|
||||
|
||||
Generate a pseudo-random noise signal. A new random sample is written
|
||||
to the DAC output at the given frequency.
|
||||
|
||||
.. method:: dac.triangle(freq)
|
||||
.. method:: DAC.triangle(freq)
|
||||
|
||||
Generate a triangle wave. The value on the DAC output changes at
|
||||
the given frequency, and the frequence of the repeating triangle wave
|
||||
itself is 2048 times smaller.
|
||||
|
||||
.. method:: dac.write(value)
|
||||
.. method:: DAC.write(value)
|
||||
|
||||
Direct access to the DAC output. The minimum value is 0. The maximum
|
||||
value is 2\*\*``bits``-1, where ``bits`` is set when creating the DAC
|
||||
object or by using the ``init`` method.
|
||||
|
||||
.. method:: dac.write_timed(data, freq, \*, mode=DAC.NORMAL)
|
||||
.. method:: DAC.write_timed(data, freq, \*, mode=DAC.NORMAL)
|
||||
|
||||
Initiates a burst of RAM to DAC using a DMA transfer.
|
||||
The input data is treated as an array of bytes in 8-bit mode, and
|
||||
|
@ -80,20 +80,20 @@ Class methods
|
||||
Methods
|
||||
-------
|
||||
|
||||
.. method:: extint.disable()
|
||||
.. method:: ExtInt.disable()
|
||||
|
||||
Disable the interrupt associated with the ExtInt object.
|
||||
This could be useful for debouncing.
|
||||
|
||||
.. method:: extint.enable()
|
||||
.. method:: ExtInt.enable()
|
||||
|
||||
Enable a disabled interrupt.
|
||||
|
||||
.. method:: extint.line()
|
||||
.. method:: ExtInt.line()
|
||||
|
||||
Return the line number that the pin is mapped to.
|
||||
|
||||
.. method:: extint.swint()
|
||||
.. method:: ExtInt.swint()
|
||||
|
||||
Trigger the callback from software.
|
||||
|
||||
|
@ -86,13 +86,13 @@ Constructors
|
||||
Methods
|
||||
-------
|
||||
|
||||
.. method:: i2c.deinit()
|
||||
.. method:: I2C.deinit()
|
||||
|
||||
Turn off the I2C bus.
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
.. method:: i2c.init(mode, \*, addr=0x12, baudrate=400000, gencall=False)
|
||||
.. method:: I2C.init(mode, \*, addr=0x12, baudrate=400000, gencall=False)
|
||||
|
||||
Initialise the I2C bus with the given parameters:
|
||||
|
||||
@ -101,11 +101,11 @@ Methods
|
||||
- ``baudrate`` is the SCL clock rate (only sensible for a master)
|
||||
- ``gencall`` is whether to support general call mode
|
||||
|
||||
.. method:: i2c.is_ready(addr)
|
||||
.. method:: I2C.is_ready(addr)
|
||||
|
||||
Check if an I2C device responds to the given address. Only valid when in master mode.
|
||||
|
||||
.. method:: i2c.mem_read(data, addr, memaddr, \*, timeout=5000, addr_size=8)
|
||||
.. method:: I2C.mem_read(data, addr, memaddr, \*, timeout=5000, addr_size=8)
|
||||
|
||||
Read from the memory of an I2C device:
|
||||
|
||||
@ -118,7 +118,7 @@ Methods
|
||||
Returns the read data.
|
||||
This is only valid in master mode.
|
||||
|
||||
.. method:: i2c.mem_write(data, addr, memaddr, \*, timeout=5000, addr_size=8)
|
||||
.. method:: I2C.mem_write(data, addr, memaddr, \*, timeout=5000, addr_size=8)
|
||||
|
||||
Write to the memory of an I2C device:
|
||||
|
||||
@ -131,7 +131,7 @@ Methods
|
||||
Returns ``None``.
|
||||
This is only valid in master mode.
|
||||
|
||||
.. method:: i2c.recv(recv, addr=0x00, \*, timeout=5000)
|
||||
.. method:: I2C.recv(recv, addr=0x00, \*, timeout=5000)
|
||||
|
||||
Receive data on the bus:
|
||||
|
||||
@ -143,7 +143,7 @@ Methods
|
||||
Return value: if ``recv`` is an integer then a new buffer of the bytes received,
|
||||
otherwise the same buffer that was passed in to ``recv``.
|
||||
|
||||
.. method:: i2c.send(send, addr=0x00, \*, timeout=5000)
|
||||
.. method:: I2C.send(send, addr=0x00, \*, timeout=5000)
|
||||
|
||||
Send data on the bus:
|
||||
|
||||
@ -153,7 +153,7 @@ Methods
|
||||
|
||||
Return value: ``None``.
|
||||
|
||||
.. method:: i2c.scan()
|
||||
.. method:: I2C.scan()
|
||||
|
||||
Scan all I2C addresses from 0x01 to 0x7f and return a list of those that respond.
|
||||
Only valid when in master mode.
|
||||
|
@ -49,48 +49,48 @@ Constructors
|
||||
Methods
|
||||
-------
|
||||
|
||||
.. method:: lcd.command(instr_data, buf)
|
||||
.. method:: LCD.command(instr_data, buf)
|
||||
|
||||
Send an arbitrary command to the LCD. Pass 0 for ``instr_data`` to send an
|
||||
instruction, otherwise pass 1 to send data. ``buf`` is a buffer with the
|
||||
instructions/data to send.
|
||||
|
||||
.. method:: lcd.contrast(value)
|
||||
.. method:: LCD.contrast(value)
|
||||
|
||||
Set the contrast of the LCD. Valid values are between 0 and 47.
|
||||
|
||||
.. method:: lcd.fill(colour)
|
||||
.. method:: LCD.fill(colour)
|
||||
|
||||
Fill the screen with the given colour (0 or 1 for white or black).
|
||||
|
||||
This method writes to the hidden buffer. Use ``show()`` to show the buffer.
|
||||
|
||||
.. method:: lcd.get(x, y)
|
||||
.. method:: LCD.get(x, y)
|
||||
|
||||
Get the pixel at the position ``(x, y)``. Returns 0 or 1.
|
||||
|
||||
This method reads from the visible buffer.
|
||||
|
||||
.. method:: lcd.light(value)
|
||||
.. method:: LCD.light(value)
|
||||
|
||||
Turn the backlight on/off. True or 1 turns it on, False or 0 turns it off.
|
||||
|
||||
.. method:: lcd.pixel(x, y, colour)
|
||||
.. method:: LCD.pixel(x, y, colour)
|
||||
|
||||
Set the pixel at ``(x, y)`` to the given colour (0 or 1).
|
||||
|
||||
This method writes to the hidden buffer. Use ``show()`` to show the buffer.
|
||||
|
||||
.. method:: lcd.show()
|
||||
.. method:: LCD.show()
|
||||
|
||||
Show the hidden buffer on the screen.
|
||||
|
||||
.. method:: lcd.text(str, x, y, colour)
|
||||
.. method:: LCD.text(str, x, y, colour)
|
||||
|
||||
Draw the given text to the position ``(x, y)`` using the given colour (0 or 1).
|
||||
|
||||
This method writes to the hidden buffer. Use ``show()`` to show the buffer.
|
||||
|
||||
.. method:: lcd.write(str)
|
||||
.. method:: LCD.write(str)
|
||||
|
||||
Write the string ``str`` to the screen. It will appear immediately.
|
||||
|
@ -20,7 +20,7 @@ Constructors
|
||||
Methods
|
||||
-------
|
||||
|
||||
.. method:: led.intensity([value])
|
||||
.. method:: LED.intensity([value])
|
||||
|
||||
Get or set the LED intensity. Intensity ranges between 0 (off) and 255 (full on).
|
||||
If no argument is given, return the LED intensity.
|
||||
@ -32,15 +32,15 @@ Methods
|
||||
relevant LED is set to a value between 1 and 254. Otherwise the timers are
|
||||
free for general purpose use.
|
||||
|
||||
.. method:: led.off()
|
||||
.. method:: LED.off()
|
||||
|
||||
Turn the LED off.
|
||||
|
||||
.. method:: led.on()
|
||||
.. method:: LED.on()
|
||||
|
||||
Turn the LED on, to maximum intensity.
|
||||
|
||||
.. method:: led.toggle()
|
||||
.. method:: LED.toggle()
|
||||
|
||||
Toggle the LED between on (maximum intensity) and off. If the LED is at
|
||||
non-zero intensity then it is considered "on" and toggle will turn it off.
|
||||
|
@ -104,7 +104,7 @@ 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:
|
||||
|
||||
@ -128,7 +128,7 @@ Methods
|
||||
|
||||
Returns: ``None``.
|
||||
|
||||
.. method:: pin.value([value])
|
||||
.. method:: Pin.value([value])
|
||||
|
||||
Get or set the digital logic level of the pin:
|
||||
|
||||
@ -139,39 +139,39 @@ Methods
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
.. method:: pin.__str__()
|
||||
.. method:: Pin.__str__()
|
||||
|
||||
Return a string describing the pin object.
|
||||
|
||||
.. method:: pin.af()
|
||||
.. method:: Pin.af()
|
||||
|
||||
Returns the currently configured alternate-function of the pin. The
|
||||
integer returned will match one of the allowed constants for the af
|
||||
argument to the init function.
|
||||
|
||||
.. method:: pin.gpio()
|
||||
.. method:: Pin.gpio()
|
||||
|
||||
Returns the base address of the GPIO block associated with this pin.
|
||||
|
||||
.. method:: pin.mode()
|
||||
.. method:: Pin.mode()
|
||||
|
||||
Returns the currently configured mode of the pin. The integer returned
|
||||
will match one of the allowed constants for the mode argument to the init
|
||||
function.
|
||||
|
||||
.. method:: pin.name()
|
||||
.. method:: Pin.name()
|
||||
|
||||
Get the pin name.
|
||||
|
||||
.. method:: pin.names()
|
||||
.. method:: Pin.names()
|
||||
|
||||
Returns the cpu and board names for this pin.
|
||||
|
||||
.. method:: pin.pin()
|
||||
.. method:: Pin.pin()
|
||||
|
||||
Get the pin number.
|
||||
|
||||
.. method:: pin.port()
|
||||
.. method:: Pin.port()
|
||||
|
||||
Get the pin port.
|
||||
|
||||
@ -179,7 +179,7 @@ Methods
|
||||
|
||||
Returns an array of alternate functions available for this pin.
|
||||
|
||||
.. method:: pin.pull()
|
||||
.. method:: Pin.pull()
|
||||
|
||||
Returns the currently configured pull of the pin. The integer returned
|
||||
will match one of the allowed constants for the pull argument to the init
|
||||
|
@ -25,7 +25,7 @@ Constructors
|
||||
Methods
|
||||
-------
|
||||
|
||||
.. method:: rtc.datetime([datetimetuple])
|
||||
.. method:: RTC.datetime([datetimetuple])
|
||||
|
||||
Get or set the date and time of the RTC.
|
||||
|
||||
@ -45,7 +45,7 @@ Methods
|
||||
|
||||
.. 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``
|
||||
milliseconds. This trigger can wake the pyboard from both the sleep
|
||||
@ -56,7 +56,7 @@ Methods
|
||||
If ``callback`` is given then it is executed at every trigger of the
|
||||
wakeup timer. ``callback`` must take exactly one argument.
|
||||
|
||||
.. method:: rtc.info()
|
||||
.. method:: RTC.info()
|
||||
|
||||
Get information about the startup time and reset source.
|
||||
|
||||
@ -65,7 +65,7 @@ Methods
|
||||
- Bit 0x10000 is set if a power-on reset occurred.
|
||||
- Bit 0x20000 is set if an external reset occurred
|
||||
|
||||
.. method:: rtc.calibration(cal)
|
||||
.. method:: RTC.calibration(cal)
|
||||
|
||||
Get or set RTC calibration.
|
||||
|
||||
|
@ -51,13 +51,13 @@ Constructors
|
||||
Methods
|
||||
-------
|
||||
|
||||
.. method:: spi.deinit()
|
||||
.. method:: SPI.deinit()
|
||||
|
||||
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:
|
||||
|
||||
@ -83,7 +83,7 @@ Methods
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
.. method:: spi.recv(recv, \*, timeout=5000)
|
||||
.. method:: SPI.recv(recv, \*, timeout=5000)
|
||||
|
||||
Receive data on the bus:
|
||||
|
||||
@ -94,7 +94,7 @@ Methods
|
||||
Return value: if ``recv`` is an integer then a new buffer of the bytes received,
|
||||
otherwise the same buffer that was passed in to ``recv``.
|
||||
|
||||
.. method:: spi.send(send, \*, timeout=5000)
|
||||
.. method:: SPI.send(send, \*, timeout=5000)
|
||||
|
||||
Send data on the bus:
|
||||
|
||||
@ -103,7 +103,7 @@ Methods
|
||||
|
||||
Return value: ``None``.
|
||||
|
||||
.. method:: spi.send_recv(send, recv=None, \*, timeout=5000)
|
||||
.. method:: SPI.send_recv(send, recv=None, \*, timeout=5000)
|
||||
|
||||
Send and receive data on the bus at the same time:
|
||||
|
||||
|
@ -38,7 +38,7 @@ Constructors
|
||||
Methods
|
||||
-------
|
||||
|
||||
.. method:: servo.angle([angle, time=0])
|
||||
.. method:: Servo.angle([angle, time=0])
|
||||
|
||||
If no arguments are given, this function returns the current angle.
|
||||
|
||||
@ -49,7 +49,7 @@ Methods
|
||||
angle. If omitted, then the servo moves as quickly as possible to its
|
||||
new position.
|
||||
|
||||
.. method:: servo.speed([speed, time=0])
|
||||
.. method:: Servo.speed([speed, time=0])
|
||||
|
||||
If no arguments are given, this function returns the current speed.
|
||||
|
||||
@ -59,14 +59,14 @@ Methods
|
||||
- ``time`` is the number of milliseconds to take to get to the specified
|
||||
speed. If omitted, then the servo accelerates as quickly as possible.
|
||||
|
||||
.. method:: servo.pulse_width([value])
|
||||
.. method:: Servo.pulse_width([value])
|
||||
|
||||
If no arguments are given, this function returns the current raw pulse-width
|
||||
value.
|
||||
|
||||
If an argument is given, this function sets the raw pulse-width value.
|
||||
|
||||
.. method:: servo.calibration([pulse_min, pulse_max, pulse_centre, [pulse_angle_90, pulse_speed_100]])
|
||||
.. method:: Servo.calibration([pulse_min, pulse_max, pulse_centre, [pulse_angle_90, pulse_speed_100]])
|
||||
|
||||
If no arguments are given, this function returns the current calibration
|
||||
data, as a 5-tuple.
|
||||
|
@ -29,11 +29,12 @@ Constructors
|
||||
Methods
|
||||
-------
|
||||
|
||||
.. method:: switch()
|
||||
.. method:: Switch.__call__()
|
||||
|
||||
Return the switch state: ``True`` if pressed down, ``False`` otherwise.
|
||||
Call switch object directly to get its state: ``True`` if pressed down,
|
||||
``False`` otherwise.
|
||||
|
||||
.. method:: switch.callback(fun)
|
||||
.. method:: Switch.callback(fun)
|
||||
|
||||
Register the given function to be called when the switch is pressed down.
|
||||
If ``fun`` is ``None``, then it disables the callback.
|
||||
|
@ -68,7 +68,7 @@ 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)
|
||||
or by prescaler and period::
|
||||
@ -115,7 +115,7 @@ Methods
|
||||
|
||||
You must either specify freq or both of period and prescaler.
|
||||
|
||||
.. method:: timer.deinit()
|
||||
.. method:: Timer.deinit()
|
||||
|
||||
Deinitialises the timer.
|
||||
|
||||
@ -128,7 +128,7 @@ Methods
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
.. method:: timer.callback(fun)
|
||||
.. method:: Timer.callback(fun)
|
||||
|
||||
Set the function to be called when the timer triggers.
|
||||
``fun`` is passed 1 argument, the timer object.
|
||||
@ -136,7 +136,7 @@ Methods
|
||||
|
||||
.. 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
|
||||
object is returned (or ``None`` if there is no previous channel).
|
||||
@ -212,27 +212,27 @@ Methods
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
.. method:: timer.counter([value])
|
||||
.. method:: Timer.counter([value])
|
||||
|
||||
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).
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
.. method:: timer.period([value])
|
||||
.. method:: Timer.period([value])
|
||||
|
||||
Get or set the period of the timer.
|
||||
|
||||
.. method:: timer.prescaler([value])
|
||||
.. method:: Timer.prescaler([value])
|
||||
|
||||
Get or set the prescaler for the timer.
|
||||
|
||||
.. method:: timer.source_freq()
|
||||
.. method:: Timer.source_freq()
|
||||
|
||||
Get the frequency of the source of the timer.
|
||||
|
||||
|
@ -77,7 +77,7 @@ 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:
|
||||
|
||||
@ -101,22 +101,22 @@ Methods
|
||||
*Note:* with parity=None, only 8 and 9 bits are supported. With parity enabled,
|
||||
only 7 and 8 bits are supported.
|
||||
|
||||
.. method:: uart.deinit()
|
||||
.. method:: UART.deinit()
|
||||
|
||||
Turn off the UART bus.
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
.. method:: uart.any()
|
||||
.. method:: UART.any()
|
||||
|
||||
Returns the number of bytes waiting (may be 0).
|
||||
|
||||
.. method:: uart.writechar(char)
|
||||
.. method:: UART.writechar(char)
|
||||
|
||||
Write a single character on the bus. ``char`` is an integer to write.
|
||||
Return value: ``None``. See note below if CTS flow control is used.
|
||||
|
||||
.. method:: uart.read([nbytes])
|
||||
.. method:: UART.read([nbytes])
|
||||
|
||||
Read characters. If ``nbytes`` is specified then read at most that many bytes.
|
||||
If ``nbytes`` are available in the buffer, returns immediately, otherwise returns
|
||||
@ -130,19 +130,19 @@ Methods
|
||||
Return value: a bytes object containing the bytes read in. Returns ``None``
|
||||
on timeout.
|
||||
|
||||
.. method:: uart.readall()
|
||||
.. method:: UART.readall()
|
||||
|
||||
Read as much data as possible. Returns after the timeout has elapsed.
|
||||
|
||||
Return value: a bytes object or ``None`` if timeout prevents any data being read.
|
||||
|
||||
.. method:: uart.readchar()
|
||||
.. method:: UART.readchar()
|
||||
|
||||
Receive a single character on the bus.
|
||||
|
||||
Return value: The character read, as an integer. Returns -1 on timeout.
|
||||
|
||||
.. method:: uart.readinto(buf[, nbytes])
|
||||
.. method:: UART.readinto(buf[, nbytes])
|
||||
|
||||
Read bytes into the ``buf``. If ``nbytes`` is specified then read at most
|
||||
that many bytes. Otherwise, read at most ``len(buf)`` bytes.
|
||||
@ -150,7 +150,7 @@ Methods
|
||||
Return value: number of bytes read and stored into ``buf`` or ``None`` on
|
||||
timeout.
|
||||
|
||||
.. method:: uart.readline()
|
||||
.. method:: UART.readline()
|
||||
|
||||
Read a line, ending in a newline character. If such a line exists, return is
|
||||
immediate. If the timeout elapses, all available data is returned regardless
|
||||
@ -158,7 +158,7 @@ Methods
|
||||
|
||||
Return value: the line read or ``None`` on timeout if no data is available.
|
||||
|
||||
.. method:: uart.write(buf)
|
||||
.. method:: UART.write(buf)
|
||||
|
||||
.. only:: port_pyboard
|
||||
|
||||
@ -170,7 +170,7 @@ Methods
|
||||
Return value: number of bytes written. If a timeout occurs and no bytes
|
||||
were written returns ``None``.
|
||||
|
||||
.. method:: uart.sendbreak()
|
||||
.. method:: UART.sendbreak()
|
||||
|
||||
Send a break condition on the bus. This drives the bus low for a duration
|
||||
of 13 bits.
|
||||
@ -215,14 +215,14 @@ Flow Control
|
||||
|
||||
If CTS flow control is enabled the write behaviour is as follows:
|
||||
|
||||
If the Pyboard's ``uart.write(buf)`` method is called, transmission will stall for
|
||||
If the Pyboard's ``UART.write(buf)`` method is called, transmission will stall for
|
||||
any periods when ``nCTS`` is ``False``. This will result in a timeout if the entire
|
||||
buffer was not transmitted in the timeout period. The method returns the number of
|
||||
bytes written, enabling the user to write the remainder of the data if required. In
|
||||
the event of a timeout, a character will remain in the UART pending ``nCTS``. The
|
||||
number of bytes composing this character will be included in the return value.
|
||||
|
||||
If ``uart.writechar()`` is called when ``nCTS`` is ``False`` the method will time
|
||||
If ``UART.writechar()`` is called when ``nCTS`` is ``False`` the method will time
|
||||
out unless the target asserts ``nCTS`` in time. If it times out ``OSError 116``
|
||||
will be raised. The character will be transmitted as soon as the target asserts ``nCTS``.
|
||||
|
||||
|
@ -19,7 +19,7 @@ Constructors
|
||||
Methods
|
||||
-------
|
||||
|
||||
.. method:: usb_vcp.setinterrupt(chr)
|
||||
.. method:: USB_VCP.setinterrupt(chr)
|
||||
|
||||
Set the character which interrupts running Python code. This is set
|
||||
to 3 (CTRL-C) by default, and when a CTRL-C character is received over
|
||||
@ -28,20 +28,20 @@ Methods
|
||||
Set to -1 to disable this interrupt feature. This is useful when you
|
||||
want to send raw bytes over the USB VCP port.
|
||||
|
||||
.. method:: usb_vcp.isconnected()
|
||||
.. method:: USB_VCP.isconnected()
|
||||
|
||||
Return ``True`` if USB is connected as a serial device, else ``False``.
|
||||
|
||||
.. method:: usb_vcp.any()
|
||||
.. method:: USB_VCP.any()
|
||||
|
||||
Return ``True`` if any characters waiting, else ``False``.
|
||||
|
||||
.. method:: usb_vcp.close()
|
||||
.. method:: USB_VCP.close()
|
||||
|
||||
This method does nothing. It exists so the USB_VCP object can act as
|
||||
a file.
|
||||
|
||||
.. method:: usb_vcp.read([nbytes])
|
||||
.. method:: USB_VCP.read([nbytes])
|
||||
|
||||
Read at most ``nbytes`` from the serial device and return them as a
|
||||
bytes object. If ``nbytes`` is not specified then the method acts as
|
||||
@ -49,12 +49,12 @@ Methods
|
||||
so if no pending data available, this method will return immediately
|
||||
with ``None`` value.
|
||||
|
||||
.. method:: usb_vcp.readall()
|
||||
.. method:: USB_VCP.readall()
|
||||
|
||||
Read all available bytes from the serial device and return them as
|
||||
a bytes object, or ``None`` if no pending data available.
|
||||
|
||||
.. method:: usb_vcp.readinto(buf, [maxlen])
|
||||
.. method:: USB_VCP.readinto(buf, [maxlen])
|
||||
|
||||
Read bytes from the serial device and store them into ``buf``, which
|
||||
should be a buffer-like object. At most ``len(buf)`` bytes are read.
|
||||
@ -64,14 +64,14 @@ Methods
|
||||
Returns the number of bytes read and stored into ``buf`` or ``None``
|
||||
if no pending data available.
|
||||
|
||||
.. method:: usb_vcp.readline()
|
||||
.. method:: USB_VCP.readline()
|
||||
|
||||
Read a whole line from the serial device.
|
||||
|
||||
Returns a bytes object containing the data, including the trailing
|
||||
newline character or ``None`` if no pending data available.
|
||||
|
||||
.. method:: usb_vcp.readlines()
|
||||
.. method:: USB_VCP.readlines()
|
||||
|
||||
Read as much data as possible from the serial device, breaking it into
|
||||
lines.
|
||||
@ -79,13 +79,13 @@ Methods
|
||||
Returns a list of bytes objects, each object being one of the lines.
|
||||
Each line will include the newline character.
|
||||
|
||||
.. method:: usb_vcp.write(buf)
|
||||
.. method:: USB_VCP.write(buf)
|
||||
|
||||
Write the bytes from ``buf`` to the serial device.
|
||||
|
||||
Returns the number of bytes written.
|
||||
|
||||
.. method:: usb_vcp.recv(data, \*, timeout=5000)
|
||||
.. method:: USB_VCP.recv(data, \*, timeout=5000)
|
||||
|
||||
Receive data on the bus:
|
||||
|
||||
@ -96,7 +96,7 @@ Methods
|
||||
Return value: if ``data`` is an integer then a new buffer of the bytes received,
|
||||
otherwise the number of bytes read into ``data`` is returned.
|
||||
|
||||
.. method:: usb_vcp.send(data, \*, timeout=5000)
|
||||
.. method:: USB_VCP.send(data, \*, timeout=5000)
|
||||
|
||||
Send data over the USB VCP:
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user