Giter VIP home page Giter VIP logo

Comments (6)

maruel avatar maruel commented on May 27, 2024 1

Doing the pin setup manually won't load the kernel driver, which is the key point of raspi-config. Anyhow here's the documentation to do what you asked for.

The function you want is https://godoc.org/periph.io/x/periph/host/bcm283x#Pin.SetFunc

Documentation is at https://godoc.org/periph.io/x/periph/conn/pin#PinFunc

Constants are at https://godoc.org/periph.io/x/periph/conn/i2c#pkg-constants

from periph.

maruel avatar maruel commented on May 27, 2024

Can you explain what you are trying to achieve? We never used wiringpi.

from periph.

rolandjitsu avatar rolandjitsu commented on May 27, 2024

Ok, I'll try my best.

The whole setup is for the I2C. Basically, the first 4 lines of wiringPi code are setting the GPIO0 and GPIO1 to input mode and then sets the pin functionality to operational mode 4 (use as I2C).

You can check the datasheet (page 102) for the operational modes and see this post explaining what this mode 0b100 means (translates ALT0 or operational mode 4).

The last 4 lines, sets the GPIO2 and GPIO3 to output and sets to HIGH.

from periph.

maruel avatar maruel commented on May 27, 2024

Then what about enabling i2c1 in raspi-config then use i2creg?

from periph.

maruel avatar maruel commented on May 27, 2024

References:

from periph.

rolandjitsu avatar rolandjitsu commented on May 27, 2024

Then what about enabling i2c1 in raspi-config then use i2creg?

Because I'm having a REST server that's written in Go which is supposed to have an endpoint that does the pin setup. So I wanted to use this lib to achieve that instead of calling exec.

Thanks for the references, but do you have some example illustrating how to setup some pins as I2C using i2creg?

from periph.

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.