Skip to content

ph-wheels/pymonarco-hat

 
 

Repository files navigation

pymonarco-hat

Python3 wrapper for Monarco HAT C drivers, see Monarco driver repository

Getting started

Before you can use this wrapper you need to clone the Monarco HAT Driver C repository:

Install git and build-dependencies on your Raspberry Pi running Raspbian:

sudo apt update
sudo apt install git build-essential 

Clone the Monarco HAT repository repository:

cd ~
git clone https://github.com/monarco/monarco-hat-driver-c.git

Clone this repository:

cd ~
git clone https://github.com/bjarnekvae/pymonarco-hat.git

NOTE: Prior to building some additional code is required to monarco.c which resides within the Monarco src folder, see file "addon_monarco.c"

Build library

In order for the Python wrapper to work we need to build a library file from the Monarco HAT source code, this can be done like this:

cd ~/pymonarco-hat/monarco-c
make MONARCO_PATH=/path/to/monarco-hat-driver-c-repository

From this "libmonarco.so" will be compiled, this file will be used for the wrapper.

Install wrapper

Run:

cd ~/pymonarco-hat
python3 setup.py install

Run example

cd ~/pymonarco-hat/examples
python3 monarco_example.py /path/to/lib/libmonarco.so

In most cases the script has to be run as root, unless you've given your user right to access the SPI peripheral

Note

  • Counter functionality is not implemented (yet)

Requirements

  • Python 3.6 and above.

License

Under MIT license. See LICENSE.

Authors

About

Python wrapper for Monarco HAT C drivers

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 66.9%
  • C 27.4%
  • Makefile 5.7%