bcm2835 1.75
Functions
Library initialisation and management

Functions

int bcm2835_init (void)
 
int bcm2835_close (void)
 
void bcm2835_set_debug (uint8_t debug)
 
unsigned int bcm2835_version (void)
 

Detailed Description

These functions allow you to intialise and control the bcm2835 library

Function Documentation

◆ bcm2835_close()

int bcm2835_close ( void  )

Close the library, deallocating any allocated memory and closing /dev/mem

Returns
1 if successful else 0

◆ bcm2835_init()

int bcm2835_init ( void  )

Initialise the library by opening /dev/mem (if you are root) or /dev/gpiomem (if you are not) and getting pointers to the internal memory for BCM 2835 device registers. You must call this (successfully) before calling any other functions in this library (except bcm2835_set_debug). If bcm2835_init() fails by returning 0, calling any other function may result in crashes or other failures. If bcm2835_init() succeeds but you are not running as root, then only gpio operations are permitted, and calling any other functions may result in crashes or other failures. . Prints messages to stderr in case of errors.

Returns
1 if successful else 0

◆ bcm2835_set_debug()

void bcm2835_set_debug ( uint8_t  debug)

Sets the debug level of the library. A value of 1 prevents mapping to /dev/mem, and makes the library print out what it would do, rather than accessing the GPIO registers. A value of 0, the default, causes normal operation. Call this before calling bcm2835_init();

Parameters
[in]debugThe new debug level. 1 means debug

◆ bcm2835_version()

unsigned int bcm2835_version ( void  )

Returns the version number of the library, same as BCM2835_VERSION

Returns
the current library version number