Bela
Real-time, ultra-low-latency audio and sensor processing system for BeagleBone Black
Loading...
Searching...
No Matches
Gpio Class Reference

Public Types

enum  Direction { INPUT , OUTPUT }

Public Member Functions

int open (unsigned int pin, Direction direction, bool unexport=true)
void close ()
bool read ()
void set ()
void clear ()
void write (bool value)
bool enabled ()

Static Public Member Functions

static uint32_t getBankAddress (unsigned int bank)

Detailed Description

Member Function Documentation

◆ open()

int Gpio::open ( unsigned int pin,
Direction direction,
bool unexport = true )

Opens a GPIO pin.

Parameters
pinthe GPIO pin ( 0 <= pin < 128)
directionone of INPUT or OUTPUT
unexportif false, it will not try to unexport the pin when calling close()
Returns
0 if success, -1 otherwise;
Examples
Extras/cape-test/render.cpp, and synchronous-gpio/render.cpp.

◆ close()

void Gpio::close ( )

Closes a currently open GPIO

◆ read()

bool Gpio::read ( )
inline

Read the GPIO value.

Returns
the GPIO value

◆ set()

void Gpio::set ( )
inline

Set the output to 1.

◆ clear()

void Gpio::clear ( )
inline

Clear the output

◆ write()

void Gpio::write ( bool value)
inline

Write an output value

Parameters
valuethe value to write

◆ enabled()

bool Gpio::enabled ( )
inline

Check if the GPIO is enabled.

Returns
true if enabled, false otherwise

◆ getBankAddress()

uint32_t Gpio::getBankAddress ( unsigned int bank)
static

A utility function to return the base address of a Gpio bank.


The documentation for this class was generated from the following file: