/ README.rst
README.rst
  1  Introduction
  2  ============
  3  
  4  
  5  .. image:: https://readthedocs.org/projects/adafruit-circuitpython-ticks/badge/?version=latest
  6      :target: https://docs.circuitpython.org/projects/ticks/en/latest/
  7      :alt: Documentation Status
  8  
  9  
 10  .. image:: https://raw.githubusercontent.com/adafruit/Adafruit_CircuitPython_Bundle/main/badges/adafruit_discord.svg
 11      :target: https://adafru.it/discord
 12      :alt: Discord
 13  
 14  
 15  .. image:: https://github.com/adafruit/Adafruit_CircuitPython_ticks/workflows/Build%20CI/badge.svg
 16      :target: https://github.com/adafruit/Adafruit_CircuitPython_ticks/actions
 17      :alt: Build Status
 18  
 19  
 20  .. image:: https://img.shields.io/badge/code%20style-black-000000.svg
 21      :target: https://github.com/psf/black
 22      :alt: Code Style: Black
 23  
 24  Work with intervals and deadlines in milliseconds
 25  
 26  
 27  Dependencies
 28  =============
 29  This driver depends on:
 30  
 31  * `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_
 32  
 33  Please ensure all dependencies are available on the CircuitPython filesystem.
 34  This is easily achieved by downloading
 35  `the Adafruit library and driver bundle <https://circuitpython.org/libraries>`_
 36  or individual libraries can be installed using
 37  `circup <https://github.com/adafruit/circup>`_.
 38  
 39  
 40  
 41  Installing from PyPI
 42  =====================
 43  
 44  On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from
 45  PyPI <https://pypi.org/project/adafruit-circuitpython-ticks/>`_.
 46  To install for current user:
 47  
 48  .. code-block:: shell
 49  
 50      pip3 install adafruit-circuitpython-ticks
 51  
 52  To install system-wide (this may be required in some cases):
 53  
 54  .. code-block:: shell
 55  
 56      sudo pip3 install adafruit-circuitpython-ticks
 57  
 58  To install in a virtual environment in your current project:
 59  
 60  .. code-block:: shell
 61  
 62      mkdir project-name && cd project-name
 63      python3 -m venv .venv
 64      source .venv/bin/activate
 65      pip3 install adafruit-circuitpython-ticks
 66  
 67  
 68  
 69  Installing to a Connected CircuitPython Device with Circup
 70  ==========================================================
 71  
 72  Make sure that you have ``circup`` installed in your Python environment.
 73  Install it with the following command if necessary:
 74  
 75  .. code-block:: shell
 76  
 77      pip3 install circup
 78  
 79  With ``circup`` installed and your CircuitPython device connected use the
 80  following command to install:
 81  
 82  .. code-block:: shell
 83  
 84      circup install adafruit_ticks
 85  
 86  Or the following command to update an existing version:
 87  
 88  .. code-block:: shell
 89  
 90      circup update
 91  
 92  Usage Example
 93  =============
 94  
 95  .. code-block:: python
 96  
 97      from adafruit_ticks import ticks_ms, ticks_add, ticks_less
 98  
 99      # Wait for 100ms to pass
100      deadline = ticks_add(ticks_ms(), 100)
101      while ticks_less(ticks_ms(), deadline):
102          pass
103  
104  Documentation
105  =============
106  
107  API documentation for this library can be found on `Read the Docs <https://docs.circuitpython.org/projects/ticks/en/latest/>`_.
108  
109  For information on building library documentation, please check out
110  `this guide <https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/sharing-our-docs-on-readthedocs#sphinx-5-1>`_.
111  
112  Contributing
113  ============
114  
115  Contributions are welcome! Please read our `Code of Conduct
116  <https://github.com/adafruit/Adafruit_CircuitPython_ticks/blob/HEAD/CODE_OF_CONDUCT.md>`_
117  before contributing to help this project stay welcoming.