class PinBank

class PinBank

Public Functions

PinBank()

Creates the mapping array used by index_to_soc and the relevant data stuctures.

Pin at(int index)

Returns a Pin object which can be used to manipulate the index GPIO pin

Return
The Pin object
Parameters
  • index -

    - The index of the pin. See

Pin pin(int index)

Returns a Pin object which can be used to manipulate the index GPIO pin

Return
The Pin object
Parameters
  • index -

    - The index of the pin. See

bool has_len()

Returns true if the length of the pins array is greater than 0

Return
Bool

int length()

Returns the number of available pins (both free and in use).

Private Functions

int index_to_soc(int index)

Translates the index numbering to the SoC value.

int by_revision(int v1, int v2)

The various models of Raspberry Pi use different GPIO numbering conventions. The function returns the SoC value for the selected pin according to the Raspberry Pi version.

Return
v1 or v2, according to the value of pi_revision
Parameters
  • v1 -

    The value of the pin for Rasbperry Pi 1 A and B

  • v2 -

    The value of the pin for Rasbperry Pi 1 B+ and 2 B