init(3)

NAME
init - Library initialisation and management

SYNOPSIS

  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

  int bcm2835_close (void ) [extern]
Close the library, deallocating any allocated memory and closing /dev/mem

Returns
    1 if successful else 0

  int bcm2835_init (void ) [extern]
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

  void bcm2835_set_debug (uint8_t debug) [extern]
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
    debug The new debug level. 1 means debug

  unsigned int bcm2835_version (void ) [extern]
Returns the version number of the library, same as BCM2835_VERSION

Returns
    the current library version number

Author

Generated automatically by Doxygen for bcm2835 from the source code.