Commit 7d7243f4 authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

docs/machine.*: Use proper class case in method headers.

Class designator will be used as is in indexes, so must match actual class
name.
parent 93968bd6
......@@ -32,7 +32,7 @@ Constructors
Methods
-------
.. method:: adc.channel(id, \*, pin)
.. method:: ADC.channel(id, \*, pin)
Create an analog pin. If only channel ID is given, the correct pin will
be selected. Alternatively, only the pin can be passed and the correct
......@@ -43,11 +43,11 @@ Methods
apin = adc.channel(pin='GP3')
apin = adc.channel(id=1, pin='GP3')
.. method:: adc.init()
.. method:: ADC.init()
Enable the ADC block.
.. method:: adc.deinit()
.. method:: ADC.deinit()
Disable the ADC block.
......
......@@ -62,7 +62,7 @@ General Methods
.. only:: port_wipy
.. method:: i2c.init(mode, \*, baudrate=100000, pins=(SDA, SCL))
.. method:: I2C.init(mode, \*, baudrate=100000, pins=(SDA, SCL))
Initialise the I2C bus with the given parameters:
......@@ -72,7 +72,7 @@ General Methods
.. only:: port_esp8266
.. method:: i2c.init(scl, sda, \*, freq=400000)
.. method:: I2C.init(scl, sda, \*, freq=400000)
Initialise the I2C bus with the given arguments:
......@@ -80,13 +80,13 @@ General Methods
- `sda` is a pin object for the SDA line
- `freq` is the SCL clock rate
.. method:: i2c.deinit()
.. method:: I2C.deinit()
Turn off the I2C bus.
Availability: WiPy.
.. method:: i2c.scan()
.. method:: I2C.scan()
Scan all I2C addresses between 0x08 and 0x77 inclusive and return a list of
those that respond. A device responds if it pulls the SDA line low after
......@@ -101,19 +101,19 @@ The following methods implement the primitive I2C master bus operations and can
be combined to make any I2C transaction. They are provided if you need more
control over the bus, otherwise the standard methods (see below) can be used.
.. method:: i2c.start()
.. method:: I2C.start()
Send a start bit on the bus (SDA transitions to low while SCL is high).
Availability: ESP8266.
.. method:: i2c.stop()
.. method:: I2C.stop()
Send a stop bit on the bus (SDA transitions to high while SCL is high).
Availability: ESP8266.
.. method:: i2c.readinto(buf)
.. method:: I2C.readinto(buf)
Reads bytes from the bus and stores them into `buf`. The number of bytes
read is the length of `buf`. An ACK will be sent on the bus after
......@@ -122,7 +122,7 @@ control over the bus, otherwise the standard methods (see below) can be used.
Availability: ESP8266.
.. method:: i2c.write(buf)
.. method:: I2C.write(buf)
Write all the bytes from `buf` to the bus. Checks that an ACK is received
after each byte and raises an OSError if not.
......@@ -135,12 +135,12 @@ Standard bus operations
The following methods implement the standard I2C master read and write
operations that target a given slave device.
.. method:: i2c.readfrom(addr, nbytes)
.. method:: I2C.readfrom(addr, nbytes)
Read `nbytes` from the slave specified by `addr`.
Returns a `bytes` object with the data read.
.. method:: i2c.readfrom_into(addr, buf)
.. method:: I2C.readfrom_into(addr, buf)
Read into `buf` from the slave specified by `addr`.
The number of bytes read will be the length of `buf`.
......@@ -148,7 +148,7 @@ operations that target a given slave device.
On WiPy the return value is the number of bytes read. Otherwise the
return value is `None`.
.. method:: i2c.writeto(addr, buf, \*, stop=True)
.. method:: I2C.writeto(addr, buf, \*, stop=True)
Write the bytes from `buf` to the slave specified by `addr`.
......@@ -167,7 +167,7 @@ from and written to. In this case there are two addresses associated with an
I2C transaction: the slave address and the memory address. The following
methods are convenience functions to communicate with such devices.
.. method:: i2c.readfrom_mem(addr, memaddr, nbytes, \*, addrsize=8)
.. method:: I2C.readfrom_mem(addr, memaddr, nbytes, \*, addrsize=8)
Read `nbytes` from the slave specified by `addr` starting from the memory
address specified by `memaddr`.
......@@ -175,7 +175,7 @@ methods are convenience functions to communicate with such devices.
this argument is not recognised and the address size is always 8 bits).
Returns a `bytes` object with the data read.
.. method:: i2c.readfrom_mem_into(addr, memaddr, buf, \*, addrsize=8)
.. method:: I2C.readfrom_mem_into(addr, memaddr, buf, \*, addrsize=8)
Read into `buf` from the slave specified by `addr` starting from the
memory address specified by `memaddr`. The number of bytes read is the
......@@ -186,7 +186,7 @@ methods are convenience functions to communicate with such devices.
On WiPy the return value is the number of bytes read. Otherwise the
return value is `None`.
.. method:: i2c.writeto_mem(addr, memaddr, buf, \*, addrsize=8)
.. method:: I2C.writeto_mem(addr, memaddr, buf, \*, addrsize=8)
Write `buf` to the slave specified by `addr` starting from the
memory address specified by `memaddr`.
......
......@@ -61,14 +61,14 @@ Constructors
.. class:: machine.Pin(id, ...)
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`.
Methods
-------
.. only:: port_wipy
.. method:: pin.init(mode, pull, \*, drive, alt)
.. method:: Pin.init(mode, pull, \*, drive, alt)
Initialise the pin:
......@@ -98,13 +98,13 @@ Methods
Returns: ``None``.
.. method:: pin.id()
.. method:: Pin.id()
Get the pin id.
.. only:: port_esp8266
.. method:: pin.init(mode, pull=None, \*, value)
.. method:: Pin.init(mode, pull=None, \*, value)
Initialise the pin:
......@@ -121,7 +121,7 @@ Methods
- if `value` is given then it is the output value to set the pin
if it is in output mode.
.. method:: pin.value([value])
.. method:: Pin.value([value])
Get or set the digital logic level of the pin:
......@@ -133,9 +133,9 @@ Methods
.. method:: pin([value])
Pin objects are callable. The call method provides a (fast) shortcut to set and get the value of the pin.
See :func:`pin.value` for more details.
See :func:`Pin.value` for more details.
.. method:: pin.alt_list()
.. method:: Pin.alt_list()
Returns a list of the alternate functions supported by the pin. List items are
a tuple of the form: ``('ALT_FUN_NAME', ALT_FUN_INDEX)``
......@@ -144,23 +144,23 @@ Methods
.. only:: port_wipy
.. method:: pin.toggle()
.. method:: Pin.toggle()
Toggle the value of the pin.
.. method:: pin.mode([mode])
.. method:: Pin.mode([mode])
Get or set the pin mode.
.. method:: pin.pull([pull])
.. method:: Pin.pull([pull])
Get or set the pin pull.
.. method:: pin.drive([drive])
.. method:: Pin.drive([drive])
Get or set the pin drive strength.
.. method:: pin.irq(\*, trigger, priority=1, handler=None, wake=None)
.. method:: Pin.irq(\*, trigger, priority=1, handler=None, wake=None)
Create a callback to be triggered when the input level at the pin changes.
......@@ -194,7 +194,7 @@ Methods
.. only:: port_esp8266
.. method:: pin.irq(\*, trigger, handler=None)
.. method:: Pin.irq(\*, trigger, handler=None)
Create a callback to be triggered when the input level at the pin changes.
......
......@@ -24,35 +24,35 @@ Constructors
Methods
-------
.. method:: rtc.init(datetime)
.. method:: RTC.init(datetime)
Initialise the RTC. Datetime is a tuple of the form:
``(year, month, day[, hour[, minute[, second[, microsecond[, tzinfo]]]]])``
.. method:: rtc.now()
.. method:: RTC.now()
Get get the current datetime tuple.
.. method:: rtc.deinit()
.. method:: RTC.deinit()
Resets the RTC to the time of January 1, 2015 and starts running it again.
.. method:: rtc.alarm(id, time, /*, repeat=False)
.. method:: RTC.alarm(id, time, /*, repeat=False)
Set the RTC alarm. Time might be either a milllisecond value to program the alarm to
current time + time_in_ms in the future, or a datetimetuple. If the time passed is in
milliseconds, repeat can be set to ``True`` to make the alarm periodic.
.. method:: rtc.alarm_left(alarm_id=0)
.. method:: RTC.alarm_left(alarm_id=0)
Get the number of milliseconds left before the alarm expires.
.. method:: rtc.cancel(alarm_id=0)
.. method:: RTC.cancel(alarm_id=0)
Cancel a running alarm.
.. method:: rtc.irq(\*, trigger, handler=None, wake=machine.IDLE)
.. method:: RTC.irq(\*, trigger, handler=None, wake=machine.IDLE)
Create an irq object triggered by a real time clock alarm.
......
......@@ -32,11 +32,11 @@ Constructors
Methods
-------
.. method:: sd.init(id=0, 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)``.
.. method:: sd.deinit()
.. method:: SD.deinit()
Disable the SD card.
......@@ -35,7 +35,7 @@ Constructors
Methods
-------
.. method:: spi.init(mode, baudrate=1000000, \*, polarity=0, phase=0, bits=8, firstbit=SPI.MSB, pins=(CLK, MOSI, MISO))
.. method:: SPI.init(mode, baudrate=1000000, \*, polarity=0, phase=0, bits=8, firstbit=SPI.MSB, pins=(CLK, MOSI, MISO))
Initialise the SPI bus with the given parameters:
......@@ -48,27 +48,27 @@ Methods
- ``firstbit`` can be ``SPI.MSB`` only.
- ``pins`` is an optional tupple with the pins to assign to the SPI bus.
.. method:: spi.deinit()
.. method:: SPI.deinit()
Turn off the SPI bus.
.. method:: spi.write(buf)
.. method:: SPI.write(buf)
Write the data contained in ``buf``.
Returns the number of bytes written.
.. method:: spi.read(nbytes, *, write=0x00)
.. method:: SPI.read(nbytes, *, write=0x00)
Read the ``nbytes`` while writing the data specified by ``write``.
Return the number of bytes read.
.. method:: spi.readinto(buf, *, write=0x00)
.. method:: SPI.readinto(buf, *, write=0x00)
Read into the buffer specified by ``buf`` while writing the data specified by
``write``.
Return the number of bytes read.
.. method:: spi.write_readinto(write_buf, read_buf)
.. method:: SPI.write_readinto(write_buf, read_buf)
Write from ``write_buf`` and read into ``read_buf``. Both buffers must have the
same length.
......
......@@ -72,7 +72,7 @@ Methods
.. only:: port_wipy
.. method:: timer.init(mode, \*, width=16)
.. method:: Timer.init(mode, \*, width=16)
Initialise the timer. Example::
......@@ -93,14 +93,14 @@ Methods
(or large periods), 32-bit timers should be used. 32-bit mode is only available
for ``ONE_SHOT`` AND ``PERIODIC`` modes.
.. method:: timer.deinit()
.. method:: Timer.deinit()
Deinitialises the timer. Disables all channels and associated IRQs.
Stops the timer, and disables the timer peripheral.
.. only:: port_wipy
.. method:: timer.channel(channel, \**, freq, period, polarity=Timer.POSITIVE, duty_cycle=0)
.. method:: Timer.channel(channel, \**, freq, period, polarity=Timer.POSITIVE, duty_cycle=0)
If only a channel identifier passed, then a previously initialized channel
object is returned (or ``None`` if there is no previous channel).
......
......@@ -70,7 +70,7 @@ Methods
.. only:: port_wipy
.. method:: uart.init(baudrate=9600, bits=8, parity=None, stop=1, \*, pins=(TX, RX, RTS, CTS))
.. method:: UART.init(baudrate=9600, bits=8, parity=None, stop=1, \*, pins=(TX, RX, RTS, CTS))
Initialise the UART bus with the given parameters:
......@@ -86,28 +86,28 @@ Methods
.. only:: not port_esp8266
.. method:: uart.deinit()
.. method:: UART.deinit()
Turn off the UART bus.
.. method:: uart.any()
.. method:: UART.any()
Return the number of characters available for reading.
.. method:: uart.read([nbytes])
.. method:: UART.read([nbytes])
Read characters. If ``nbytes`` is specified then read at most that many bytes.
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.
Return value: a bytes object or ``None`` 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.
......@@ -115,13 +115,13 @@ 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.
Return value: the line read or ``None`` on timeout.
.. method:: uart.write(buf)
.. method:: UART.write(buf)
Write the buffer of bytes to the bus.
......@@ -129,7 +129,7 @@ Methods
.. only:: not port_esp8266
.. method:: uart.sendbreak()
.. method:: UART.sendbreak()
Send a break condition on the bus. This drives the bus low for a duration
of 13 bits.
......@@ -137,7 +137,7 @@ Methods
.. only:: port_wipy
.. method:: uart.irq(trigger, priority=1, handler=None, wake=machine.IDLE)
.. method:: UART.irq(trigger, priority=1, handler=None, wake=machine.IDLE)
Create a callback to be triggered when data is received on the UART.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment