/* GPIO.h */ #ifndef _GPIO_H #define _GPIO_H #ifdef __cplusplus extern "C" { #endif /*============================================================================*/ #include #include #include #include #include #include //we are skipping a LOT of registers, but most are used by the pi anyway. typedef enum { GPFSEL0, //pin function select GPFSEL1, GPFSEL2, GPSET0 = 7, //(write only) set pin high GPSET1, GPCLR0 = 10, //(write only) set pin low GPCLR1, GPLEV0 = 13, //(read only) read current level GPLEV1, GPPUD = 37 //pull-up/down enable }gpioReg_t; //tells the PI what pin we want typedef enum { GPIO00, GPIO01, GPIO02, GPIO03, GPIO04, GPIO05, GPIO06, GPIO07, GPIO08, GPIO09, GPIO10, GPIO11, GPIO12, GPIO13, GPIO14, GPIO15, GPIO16, GPIO17, GPIO18, GPIO19, GPIO20, GPIO21, GPIO22, GPIO23, GPIO24, GPIO25, GPIO26, GPIO27 }gpioPin_t; //tells the PI what type of function the GPIO pin has typedef enum { PIN_INPUT, PIN_OUTPUT, PIN_ALT5, PIN_ALT4, PIN_ALT0, PIN_ALT1, PIN_ALT2, PIN_ALT3 }gpioPinFunction_t; //function proto's void gpio_setPinType(gpioPin_t pinNumber, gpioPinFunction_t mode); bool gpio_readPin(gpioPin_t pinNumber); void gpio_SetPin(gpioPin_t pinNumber); void gpio_ClearPin(gpioPin_t pinNumber); bool gpio_init(void); /*============================================================================*/ #ifdef __cplusplus } #endif #endif //_GPIO_H