pull/784/head
Jesse Vincent 5 years ago
parent 20a012eb53
commit 4189c2fb22
No known key found for this signature in database
GPG Key ID: CC228463465E40BC

1
.gitignore vendored

@ -3,3 +3,4 @@
/output/
/examples/*/output/
/out/
/docs/generated

@ -0,0 +1,87 @@
"""Crude Sphinx extension for examples documentation.
© 2019 Paul Natsuo Kishimoto <mail@paul.kishimoto.name>
Licensed under the GNU GPLv3: https://www.gnu.org/licenses/gpl-3.0.html
Star: https://gist.github.com/khaeru/3185679f4dd83b16a0648f6036fb000e
Enable by adding to conf.py::
sys.path.append('path/to/this/file')
extensions.append('examples')
# Root path for examples documentation, relative to conf.py.
# If your source code is laid out like:
#
# - BASE/
# - doc/
# - source/
# - conf.py
# - my_module/
# - __init__.py
# - doc.rst
#
# …then examples_source should be like:
examples_source = '../../my_module'
# Destination path for copied files, relative to conf.py.
# For instance, the following:
examples_dest = 'generated'
# …results in files being copied to 'BASE/doc/source/generated'
find_examples_docs() performs two replacements:
1. A file like my_module/submodule/doc.rst is copied to
my_module/submodule.rst.
2. A file like my_module/submodule/doc/index.rst is copied to
my_module/submodule.rst
All other paths are not modified.
'Crude' means:
- Old files in the examples_dest directory are not removed automatically.
- It's not tested; bad config values will cause strange behaviour.
"""
import glob
import os
from os import PathLike
from pathlib import Path
from shutil import copy2, copytree, rmtree
from sphinx.util import status_iterator
def find_examples_docs(src_dir, target_dir):
"""Yield tuples of (source, dest) filenames.
The first element in each tuple is the path to a file in *src_dir* that
matches '**/{match}'. The second is the same path, below *target_dir*,
modified as described above.
"""
for source in glob.glob(os.path.join(src_dir,'**'), recursive=True):
print(source)
if not os.path.isdir(source):
dest = source
print(dest)
yield source, target_dir / dest
def config_inited(app, config):
# Handle configuration settings
source_path = Path(app.srcdir, app.config.examples_source).resolve()
dest_path = Path(app.srcdir, app.config.examples_dest).resolve()
print (dest_path)
def docname(item):
"""Helper for status_iterator()."""
return str(Path(item[0]).relative_to(source_path).parent)
rmtree(dest_path)
copytree(source_path, dest_path)
def setup(app):
app.add_config_value('examples_source', None, 'env', (PathLike, str))
app.add_config_value('examples_dest', None, 'env', (PathLike, str))
app.connect('config-inited', config_inited)

@ -0,0 +1,102 @@
"""Crude Sphinx extension for inline documentation.
© 2019 Paul Natsuo Kishimoto <mail@paul.kishimoto.name>
Licensed under the GNU GPLv3: https://www.gnu.org/licenses/gpl-3.0.html
Star: https://gist.github.com/khaeru/3185679f4dd83b16a0648f6036fb000e
Enable by adding to conf.py::
sys.path.append('path/to/this/file')
extensions.append('inline')
# Root path for inline documentation, relative to conf.py.
# If your source code is laid out like:
#
# - BASE/
# - doc/
# - source/
# - conf.py
# - my_module/
# - __init__.py
# - doc.rst
#
# …then inline_source should be like:
inline_source = '../../my_module'
# Destination path for copied files, relative to conf.py.
# For instance, the following:
inline_dest = 'generated'
# …results in files being copied to 'BASE/doc/source/generated'
find_inline_docs() performs two replacements:
1. A file like my_module/submodule/doc.rst is copied to
my_module/submodule.rst.
2. A file like my_module/submodule/doc/index.rst is copied to
my_module/submodule.rst
All other paths are not modified.
'Crude' means:
- Old files in the inline_dest directory are not removed automatically.
- It's not tested; bad config values will cause strange behaviour.
"""
from os import PathLike
from pathlib import Path
from shutil import copy2
from sphinx.util import status_iterator
def find_inline_docs(src_dir, target_dir, match='*.rst'):
"""Yield tuples of (source, dest) filenames.
The first element in each tuple is the path to a file in *src_dir* that
matches '**/{match}'. The second is the same path, below *target_dir*,
modified as described above.
"""
for source in src_dir.glob('**/' + match):
base = source.relative_to(src_dir)
# Perform modifications. Delete these if you like.
if base.parent.stem == 'doc' and base.stem == 'index':
dest = base.parents[1]
elif base.stem == 'doc':
dest = base.parent
else:
pass # No change
yield source, target_dir / dest.with_suffix(source.suffix)
def config_inited(app, config):
# Handle configuration settings
source_path = Path(app.srcdir, app.config.inline_source).resolve()
dest_path = Path(app.srcdir, app.config.inline_dest).resolve()
def docname(item):
"""Helper for status_iterator()."""
return str(Path(item[0]).relative_to(source_path).parent)
# Iterator over inline documentation source files and targets
docs = find_inline_docs(source_path, dest_path)
# Wrap iterator for logging
it = status_iterator(docs, 'Copying inline files... ',
color='purple', stringify_func=docname)
for source, dest in it:
# Make any parent directory(ies) of dest
dest.parent.mkdir(parents=True, exist_ok=True)
# Copy the file
copy2(source, dest)
def setup(app):
app.add_config_value('inline_source', None, 'env', (PathLike, str))
app.add_config_value('inline_dest', None, 'env', (PathLike, str))
app.connect('config-inited', config_inited)

@ -0,0 +1,46 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at jesse@keyboard.io. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/

@ -11,8 +11,10 @@
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
import sys
sys.path.insert(0, os.path.abspath('..'))
sys.path.append('_sphinx')
# -- Project information -----------------------------------------------------
@ -34,6 +36,12 @@ extensions = [
]
extensions.append('copy-examples')
examples_source = '../examples'
examples_dest = 'examples'
# Setup the breathe extension
breathe_projects = {
"Kaleidoscope": "./doxyoutput/xml"
@ -76,7 +84,7 @@ templates_path = ['_templates']
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'etc']
exclude_patterns = ['_build', '_sphinx', 'Thumbs.db', '.DS_Store', 'etc', 'requirements.txt']
# -- Options for HTML output -------------------------------------------------

@ -0,0 +1,13 @@
.. Kaleidoscope documentation master file, created by
sphinx-quickstart on Fri Jan 3 13:52:38 2020.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
All example sketches
====================
.. toctree::
:maxdepth: 2
:glob:
examples/**/*.ino

@ -3,16 +3,23 @@
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to Kaleidoscope's documentation!
========================================
Kaleidoscope
============
.. toctree::
:maxdepth: 2
about
api/library_root
Flexible firmware for computer keyboards.
:caption: Contents:
This package contains the "core" of Kaleidoscope and a number of [example firmware "Sketches"](https://github.com/keyboardio/Kaleidoscope/tree/master/examples).
If you're just getting started with the Keyboardio Model 01, the [introductory docs are here](https://github.com/keyboardio/Kaleidoscope/wiki/Keyboardio-Model-01-Introduction) and the source for the basic firmware package is here: https://github.com/keyboardio/Model01-Firmware. It's probably a good idea to start there, learn how to modify your keymap and maybe turn some modules on or off, and then come back to the full repository when you have more complex changes in mind.
Installation and setup
======================
.. toctree::
:maxdepth: 2
quick_start
For users
@ -52,7 +59,7 @@ API Design docs
---------------
.. toctree::
maxdepth: 1
:maxdepth: 1
:glob:
api-reference/*
@ -77,9 +84,39 @@ Upgrading from old versions
UPGRADING.md
For Everybody
=============
.. toctree::
:maxdepth: 0
code_of_conduct.md
WIP
===
.. toctree::
:maxdepth: 2
examples
about
api/library_root
:caption: Contents:
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
Links
=====
`Source code on GitHub <https://github.com/keyboardio/kaleidoscope>`_

@ -0,0 +1,50 @@
# Getting Started
## Setup the Arduino IDE
Setup the Arduino IDE on your system. Make sure you install at least version 1.8.6, since older version may not support all required features.
* On Linux, follow the instructions [on the wiki](https://github.com/keyboardio/Kaleidoscope/wiki/Install-Arduino-support-on-Linux).
* On macOS, install using [homebrew](http://brew.sh/) [cask](https://caskroom.github.io/) with `brew cask install arduino` or download the application from [the official website](https://www.arduino.cc/en/Main/Software) and move it to your `/Applications` folder.
## Get into the right directory
### macOS
```sh
mkdir -p $HOME/Documents/Arduino/hardware
cd $HOME/Documents/Arduino/hardware
```
### Linux
```sh
mkdir -p $HOME/Arduino/hardware
cd $HOME/Arduino/hardware
```
### Windows
*TODO*: Write me
### Install the libraries and hardware definitions
## Clone the hardware definitions
```sh
git clone --recursive https://github.com/keyboardio/Kaleidoscope-Bundle-Keyboardio.git keyboardio
```
## Build the Kaleidoscope Firmware for your keyboard
(This part assumes you're building firmware for the Keyboardio Model 01)
```sh
# Go to your device firmware directory
cd keyboardio/avr/libraries/Model01-Firmware
# Build your firmware!
make
# Install your firmware
make flash
Loading…
Cancel
Save