librpipInit
uint32_t librpipInit(uint32_t board, uint32_t flags, uint32_t ignore_pins);
Description
librpipInit initialises the library and detects active kernel modules. It must be called before any other function can be used.
Note as i2s is currently unimplemented if you have it enabled you’ll see an warning that ‘The pins 0x3c0000 are configured for an unknown alternate function’. i.e. pins 18-21 are in use by the i2s module.
Parameters
- uint32_t board
One of the LIBRPIP_BOARD_* constants. - uint32_t flags
Any of the LIBRPIP_FLAG_* constants or 0 for none. - uint32_t ignore_pins
A bitmask of GPIO pins that should not be used by librpip – e.g. they are in use by another application and their usage isn’t detectable (alt functions not set). The bit mask can be created by shifting 1. So for example if GPIO pins 22 & 23 are in use by something else, the bit mask is created with (1<<23)|(1<<22). Set to 0 to use all pins.
Returns
a uint32_t representing available functions based on hardware detected. To test if a particular item of hardware exists and is able, test the return value with a logical ‘and’ to one of the LIBRPIP_FEATURE_* constants.
A zero returned means librpip failed to initialise. You should retry with debug on to see why.
Example
Initialise librpip in debug mode, auto detect the board in use and then see if SPI0 is available.
uint32_t feature_set; feature_set = librpipInit(LIBRPIP_BOARD_DETECT, LIBRPIP_FLAG_DEBUG_ON, 0); if(feature_set & LIBRPIP_FEATURE_SPI0) { do something with SPI0 }