CRpi
A library for rpi with intefaces to: gpio, pwm, dma
|
Interface to the GPIO peripheral. More...
#include <stdio.h>
#include <memoryManagement/addressing.h>
#include <memoryManagement/physMemoryManagement.h>
#include <CCRCodingUtils/include/errorManagement.h>
#include <peripherals/gpio.h>
#include "gpio_internal.h"
Functions | |
int | gpio_init () |
Initializes the interface, to be called before any other function in this file. More... | |
int | gpio_isInit () |
true if gpio_init has been called with success | |
int | gpio_setFunction (int bcmPort, int function) |
Sets the function of the specified port. More... | |
int | gpio_setOutput (int bcmPort, int value) |
Sets the output at the specified port. The port will output this value if set to the output function. If you use this function with the port not set to output then the port will remember the value until you set it to the output function. More... | |
int | gpio_setOutputAll (uint64_t set, uint64_t clear) |
sets all the specified gpios to the specified values More... | |
int | gpio_getInput (int bcmPort) |
Gets the detected value of the port in input mode. Obviously you can use this only in input mode, you wold kill your rpi otherwise. More... | |
Interface to the GPIO peripheral.
If you haven't already, see gpio.h See documentation at "BCM2835 ARM peripherals" page 89
int gpio_getInput | ( | int | bcmPort | ) |
Gets the detected value of the port in input mode. Obviously you can use this only in input mode, you wold kill your rpi otherwise.
bcmPort | The port. |
int gpio_init | ( | ) |
Initializes the interface, to be called before any other function in this file.
int gpio_setFunction | ( | int | bcmPort, |
int | function | ||
) |
Sets the function of the specified port.
bcmPort | The port bcm number |
function | The desired function (PORT_FUNCTION_INPUT, PORT_FUNCTION_OUTPUT, PORT_FUNCTION_ALT_x) |
int gpio_setOutput | ( | int | bcmPort, |
int | value | ||
) |
Sets the output at the specified port. The port will output this value if set to the output function. If you use this function with the port not set to output then the port will remember the value until you set it to the output function.
bcmPort | The port bcm number |
value | 0 means low, any other number means high |
int gpio_setOutputAll | ( | uint64_t | set, |
uint64_t | clear | ||
) |
sets all the specified gpios to the specified values
set | The gpios to set to 1 |
clear | The values to set to 0 |