Giter Site home page Giter Site logo

pinnametogpio's Introduction

pinNameToGPIO

BeagleBoard. Find the GPIO file associated to a given pin-name, like P9_14

Mini documentation

Problem description

It often happens that we want to use a pin as a digital input/output pin, that is a gpio. To do so first you need to say to the beagleboard the pin is a GPIO. You can do it do using config-pin then, you need to know which file in the filesystem has been associated to the GPIO, that is, you need to establish the XXX value in /sys/class/gpio/gpioXXX. There is a formula to do that, but its is different between the BB-Black and the BB-AI also, it does not always work: e.g. in BB-AI for P9_11 to me it fails. Therefore I give us this script which should solve the problem once and for all.

Example

  • We know pin P9_14 is set to gpio, what is its associated file in sysfs ?
  • You run:
$> pinNameToGPIO.py P9_14
  • In my system I get as output /sys/class/gpio/gpio121, your output may be different.
  • If you get no output it means the associated file was not found i.e. the system thinks the pin you selected isn't a GPIO pin.
  • You can write the pin name as P9_14 or P9.14 and it is case insensitive.

Tested working in

  • 02-dec-2021. BB-AI, BeagleBoard.org Debian Buster IoT Image 2021-10-01, Linux BB-AI-1 4.19.94-ti-r68 #1buster
  • 03-dec-2021. BB-Black, BeagleBoard.org Debian Buster IoT Image 2020-04-06, Linux beaglebone 4.19.94-ti-r42

ATTENTION !!

  • The BeagleBoard world moves fast, always check:
    • Your board name
    • Your operating system version

Changelog

  • 03-dec-2021 - tested in BB-Black
  • 02-dec-2021 - improving the Readme

pinnametogpio's People

Contributors

nmingotti avatar

Stargazers

 avatar  avatar

Watchers

James Cloos avatar  avatar

Forkers

bstin

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.