Platforms to show: All Mac Windows Linux Cross-Platform

Back to WiringPiMBS module.

Previous items

WiringPiMBS.SPISetupMode(channel as Integer, speed as Integer, mode as Integer) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 15.3 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
This is the way to initialise a channel (The Pi has 2 channels; 0 and 1).

The speed parameter is an integer in the range 500,000 through 32,000,000 and represents the SPI clock speed in Hz.

The returned value is the Linux file-descriptor for the device, or -1 on error. If an error has happened, you may use the standard errno global variable to see why.

WiringPiMBS.wiringPiSetup as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 15.3 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
Initializes the library.

This initialises wiringPi and assumes that the calling program is going to be using the wiringPi pin numbering scheme. This is a simplified numbering scheme which provides a mapping from virtual pin numbers 0 through 16 to the real underlying Broadcom GPIO pin numbers. See the pins page for a table which maps the wiringPi pin number to the Broadcom GPIO pin number to the physical location on the edge connector.

This function needs to be called with root privileges.

One of the setup functions must be called at the start of your program or your program will fail to work correctly. You may experience symptoms from it simply not working to segfaults and timing issues.

WiringPiMBS.wiringPiSetupGpio as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 15.3 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
Initializes the library.

This is identical to wiringPiSetup, however it allows the calling programs to use the Broadcom GPIO pin numbers directly with no re-mapping.

As above, this function needs to be called with root privileges, and note that some pins are different from revision 1 to revision 2 boards.

One of the setup functions must be called at the start of your program or your program will fail to work correctly. You may experience symptoms from it simply not working to segfaults and timing issues.

WiringPiMBS.wiringPiSetupPhys as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 15.3 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
Initializes the library.

Identical to wiringPiSetup, however it allows the calling programs to use the physical pin numbers on the P1 connector only.

As above, this function needs to be called with root priviliges.

One of the setup functions must be called at the start of your program or your program will fail to work correctly. You may experience symptoms from it simply not working to segfaults and timing issues.

WiringPiMBS.wiringPiSetupSys as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 15.3 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
Initializes the library.

This initialises wiringPi but uses the /sys/class/gpio interface rather than accessing the hardware directly. This can be called as a non-root user provided the GPIO pins have been exported before-hand using the gpio program. Pin numbering in this mode is the native Broadcom GPIO numbers – the same as wiringPiSetupGpio() above, so be aware of the differences between Rev 1 and Rev 2 boards.

Note: In this mode you can only use the pins which have been exported via the /sys/class/gpio interface before you run your program. You can do this in a separate shell-script, or by using the system() function from inside your program to call the gpio program.

Also note that some functions have no effect when using this mode as they’re not currently possible to action unless called with root privileges. (although you can use system() to call gpio to set/change modes if needed)

One of the setup functions must be called at the start of your program or your program will fail to work correctly. You may experience symptoms from it simply not working to segfaults and timing issues.

Some examples using this method:

WiringPiMBS.wpiPinToGpio(wpiPin as Integer) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 15.3 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
This returns the BCM_GPIO pin number of the supplied wiringPi pin.

It takes the board revision into account.

WiringPiMBS.Write(fd as Integer, data as Memoryblock) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 15.3 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
Write to a file descriptor.

Write attempts to write bytes to the object referenced by the descriptor fildes from the memoryblock pointed to by data.
Upon successful completion the number of bytes which were written is returned. Otherwise, a -1 is returned and the global variable errno is set to indicate the error.

Previous items

The items on this page are in the following plugins: MBS Linux Plugin.


The biggest plugin in space...