GithubHelp home page GithubHelp logo

Rethink contents of board.pins about pingo-py HOT 2 CLOSED

ramalho avatar ramalho commented on August 17, 2024
Rethink contents of board.pins

from pingo-py.

Comments (2)

danilobellini avatar danilobellini commented on August 17, 2024

That's as useful as ls /usr/bin: too much information, but it should be there. ls /usr/bin | grep python might make sense. That's what happens when one have board.all_pins and use for something like [el for el in board.all_pins if isinstance(el, SupplyPin)]

Back to a shell, one can type python[TAB] to find all Python versions available, which would be simpler. Likewise, attributes that already selects a class of highly used pins would be useful. That's probably be the case for the data pins (board.data_pins?), which includes digital and analog pins, and for digital pins (board.digital_pins?). But how about PWM pins? I²C pins? UART pins? Analog output-only pins? Pins with pull-up resistors internally? I still think that having some attribute to store the knowledge of all pins is useful.

For some pins, the easiest way to access by a name, like board.all_pins["SCL"] for getting the only I²C clock pin on it. To find if a board have such pin, a trial-and-error approach would do, but something like "SCL" in board.all_pins would be better (which would need a __contains__ for the type(all_pins) to allow pin aliases).

from pingo-py.

Vido avatar Vido commented on August 17, 2024

@danilobellini and @ramalho,
Thanks for your suggestion.

We have this function selection with the Board.filter_pins
This came on this (quite old) commit 55339e6

digital_subset = self.board.filter_pins(pingo.DigitalPin)

from pingo-py.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.