Skip to content

Added examples to project #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions .hgignore

This file was deleted.

7 changes: 4 additions & 3 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ spelling-store-unknown-words=no
[MISCELLANEOUS]

# List of note tags to take in consideration, separated by a comma.
notes=FIXME,XXX,TODO
# notes=FIXME,XXX,TODO
notes=FIXME,XXX


[TYPECHECK]
Expand Down Expand Up @@ -300,7 +301,7 @@ function-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$

# Good variable names which should always be accepted, separated by a comma
# good-names=i,j,k,ex,Run,_
good-names=r,g,b,i,j,k,n,ex,Run,_
good-names=r,g,b,w,i,j,k,n,x,y,z,ex,ok,Run,_

# Include a hint for the correct naming format with invalid-name
include-naming-hint=no
Expand Down Expand Up @@ -422,7 +423,7 @@ max-returns=6
max-statements=50

# Minimum number of public methods for a class (see R0903).
min-public-methods=2
min-public-methods=1


[EXCEPTIONS]
Expand Down
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ deploy:
file_glob: true
file: bundles/*
skip_cleanup: true
overwrite: true
on:
tags: true

Expand All @@ -26,5 +27,5 @@ install:

script:
- pylint adafruit_max7219/*.py
- ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name examples/*.py)
- ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name,bad-whitespace examples/*.py)
- circuitpython-build-bundles --filename_prefix adafruit-circuitpython-max7219 --library_location .
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2016 Radomir Dopieralski
Copyright (c) 2017 Radomir Dopieralski, Michael McWethy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
37 changes: 28 additions & 9 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ Introduction
:target: https://circuitpython.readthedocs.io/projects/max7219/en/latest/
:alt: Documentation Status

.. image :: https://badges.gitter.im/adafruit/circuitpython.svg
:target: https://gitter.im/adafruit/circuitpython?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge
:alt: Gitter

.. image :: https://img.shields.io/discord/327254708534116352.svg
:target: https://adafru.it/discord
:alt: Discord
Expand Down Expand Up @@ -91,6 +87,13 @@ adafruit_max7219.BCDDigits Example
display.show_str(0,'{:9.2f}'.format(-1234.56))
display.show()

API Reference
=============

.. toctree::
:maxdepth: 2

api

Contributing
============
Expand All @@ -99,10 +102,26 @@ Contributions are welcome! Please read our `Code of Conduct
<https://github.com/adafruit/Adafruit_CircuitPython_max7219/blob/master/CODE_OF_CONDUCT.md>`_
before contributing to help this project stay welcoming.

API Reference
=============
Building locally
================

.. toctree::
:maxdepth: 2
To build this library locally you'll need to install the
`circuitpython-build-tools <https://github.com/adafruit/circuitpython-build-tools>`_ package.

api
.. code-block:: shell

python3 -m venv .env
source .env/bin/activate
pip install circuitpython-build-tools

Once installed, make sure you are in the virtual environment:

.. code-block:: shell

source .env/bin/activate

Then run the build:

.. code-block:: shell

circuitpython-build-bundles --filename_prefix adafruit-circuitpython-max7219 --library_location .
101 changes: 5 additions & 96 deletions api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,104 +3,13 @@ Module classes
==============

Matrices
********
++++++++

.. module:: adafruit_max7219.matrices

.. class:: Matrix8x8(spi, cs)

Driver for a single MAX7219-based 8x8 LED matrix.

:param object spi: an spi busio or spi bitbangio object
:param ~digitalio.DigitalInOut cs: digital in/out to use as chip select signal

.. method:: brightness(value)

control the brightness of the display

:param int value: 0->15 dimmest to brightest

.. method:: fill(color)

Fill the whole matrix with a specified color.

:param int color: None or False or 0 turn LED off, anything else turns LED on

.. method:: pixel(x, y, color=None)

Set the color of a single pixel.

:param int x: x postiion of LED in matrix
:param int y: y position of LED in matrix
:param int color: value > zero lights the decimal point, else unlights the point

.. method:: text(x, y, str)

Position and set text on display; used for text scrolling

:param int x: x postiion of LED in matrix
:param int y: y position of LED in matrix
:param string str: string to place in to display

.. method:: clear_all()

sets all leds to off; same as fill(0)

.. method:: show()

Update the display.

:members:

BCDDigits
*********

.. module:: adafruit_max7219.bcddigits

.. class:: BCDDigits(spi, cs, nDigits=1)

Driver for one to 8 MAX7219-based 7-Segment LED display.

:param object spi: an spi busio or spi bitbangio object
:param ~digitalio.DigitalInOut cs: digital in/out to use as chip select signal
:param int nDigits: number of led 7-segment digits; default 1; max 8

.. method:: set_digit(d, v)

set one digit in the display

:param int d: the digit position; zero-based
:param int v: integer ranging from 0->15

.. method:: show_dot(d, col=None)

set the decimal point for a digit

:param int d: the digit to set the decimal point zero-based
:param int col: value > zero lights the decimal point, else unlights the point

.. method:: show_str(s,str)

displays a numeric str in the display. shows digits 0-9, -, and .

:param int s: start position to show the numeric string
:param string str: the numeric string

.. method:: show_help(s)

display the word HELP in the display

:param int s: start position to show HELP

.. method:: brightness(value)

control the brightness of the display

:param int value: 0->15 dimmest to brightest

.. method:: clear_all()

sets all leds to off

.. method:: show()
+++++++++

Update the display.
.. module:: adafruit_max7219.bcddigits.py
:members
5 changes: 5 additions & 0 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
'sphinx.ext.viewcode',
]

# Uncomment the below if you use native CircuitPython modules such as
# digitalio, micropython and busio. List the modules you use. Without it, the
# autodoc module docs will fail to generate with a warning.
# autodoc_mock_imports = ["digitalio", "busio"]

intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None),'CircuitPython': ('https://circuitpython.readthedocs.io/en/latest/', None)}

# Add any paths that contain templates here, relative to this directory.
Expand Down
Loading