docs: Remove spaces on lines that are empty.

pull/5381/head
Damien George 2019-12-04 15:02:54 +11:00
rodzic 40cc7ec677
commit 90c524c114
24 zmienionych plików z 53 dodań i 53 usunięć

Wyświetl plik

@ -359,10 +359,10 @@ Notes:
To further reduce power consumption it is possible to disable the internal pullups:: To further reduce power consumption it is possible to disable the internal pullups::
p1 = Pin(4, Pin.IN, Pin.PULL_HOLD) p1 = Pin(4, Pin.IN, Pin.PULL_HOLD)
After leaving deepsleep it may be necessary to un-hold the pin explicitly (e.g. if After leaving deepsleep it may be necessary to un-hold the pin explicitly (e.g. if
it is an output pin) via:: it is an output pin) via::
p1 = Pin(4, Pin.OUT, None) p1 = Pin(4, Pin.OUT, None)
OneWire driver OneWire driver

Wyświetl plik

@ -44,7 +44,7 @@ Now that we are connected we can download and display the data::
... data = s.recv(500) ... data = s.recv(500)
... print(str(data, 'utf8'), end='') ... print(str(data, 'utf8'), end='')
... ...
When this loop executes it should start showing the animation (use ctrl-C to When this loop executes it should start showing the animation (use ctrl-C to
interrupt it). interrupt it).

Wyświetl plik

@ -340,7 +340,7 @@ Advanced commands
.. method:: LCD160CR.set_scroll_win_param(win, param, value) .. method:: LCD160CR.set_scroll_win_param(win, param, value)
Set a single parameter of a scrolling window region: Set a single parameter of a scrolling window region:
- *win* is the window id, 0..8. - *win* is the window id, 0..8.
- *param* is the parameter number to configure, 0..7, and corresponds - *param* is the parameter number to configure, 0..7, and corresponds
to the parameters in the `set_scroll_win` method. to the parameters in the `set_scroll_win` method.

Wyświetl plik

@ -27,7 +27,7 @@ Methods
.. method:: RTC.init(datetime) .. method:: RTC.init(datetime)
Initialise the RTC. Datetime is a tuple of the form: Initialise the RTC. Datetime is a tuple of the form:
``(year, month, day[, hour[, minute[, second[, microsecond[, tzinfo]]]]])`` ``(year, month, day[, hour[, minute[, second[, microsecond[, tzinfo]]]]])``
.. method:: RTC.now() .. method:: RTC.now()

Wyświetl plik

@ -47,9 +47,9 @@ Methods
tim.init(Timer.ONE_SHOT, width=32) # one shot 32-bit timer tim.init(Timer.ONE_SHOT, width=32) # one shot 32-bit timer
Keyword arguments: Keyword arguments:
- ``mode`` can be one of: - ``mode`` can be one of:
- ``TimerWiPy.ONE_SHOT`` - The timer runs once until the configured - ``TimerWiPy.ONE_SHOT`` - The timer runs once until the configured
period of the channel expires. period of the channel expires.
- ``TimerWiPy.PERIODIC`` - The timer runs periodically at the configured - ``TimerWiPy.PERIODIC`` - The timer runs periodically at the configured
@ -70,7 +70,7 @@ Methods
object is returned (or ``None`` if there is no previous channel). object is returned (or ``None`` if there is no previous channel).
Otherwise, a TimerChannel object is initialized and returned. Otherwise, a TimerChannel object is initialized and returned.
The operating mode is is the one configured to the Timer object that was used to The operating mode is is the one configured to the Timer object that was used to
create the channel. create the channel.

Wyświetl plik

@ -19,7 +19,7 @@ Usage::
val = adc.read_core_vref() # read MCU VREF val = adc.read_core_vref() # read MCU VREF
val = adc.read_vref() # read MCU supply voltage val = adc.read_vref() # read MCU supply voltage
Constructors Constructors
------------ ------------

Wyświetl plik

@ -19,7 +19,7 @@ Constructors
.. class:: pyb.Accel() .. class:: pyb.Accel()
Create and return an accelerometer object. Create and return an accelerometer object.
Methods Methods
------- -------

Wyświetl plik

@ -92,7 +92,7 @@ Methods
Force a software restart of the CAN controller without resetting its Force a software restart of the CAN controller without resetting its
configuration. configuration.
If the controller enters the bus-off state then it will no longer participate If the controller enters the bus-off state then it will no longer participate
in bus activity. If the controller is not configured to automatically restart in bus activity. If the controller is not configured to automatically restart
(see :meth:`~CAN.init()`) then this method can be used to trigger a restart, (see :meth:`~CAN.init()`) then this method can be used to trigger a restart,

Wyświetl plik

@ -54,7 +54,7 @@ Constructors
.. class:: pyb.ExtInt(pin, mode, pull, callback) .. class:: pyb.ExtInt(pin, mode, pull, callback)
Create an ExtInt object: Create an ExtInt object:
- ``pin`` is the pin on which to enable the interrupt (can be a pin object or any valid pin name). - ``pin`` is the pin on which to enable the interrupt (can be a pin object or any valid pin name).
- ``mode`` can be one of: - ``mode`` can be one of:
- ``ExtInt.IRQ_RISING`` - trigger on a rising edge; - ``ExtInt.IRQ_RISING`` - trigger on a rising edge;

Wyświetl plik

@ -63,13 +63,13 @@ Methods
.. method:: LCD.fill(colour) .. method:: LCD.fill(colour)
Fill the screen with the given colour (0 or 1 for white or black). 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. 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. Get the pixel at the position ``(x, y)``. Returns 0 or 1.
This method reads from the visible buffer. This method reads from the visible buffer.
.. method:: LCD.light(value) .. method:: LCD.light(value)
@ -79,7 +79,7 @@ Methods
.. 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). 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. This method writes to the hidden buffer. Use ``show()`` to show the buffer.
.. method:: LCD.show() .. method:: LCD.show()
@ -89,7 +89,7 @@ Methods
.. 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). 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. This method writes to the hidden buffer. Use ``show()`` to show the buffer.
.. method:: LCD.write(str) .. method:: LCD.write(str)

Wyświetl plik

@ -13,7 +13,7 @@ Constructors
.. class:: pyb.LED(id) .. class:: pyb.LED(id)
Create an LED object associated with the given LED: Create an LED object associated with the given LED:
- ``id`` is the LED number, 1-4. - ``id`` is the LED number, 1-4.

Wyświetl plik

@ -28,13 +28,13 @@ Methods
.. method:: RTC.datetime([datetimetuple]) .. method:: RTC.datetime([datetimetuple])
Get or set the date and time of the RTC. Get or set the date and time of the RTC.
With no arguments, this method returns an 8-tuple with the current With no arguments, this method returns an 8-tuple with the current
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).
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)
``weekday`` is 1-7 for Monday through Sunday. ``weekday`` is 1-7 for Monday through Sunday.

Wyświetl plik

@ -112,7 +112,7 @@ Methods
.. method:: Timer.deinit() .. method:: Timer.deinit()
Deinitialises the timer. Deinitialises the timer.
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).
@ -191,7 +191,7 @@ Methods
- Read the encoder value using the timer.counter() method. - Read the encoder value using the timer.counter() method.
- Only works on CH1 and CH2 (and not on CH1N or CH2N) - Only works on CH1 and CH2 (and not on CH1N or CH2N)
- The channel number is ignored when setting the encoder mode. - The channel number is ignored when setting the encoder mode.
PWM Example:: PWM Example::
timer = pyb.Timer(2, freq=1000) timer = pyb.Timer(2, freq=1000)

Wyświetl plik

@ -24,11 +24,11 @@ Methods
.. method:: USB_HID.recv(data, \*, timeout=5000) .. method:: USB_HID.recv(data, \*, timeout=5000)
Receive data on the bus: Receive data on the bus:
- ``data`` can be an integer, which is the number of bytes to receive, - ``data`` can be an integer, which is the number of bytes to receive,
or a mutable buffer, which will be filled with received bytes. or a mutable buffer, which will be filled with received bytes.
- ``timeout`` is the timeout in milliseconds to wait for the receive. - ``timeout`` is the timeout in milliseconds to wait for the receive.
Return value: if ``data`` is an integer then a new buffer of the bytes received, 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. otherwise the number of bytes read into ``data`` is returned.

Wyświetl plik

@ -92,21 +92,21 @@ Methods
.. method:: USB_VCP.recv(data, \*, timeout=5000) .. method:: USB_VCP.recv(data, \*, timeout=5000)
Receive data on the bus: Receive data on the bus:
- ``data`` can be an integer, which is the number of bytes to receive, - ``data`` can be an integer, which is the number of bytes to receive,
or a mutable buffer, which will be filled with received bytes. or a mutable buffer, which will be filled with received bytes.
- ``timeout`` is the timeout in milliseconds to wait for the receive. - ``timeout`` is the timeout in milliseconds to wait for the receive.
Return value: if ``data`` is an integer then a new buffer of the bytes received, 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. 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: Send data over the USB VCP:
- ``data`` is the data to send (an integer to send, or a buffer object). - ``data`` is the data to send (an integer to send, or a buffer object).
- ``timeout`` is the timeout in milliseconds to wait for the send. - ``timeout`` is the timeout in milliseconds to wait for the send.
Return value: number of bytes sent. Return value: number of bytes sent.

Wyświetl plik

@ -20,7 +20,7 @@ Time related functions
.. function:: millis() .. function:: millis()
Returns the number of milliseconds since the board was last reset. Returns the number of milliseconds since the board was last reset.
The result is always a MicroPython smallint (31-bit signed number), so The result is always a MicroPython smallint (31-bit signed number), so
after 2^30 milliseconds (about 12.4 days) this will start to return after 2^30 milliseconds (about 12.4 days) this will start to return
negative numbers. negative numbers.
@ -32,7 +32,7 @@ Time related functions
.. function:: micros() .. function:: micros()
Returns the number of microseconds since the board was last reset. Returns the number of microseconds since the board was last reset.
The result is always a MicroPython smallint (31-bit signed number), so The result is always a MicroPython smallint (31-bit signed number), so
after 2^30 microseconds (about 17.8 minutes) this will start to return after 2^30 microseconds (about 17.8 minutes) this will start to return
negative numbers. negative numbers.
@ -44,10 +44,10 @@ Time related functions
.. function:: elapsed_millis(start) .. function:: elapsed_millis(start)
Returns the number of milliseconds which have elapsed since ``start``. Returns the number of milliseconds which have elapsed since ``start``.
This function takes care of counter wrap, and always returns a positive This function takes care of counter wrap, and always returns a positive
number. This means it can be used to measure periods up to about 12.4 days. number. This means it can be used to measure periods up to about 12.4 days.
Example:: Example::
start = pyb.millis() start = pyb.millis()
@ -57,10 +57,10 @@ Time related functions
.. function:: elapsed_micros(start) .. function:: elapsed_micros(start)
Returns the number of microseconds which have elapsed since ``start``. Returns the number of microseconds which have elapsed since ``start``.
This function takes care of counter wrap, and always returns a positive This function takes care of counter wrap, and always returns a positive
number. This means it can be used to measure periods up to about 17.8 minutes. number. This means it can be used to measure periods up to about 17.8 minutes.
Example:: Example::
start = pyb.micros() start = pyb.micros()

Wyświetl plik

@ -66,7 +66,7 @@ See :ref:`pyb.LED <pyb.LED>`. ::
led.toggle() led.toggle()
led.on() led.on()
led.off() led.off()
# LEDs 3 and 4 support PWM intensity (0-255) # LEDs 3 and 4 support PWM intensity (0-255)
LED(4).intensity() # get intensity LED(4).intensity() # get intensity
LED(4).intensity(128) # set intensity to half LED(4).intensity(128) # set intensity to half

Wyświetl plik

@ -60,7 +60,7 @@ on your pyboard (either on the flash or the SD card in the top-level directory).
or to convert any file you have with the command:: or to convert any file you have with the command::
avconv -i original.wav -ar 22050 -codec pcm_u8 test.wav avconv -i original.wav -ar 22050 -codec pcm_u8 test.wav
Then you can do:: Then you can do::
>>> import wave >>> import wave

Wyświetl plik

@ -27,10 +27,10 @@ For this tutorial, we will use the ``X1`` pin. Connect one end of the resistor t
Code Code
---- ----
By examining the :ref:`pyboard_quickref`, we see that ``X1`` is connected to channel 1 of timer 5 (``TIM5 CH1``). Therefore we will first create a ``Timer`` object for timer 5, then create a ``TimerChannel`` object for channel 1:: By examining the :ref:`pyboard_quickref`, we see that ``X1`` is connected to channel 1 of timer 5 (``TIM5 CH1``). Therefore we will first create a ``Timer`` object for timer 5, then create a ``TimerChannel`` object for channel 1::
from pyb import Timer from pyb import Timer
from time import sleep from time import sleep
# timer 5 will be created with a frequency of 100 Hz # timer 5 will be created with a frequency of 100 Hz
tim = pyb.Timer(5, freq=100) tim = pyb.Timer(5, freq=100)
tchannel = tim.channel(1, Timer.PWM, pin=pyb.Pin.board.X1, pulse_width=0) tchannel = tim.channel(1, Timer.PWM, pin=pyb.Pin.board.X1, pulse_width=0)
@ -47,16 +47,16 @@ To achieve the fading effect shown at the beginning of this tutorial, we want to
# how much to change the pulse-width by each step # how much to change the pulse-width by each step
wstep = 1500 wstep = 1500
cur_width = min_width cur_width = min_width
while True: while True:
tchannel.pulse_width(cur_width) tchannel.pulse_width(cur_width)
# this determines how often we change the pulse-width. It is # this determines how often we change the pulse-width. It is
# analogous to frames-per-second # analogous to frames-per-second
sleep(0.01) sleep(0.01)
cur_width += wstep cur_width += wstep
if cur_width > max_width: if cur_width > max_width:
cur_width = min_width cur_width = min_width
@ -67,11 +67,11 @@ If we want to have a breathing effect, where the LED fades from dim to bright th
while True: while True:
tchannel.pulse_width(cur_width) tchannel.pulse_width(cur_width)
sleep(0.01) sleep(0.01)
cur_width += wstep cur_width += wstep
if cur_width > max_width: if cur_width > max_width:
cur_width = max_width cur_width = max_width
wstep *= -1 wstep *= -1

Wyświetl plik

@ -17,7 +17,7 @@ This is all very well but we would like this process to be automated. Open the f
pyb.delay(1000) pyb.delay(1000)
When you save, the red light on the pyboard should turn on for about a second. To run the script, do a soft reset (CTRL-D). The pyboard will then restart and you should see a green light continuously flashing on and off. Success, the first step on your path to building an army of evil robots! When you are bored of the annoying flashing light then press CTRL-C at your terminal to stop it running. When you save, the red light on the pyboard should turn on for about a second. To run the script, do a soft reset (CTRL-D). The pyboard will then restart and you should see a green light continuously flashing on and off. Success, the first step on your path to building an army of evil robots! When you are bored of the annoying flashing light then press CTRL-C at your terminal to stop it running.
So what does this code do? First we need some terminology. Python is an object-oriented language, almost everything in python is a *class* and when you create an instance of a class you get an *object*. Classes have *methods* associated to them. A method (also called a member function) is used to interact with or control the object. So what does this code do? First we need some terminology. Python is an object-oriented language, almost everything in python is a *class* and when you create an instance of a class you get an *object*. Classes have *methods* associated to them. A method (also called a member function) is used to interact with or control the object.
The first line of code creates an LED object which we have then called led. When we create the object, it takes a single parameter which must be between 1 and 4, corresponding to the 4 LEDs on the board. The pyb.LED class has three important member functions that we will use: on(), off() and toggle(). The other function that we use is pyb.delay() this simply waits for a given time in milliseconds. Once we have created the LED object, the statement while True: creates an infinite loop which toggles the led between on and off and waits for 1 second. The first line of code creates an LED object which we have then called led. When we create the object, it takes a single parameter which must be between 1 and 4, corresponding to the 4 LEDs on the board. The pyb.LED class has three important member functions that we will use: on(), off() and toggle(). The other function that we use is pyb.delay() this simply waits for a given time in milliseconds. Once we have created the LED object, the statement while True: creates an infinite loop which toggles the led between on and off and waits for 1 second.

Wyświetl plik

@ -41,7 +41,7 @@ Mac OS X
Open a terminal and run:: Open a terminal and run::
screen /dev/tty.usbmodem* screen /dev/tty.usbmodem*
When you are finished and want to exit screen, type CTRL-A CTRL-\\. When you are finished and want to exit screen, type CTRL-A CTRL-\\.
Linux Linux
@ -50,7 +50,7 @@ Linux
Open a terminal and run:: Open a terminal and run::
screen /dev/ttyACM0 screen /dev/ttyACM0
You can also try ``picocom`` or ``minicom`` instead of screen. You may have to You can also try ``picocom`` or ``minicom`` instead of screen. You may have to
use ``/dev/ttyACM1`` or a higher number for ``ttyACM``. And, you may need to give use ``/dev/ttyACM1`` or a higher number for ``ttyACM``. And, you may need to give
yourself the correct permissions to access this devices (eg group ``uucp`` or ``dialout``, yourself the correct permissions to access this devices (eg group ``uucp`` or ``dialout``,

Wyświetl plik

@ -31,7 +31,7 @@ Arithmetic
* vsqrt(Sd, Sm) ``Sd = sqrt(Sm)`` * vsqrt(Sd, Sm) ``Sd = sqrt(Sm)``
Registers may be identical: ``vmul(S0, S0, S0)`` will execute ``S0 = S0*S0`` Registers may be identical: ``vmul(S0, S0, S0)`` will execute ``S0 = S0*S0``
Move between ARM core and FPU registers Move between ARM core and FPU registers
--------------------------------------- ---------------------------------------
@ -40,7 +40,7 @@ Move between ARM core and FPU registers
The FPU has a register known as FPSCR, similar to the ARM core's APSR, which stores condition The FPU has a register known as FPSCR, similar to the ARM core's APSR, which stores condition
codes plus other data. The following instructions provide access to this. codes plus other data. The following instructions provide access to this.
* vmrs(APSR\_nzcv, FPSCR) * vmrs(APSR\_nzcv, FPSCR)
Move the floating-point N, Z, C, and V flags to the APSR N, Z, C, and V flags. Move the floating-point N, Z, C, and V flags to the APSR N, Z, C, and V flags.

Wyświetl plik

@ -62,7 +62,7 @@ Timer ``id``'s take values from 0 to 3.::
tim = Timer(0, mode=Timer.PERIODIC) tim = Timer(0, mode=Timer.PERIODIC)
tim_a = tim.channel(Timer.A, freq=1000) tim_a = tim.channel(Timer.A, freq=1000)
tim_a.freq(5) # 5 Hz tim_a.freq(5) # 5 Hz
p_out = Pin('GP2', mode=Pin.OUT) p_out = Pin('GP2', mode=Pin.OUT)
tim_a.irq(trigger=Timer.TIMEOUT, handler=lambda t: p_out.toggle()) tim_a.irq(trigger=Timer.TIMEOUT, handler=lambda t: p_out.toggle())
@ -75,7 +75,7 @@ See :ref:`machine.Pin <machine.Pin>` and :ref:`machine.Timer <machine.Timer>`. :
# timer 1 in PWM mode and width must be 16 buts # timer 1 in PWM mode and width must be 16 buts
tim = Timer(1, mode=Timer.PWM, width=16) tim = Timer(1, mode=Timer.PWM, width=16)
# enable channel A @1KHz with a 50.55% duty cycle # enable channel A @1KHz with a 50.55% duty cycle
tim_a = tim.channel(Timer.A, freq=1000, duty_cycle=5055) tim_a = tim.channel(Timer.A, freq=1000, duty_cycle=5055)

Wyświetl plik

@ -51,7 +51,7 @@ Open a terminal and run::
or:: or::
$ screen /dev/tty.usbmodem* 115200 $ screen /dev/tty.usbmodem* 115200
When you are finished and want to exit ``screen``, type CTRL-A CTRL-\\. If your keyboard does not have a \\-key (i.e. you need an obscure combination for \\ like ALT-SHIFT-7) you can remap the ``quit`` command: When you are finished and want to exit ``screen``, type CTRL-A CTRL-\\. If your keyboard does not have a \\-key (i.e. you need an obscure combination for \\ like ALT-SHIFT-7) you can remap the ``quit`` command:
- create ``~/.screenrc`` - create ``~/.screenrc``