Unit RPIGPIOEXPANDER

From Ultibo.org
Revision as of 03:56, 13 June 2017 by Ultibo (Talk | contribs)

Jump to: navigation, search

Return to Unit Reference


Description


Raspberry Pi Firmware GPIO Expander Driver

As of February 2017 the Raspberry Pi firmware contains a mailbox interface to allow control of the GPIO expander on the Raspberry Pi 3 and Compute Module 3.

Unlike the earlier virtual GPIO interface this mailbox service now supports most GPIO functionality including getting and setting a pin value, getting and changing the pin function and getting or changing the pull up/down options.

This driver implements most of the functionality available in the new mailbox service as a standard Ultibo GPIO device and also provides direct mailbox calls to allow access to any additional options not covered by the GPIO device API.

When included in a project this driver replaces the Virtual GPIO functions provided by the PlatformRPi2 and PlatformRPi3 units.

According to /arch/arm/boot/dts/bcm2710-rpi-3-b.dts the following pin assignments are known:

  • GPIO_PIN_2 = Activity LED
  • GPIO_PIN_4 = HDMI Detect (Input / Active Low)
  • GPIO_PIN_7 = Power LED (Input / Active Low)

Note that this driver requires the most recent firmware (later than February 2017) and has been tested successfully with the firmware release from 22 May 2017.

The latest version of the firmware is available from https://github.com/raspberrypi/firmware

Constants



RPiGPIO expander specific constants RPIGPIOEXP_GPIO_*
RPIGPIOEXP_GPIO_DESCRIPTION = 'Raspberry Pi Firmware GPIO Expander'; Description of RPiGPIO Expander device
 
RPIGPIOEXP_GPIO_MIN_PIN = GPIO_PIN_0;  
RPIGPIOEXP_GPIO_MAX_PIN = GPIO_PIN_7;  
 
RPIGPIOEXP_GPIO_PIN_COUNT = 8;  
 
RPIGPIOEXP_GPIO_PIN_OFFSET = 128;  
 
RPIGPIOEXP_GPIO_MAX_LEVEL = GPIO_LEVEL_HIGH;  
 
RPIGPIOEXP_GPIO_MAX_PULL = GPIO_PULL_DOWN;  
 
RPIGPIOEXP_GPIO_MIN_FUNCTION = GPIO_FUNCTION_IN;  
RPIGPIOEXP_GPIO_MAX_FUNCTION = GPIO_FUNCTION_OUT;  


Type definitions



RPiGPIO expander specific types

PRPiGPIOExpander = ^TRPiGPIOExpander;

TRPiGPIOExpander = record

GPIO Properties
GPIO:TGPIODevice;  
RPiGPIO Expander Properties
   


Public variables


None defined

Function declarations


To be documented


Return to Unit Reference