Raspberry Pi 3, GPIO Pin Alternate Functions

Forum

GPIO: switching between ALT functions

Tools and Applications

pi-gpio-switch , Utility to switch Raspberry-Pi GPIO pin functions by Tim Giles 01/04/2013
changing pins works!
Raspberry Pi And The IoT In C – Memory Mapped GPIO

bcm2835

C library for Broadcom BCM 2835 as used in Raspberry Pi
github.com/SS-JIA/bcppm2835, A C++ port of Mike’s bcm2835 C library
Device::BCM2835 – Perl extension for accesing GPIO pins on a Raspberry Pi via the BCM 2835 GPIO
github.com/jperkin/node-rpio, Raspberry Pi GPIO library for node.js


/*!   \brief bcm2835PortFunction
  Port function select modes for bcm2835_gpio_fsel()
*/
typedef enum
{
    BCM2835_GPIO_FSEL_INPT  = 0x00,   /*!< Input 0b000 */
    BCM2835_GPIO_FSEL_OUTP  = 0x01,   /*!< Output 0b001 */
    BCM2835_GPIO_FSEL_ALT0  = 0x04,   /*!< Alternate function 0 0b100 */
    BCM2835_GPIO_FSEL_ALT1  = 0x05,   /*!< Alternate function 1 0b101 */
    BCM2835_GPIO_FSEL_ALT2  = 0x06,   /*!< Alternate function 2 0b110, */
    BCM2835_GPIO_FSEL_ALT3  = 0x07,   /*!< Alternate function 3 0b111 */
    BCM2835_GPIO_FSEL_ALT4  = 0x03,   /*!< Alternate function 4 0b011 */
    BCM2835_GPIO_FSEL_ALT5  = 0x02,   /*!< Alternate function 5 0b010 */
    BCM2835_GPIO_FSEL_MASK  = 0x07    /*!< Function select bits mask 0b111 */
} bcm2835FunctionSelect;

/*! \brief bcm2835PUDControl
  Pullup/Pulldown defines for bcm2835_gpio_pud()
*/
typedef enum
{
    BCM2835_GPIO_PUD_OFF     = 0x00,   /*!< Off ? disable pull-up/down 0b00 */
    BCM2835_GPIO_PUD_DOWN    = 0x01,   /*!< Enable Pull Down control 0b01 */
    BCM2835_GPIO_PUD_UP      = 0x02    /*!< Enable Pull Up control 0b10  */
} bcm2835PUDControl;

Device Tree

Device Trees, overlays, and parameters
Enabling Pullup and Pulldown Resistors on The Raspberry Pi
How do I make a device tree overlay for just a single GPIO?

elinux.org

RPi Low-level peripherals
RPi Tutorial Easy GPIO Hardware & Software
RPi BCM2835 GPIOs
RPi GPIO Code Samples

Leave a Reply

Your email address will not be published. Required fields are marked *