Skip to content

Commit

Permalink
Merge 321b9b7 into bfc4574
Browse files Browse the repository at this point in the history
  • Loading branch information
thijstriemstra committed Sep 20, 2020
2 parents bfc4574 + 321b9b7 commit c84e1b7
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 24 deletions.
11 changes: 11 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ single board computers:
* sprite animation,
* flexible framebuffering (depending on device capabilities)

Documentation
-------------

API documentation can be found at https://luma-core.readthedocs.io/en/latest/

Drivers
-------

Device drivers extend **luma.core** to provide the correct initialization
sequences for specific physical display devices/chipsets.

Expand All @@ -46,6 +54,9 @@ There are several drivers for different classes of device available:
* `luma.led_matrix <https://github.com/rm-hull/luma.led_matrix/>`_
* `luma.emulator <https://github.com/rm-hull/luma.emulator/>`_

Emulators
---------

There are emulators that run in real-time (with pygame) and others that can
take screenshots, or assemble animated GIFs, as per the examples below. Source
code for these are available in the `examples
Expand Down
8 changes: 3 additions & 5 deletions doc/index.rst
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
Luma.Core
luma.core
=========

.. image:: https://travis-ci.org/rm-hull/luma.core.svg?branch=master
:target: https://travis-ci.org/rm-hull/luma.core

.. image:: https://coveralls.io/repos/github/rm-hull/luma.core/badge.svg?branch=master
:target: https://coveralls.io/github/rm-hull/luma.core?branch=master

.. image:: https://requires.io/github/rm-hull/luma.core/requirements.svg?branch=master
:target: https://requires.io/github/rm-hull/luma.core/requirements/?branch=master

.. image:: https://img.shields.io/maintenance/yes/2019.svg?maxAge=2592000
.. image:: https://img.shields.io/maintenance/yes/2020.svg?maxAge=2592000

.. image:: https://img.shields.io/pypi/pyversions/luma.core.svg
:target: https://pypi.python.org/pypi/luma.core
Expand Down
8 changes: 4 additions & 4 deletions luma/core/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ class parallel_device(device):
Wrapper class to manage communications with devices that can operate in
four or eight bit modes.
..note:
.. note::
parallel_devices require specific timings which are managed by using
time.sleep to cause the process to block for small amounts of time. If
your application is especially time sensitive, consider running the
``time.sleep`` to cause the process to block for small amounts of time.
If your application is especially time sensitive, consider running the
drivers in a separate thread.
.. versionadded:: 1.16.0
Expand All @@ -126,7 +126,7 @@ def command(self, *cmd, exec_time=None, only_low_bits=False):
:param exec_time: Amount of time to wait for the command to finish
execution. If not provided, the device default will be used instead
:type exec_time: float
:param only_low_bits: If true, only the lowest four bits of the command
:param only_low_bits: If ``True``, only the lowest four bits of the command
will be sent. This is necessary on some devices during initialization
:type only_low_bits: bool
"""
Expand Down
6 changes: 3 additions & 3 deletions luma/core/interface/parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class bitbang_6800(object):
"""
Implements a 6800 style parallel-bus interface that provides :py:func:`data`
and :py:func:`command` methods. The default pin assignments provided are
from `Adafruit <https://learn.adafruit.com/drive-a-16x2-lcd-directly-with-a-raspberry-pi/wiring>`.
from `Adafruit <https://learn.adafruit.com/drive-a-16x2-lcd-directly-with-a-raspberry-pi/wiring>`_.
:param gpio: GPIO interface (must be compatible with
`RPi.GPIO <https://pypi.python.org/pypi/RPi.GPIO>`_)
Expand Down Expand Up @@ -75,7 +75,7 @@ def command(self, *cmd):
This means that the device needs to send high and low bits separately
if the device is operating using a 4 bit bus (e.g. to send a 0x32 in
4 bit mode the device would use command(0x03, 0x02))
4 bit mode the device would use ``command(0x03, 0x02)``).
:param cmd: A spread of commands.
:type cmd: int
Expand All @@ -90,7 +90,7 @@ def data(self, data):
This means that the device needs to send high and low bits separately
if the device is operating using a 4 bit bus (e.g. to send a 0x32 in
4 bit mode the device would use data([0x03, 0x02]))
4 bit mode the device would use ``data([0x03, 0x02])``).
:param data: A data sequence.
:type data: list, bytearray
Expand Down
26 changes: 14 additions & 12 deletions luma/core/interface/serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ def ftdi_i2c(device='ftdi://::/1', address=0x3C):

class pcf8574(i2c):
"""
Wraps i2c interface to provide :py:func:`data` and :py:func:`command` methods
I²C interface to provide :py:func:`data` and :py:func:`command` methods
for a device using a pcf8574 backpack.
:param bus: A *smbus* implementation, if ``None`` is supplied (default),
Expand All @@ -525,7 +525,7 @@ class pcf8574(i2c):
:param BACKLIGHT: value aligned with backlight pin (default: 3)
:type BACKLIGHT: int
:param COMMAND: determines whether RS high sets device to expect a command
byte or a data byte. Must be either 'high' (default) or 'low'
byte or a data byte. Must be either ``high`` (default) or ``low``
:type COMMAND: str
:raises luma.core.error.DeviceAddressError: I2C device address is invalid.
Expand All @@ -538,7 +538,7 @@ class pcf8574(i2c):
if both are, then ``bus`` takes precedence.
2. If ``bus`` is provided, there is an implicit expectation
that it has already been opened.
3. Default wiring is...
3. Default wiring:
* RS - Register Select
* E - Enable
Expand Down Expand Up @@ -572,14 +572,14 @@ class pcf8574(i2c):
connected to P7, and the RS value to indicate command is low, your
initialization would look something like:
``pcf8574(port=1, address=0x27, PINS=[0,1,2,3], RS=4, E=5,
``pcf8574(port=1, address=0x27, PINS=[0, 1, 2, 3], RS=4, E=5,
COMMAND='low', BACKLIGHT=7)``
Explanation:
PINS are set to [0, 1, 2, 3] which assigns P0 to D4, P1 to D5, P2 to D6,
PINS are set to ``[0, 1, 2, 3]`` which assigns P0 to D4, P1 to D5, P2 to D6,
and P3 to D7. RS is set to 4 to associate with P4. Similarly E is set
to 5 to associate E with P5. BACKLIGHT set to 7 connects it to pin P7
of the backpack. COMMAND is set to 'low' so that RS will be set to low
of the backpack. COMMAND is set to ``low`` so that RS will be set to low
when a command is sent and high when data is sent.
.. versionadded:: 1.15.0
Expand Down Expand Up @@ -627,9 +627,10 @@ def command(self, *cmd):
sending 0b10000000 (0x80). This is 0b1000 (0x08) at the high side of
the byte and 0b0000 (0x00) on the low side of the byte.
To send this using the pcf8574 interface you need to send...
d = pcf8574(bus=1, address=0x27)
d.command([0x08, 0x00])
For example, to send this using the pcf8574 interface::
d = pcf8574(bus=1, address=0x27)
d.command([0x08, 0x00])
"""
self._write(list(cmd), self._cmd_mode)

Expand All @@ -649,9 +650,10 @@ def data(self, data):
01000001. This is 0100 (0x40) at the high side of the byte
and 0001 (0x01) on the low side of the byte.
To send this using the pcf8574 interface you need to send...
d = pcf8574(bus=1, address=0x27)
d.command([0x04, 0x01])
For example, to send this using the pcf8574 interface::
d = pcf8574(bus=1, address=0x27)
d.command([0x04, 0x01])
"""
self._write(data, self._data_mode)

Expand Down

0 comments on commit c84e1b7

Please sign in to comment.