Skip to main content

No project description provided

Project description

caninos-sdk

A ideia é fazer com que o uso dos periféricos da Labrador seja muito acessível, ao ponto de, um dia, permitir códigos assim:

import caninos_sdk as k9

# as 4 linhas abaixo já funcionam:
labrador = k9.Labrador()
labrador.pin15.enable_gpio(k9.Pin.Direction.OUTPUT, alias="led_status")
labrador.pin2.enable_gpio(k9.Pin.Direction.INPUT, alias="button1")
labrador.camera.enable()

# as próximas 3 ainda não
labrador.pin.enable_gpio(k9.cpu_pin(0x33), k9.INPUT, alias="button1")
labrador.pin.enable_gpio(7, k9.I2C, address=0x4, alias="temp_sensor")
labrador.wifi.enable("CITI", "1cbe991a14")

print(labrador.enabled_features())

# uso
labrador.led_status.high() # já funciona
res = labrador.button1.read() # ainda não
value = labrador.temp_sensor.read() # ainda não

ip = labrador.wifi.get_ip() # ainda não
ok, frame = labrador.camera.read() # já funciona

Começando

Pode testar rodando um dos exemplos. Se for usar o gpio: python3 examples/gpio_led.py.

Note que, para habilitar o uso das GPIOs sem sudo, precisa rodar esses comandos (por enquanto) toda vez que reinicia a placa:

sudo chown caninos /dev/gpiochip*
sudo chmod g+rw /dev/gpiochip*

Contributing

See: https://godatadriven.com/blog/a-practical-guide-to-setuptools-and-pyproject-toml/

Install dependencies:

sudo apt install python3-dev python3-pip python3-setuptools libffi-dev libssl-dev curl
pip3 install --upgrade pip

To install the package locally in editable form:

pip3 install -e .

Publish a new version

Install build deps: pip3 install build twine.

Update the version number at __init__.py and setup.cfg.

# build the new version
python3 -m build

# deploy
twine upload -r testpypi dist/* # to https://test.pypi.org/
twine upload -r dist/*.whl # to https://pypi.org/

TO-DO:

  • initial sketch to prove the concept
  • make the gpios actually work (read/write) - [ ] create default constructors/subclasses for specific boards - [ ] create a "VirtualLabrador" class, for tests and remote labs
  • refactor to a proper python package using modern python conventions
  • [-] write unit tests -> works with pytest -s
  • gpio read/write work across Labradors 32/64
  • support pwm
  • support i2c
  • support spi
  • support wifi
  • support camera

Other notes:

  • should this library support other SBCs?
  • should the docs be in English or Portuguese?
  • need to get funding or community help

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

caninos_sdk-0.2.2-py3-none-any.whl (8.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page