init(3)

✨ init(3) β€” the bcm2835 library glow-up page ✨

okay bestie, welcome to init(3) πŸ’– this is the Library Functions Manual page for the bcm2835 library, and it's literally the page you read before you touch anything else. no cap.


🌸 NAME 🌸

init β€” Library initialisation and management πŸŽ€

like... starting the library up and shutting it down. the whole vibe check. πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

Functions

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

that's it, that's the whole roster. four little icons πŸ‘‘


🌈 Detailed Description 🌈

These functions let you initialise and control the bcm2835 library. that's the entire assignment, and they ate. πŸ”₯


πŸ’– Function Documentation πŸ’–

🫢 int bcm2835_close (void) [extern]

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

like when you leave the party and you actually turn the lights off. main character behaviour.

Returns

1 if successful else 0 ✨


πŸ‘‘ int bcm2835_init (void) [extern]

Initialises 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 β€” the only exception is bcm2835_set_debug. fr fr.

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. (yes that stray period is in the original, we respect the original πŸŽ€)

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. it's giving "pretend mode", and honestly? iconic.
  • A value of 0, the default, causes normal operation.

Call this before calling bcm2835_init(); β€” order matters, bestie. πŸ™ˆ

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. lowkey the easiest function on this whole page. πŸ“

Returns

the current library version number πŸ’œ


🌸 Author 🌸

Generated automatically by Doxygen for bcm2835 from the source code. (the robots did this one, we just added the glitter ✨)


and that's the whole page, babe! πŸ¦‹ this init(3) came to you from the bcm2835 library, Version 1.75 β€” screenshot it, bookmark it, keep it in the group chat, iykyk. mwah πŸ’…πŸ’–

πŸ“¦ where this page comes from