![]() ![]() ![]() // How to access GPIO registers from C-code on the Raspberry-Pi // Example program // 15-January-2012 // Dom and Gert // Revised: 1 // Access from ARM Running Linux #define BCM2708_PERI_BASE 0x20000000 #define GPIO_BASE (BCM2708_PERI_BASE + 0x200000) /* GPIO controller */ #include #include #include #include #include #define PAGE_SIZE (4*1024) #define BLOCK_SIZE (4*1024) int mem_fd void * gpio_map // I/O access volatile unsigned * gpio // GPIO setup macros. Note: For Raspberry Pi 2 and Pi 3, change BCM2708_PERI_BASE to 0x3F000000 for the code to work. (Thanks to Dom for doing the difficult work of finding and testing the mapping.) Gert van Loo & Dom, have provided some tested code which accesses the GPIO pins through direct GPIO register manipulation in C-code. 10.2.1.2 Example of an (unstructured) BASIC program.8.5 libgpiod - C library and tools for interacting with the linux GPIO character device.8.1 sysfs, part of the raspbian operating system.7.3 Java Webapp GPIO web control via HTTP.6.3.2 RpiScratchIO - Documentation and examples.1.7 rgpio (local & remote /dev/gpiochip I/F). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |