#ifndef __AP_HAL_LINUX_GPIO_RPI_H__ #define __AP_HAL_LINUX_GPIO_RPI_H__ #include #include "AP_HAL_Linux.h" #define LOW 0 #define HIGH 1 // Raspberry Pi GPIO memory #define BCM2708_PERI_BASE 0x20000000 #define BCM2709_PERI_BASE 0x3F000000 #define GPIO_BASE(address) (address + 0x200000) #define PAGE_SIZE (4*1024) #define BLOCK_SIZE (4*1024) // GPIO setup. Always use INP_GPIO(x) before OUT_GPIO(x) or SET_GPIO_ALT(x,y) #define GPIO_MODE_IN(g) *(gpio+((g)/10)) &= ~(7<<(((g)%10)*3)) #define GPIO_MODE_OUT(g) *(gpio+((g)/10)) |= (1<<(((g)%10)*3)) #define GPIO_MODE_ALT(g,a) *(gpio+(((g)/10))) |= (((a)<=3?(a)+4:(a)==4?3:2)<<(((g)%10)*3)) #define GPIO_SET_HIGH *(gpio+7) // sets bits which are 1 #define GPIO_SET_LOW *(gpio+10) // clears bits which are 1 #define GPIO_GET(g) (*(gpio+13)&(1<