{"id":7675,"date":"2018-04-18T14:26:03","date_gmt":"2018-04-18T14:26:03","guid":{"rendered":"http:\/\/blog.bachi.net\/?p=7675"},"modified":"2018-04-18T14:47:36","modified_gmt":"2018-04-18T14:47:36","slug":"raspberry-pi-3-gpio-pin-alternate-functions","status":"publish","type":"post","link":"https:\/\/blog.bachi.net\/?p=7675","title":{"rendered":"Raspberry Pi 3, GPIO Pin Alternate Functions"},"content":{"rendered":"<h2>Forum<\/h2>\n<p><a href=\"https:\/\/www.raspberrypi.org\/forums\/viewtopic.php?f=44&#038;t=39138\">GPIO: switching between ALT functions<\/a><\/p>\n<h2>Tools and Applications<\/h2>\n<p><a href=\"https:\/\/gist.github.com\/paulgreg\/c2f0710a749ae9e18181\">pi-gpio-switch <\/a>, Utility to switch Raspberry-Pi GPIO pin functions by Tim Giles 01\/04\/2013<br \/>\n<a href=\"https:\/\/hackaday.io\/project\/16719-portable-raspberry-pi-zero\/log\/49616-changing-pins-works\">changing pins works!<\/a><br \/>\n<a href=\"https:\/\/www.iot-programmer.com\/index.php\/books\/22-raspberry-pi-and-the-iot-in-c\/chapters-raspberry-pi-and-the-iot-in-c\/59-raspberry-pi-and-the-iot-in-c-memory-mapped-gpio\">Raspberry Pi And The IoT In C &#8211; Memory Mapped GPIO<\/a><\/p>\n<h4>bcm2835<\/h4>\n<p><a href=\"http:\/\/www.airspayce.com\/mikem\/bcm2835\/\">C library for Broadcom BCM 2835 as used in Raspberry Pi<\/a><br \/>\n<a href=\"https:\/\/github.com\/SS-JIA\/bcppm2835\">github.com\/SS-JIA\/bcppm2835<\/a>, A C++ port of Mike&#8217;s bcm2835 C library<br \/>\n<a href=\"https:\/\/metacpan.org\/pod\/Device::BCM2835\">Device::BCM2835 &#8211; Perl extension for accesing GPIO pins on a Raspberry Pi via the BCM 2835 GPIO<\/a><br \/>\n<a href=\"https:\/\/github.com\/jperkin\/node-rpio\">github.com\/jperkin\/node-rpio<\/a>, Raspberry Pi GPIO library for node.js <\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\n\r\n\/*!   \\brief bcm2835PortFunction\r\n  Port function select modes for bcm2835_gpio_fsel()\r\n*\/\r\ntypedef enum\r\n{\r\n    BCM2835_GPIO_FSEL_INPT  = 0x00,   \/*!&lt; Input 0b000 *\/\r\n    BCM2835_GPIO_FSEL_OUTP  = 0x01,   \/*!&lt; Output 0b001 *\/\r\n    BCM2835_GPIO_FSEL_ALT0  = 0x04,   \/*!&lt; Alternate function 0 0b100 *\/\r\n    BCM2835_GPIO_FSEL_ALT1  = 0x05,   \/*!&lt; Alternate function 1 0b101 *\/\r\n    BCM2835_GPIO_FSEL_ALT2  = 0x06,   \/*!&lt; Alternate function 2 0b110, *\/\r\n    BCM2835_GPIO_FSEL_ALT3  = 0x07,   \/*!&lt; Alternate function 3 0b111 *\/\r\n    BCM2835_GPIO_FSEL_ALT4  = 0x03,   \/*!&lt; Alternate function 4 0b011 *\/\r\n    BCM2835_GPIO_FSEL_ALT5  = 0x02,   \/*!&lt; Alternate function 5 0b010 *\/\r\n    BCM2835_GPIO_FSEL_MASK  = 0x07    \/*!&lt; Function select bits mask 0b111 *\/\r\n} bcm2835FunctionSelect;\r\n\r\n\/*! \\brief bcm2835PUDControl\r\n  Pullup\/Pulldown defines for bcm2835_gpio_pud()\r\n*\/\r\ntypedef enum\r\n{\r\n    BCM2835_GPIO_PUD_OFF     = 0x00,   \/*!&lt; Off ? disable pull-up\/down 0b00 *\/\r\n    BCM2835_GPIO_PUD_DOWN    = 0x01,   \/*!&lt; Enable Pull Down control 0b01 *\/\r\n    BCM2835_GPIO_PUD_UP      = 0x02    \/*!&lt; Enable Pull Up control 0b10  *\/\r\n} bcm2835PUDControl;\r\n<\/pre>\n<h2>Device Tree<\/h2>\n<p><a href=\"https:\/\/www.raspberrypi.org\/documentation\/configuration\/device-tree.md\">Device Trees, overlays, and parameters<\/a><br \/>\n<a href=\"https:\/\/github.com\/fivdi\/onoff\/wiki\/Enabling-Pullup-and-Pulldown-Resistors-on-The-Raspberry-Pi\">Enabling Pullup and Pulldown Resistors on The Raspberry Pi<\/a><br \/>\n<a href=\"https:\/\/raspberrypi.stackexchange.com\/questions\/43825\/how-do-i-make-a-device-tree-overlay-for-just-a-single-gpio\">How do I make a device tree overlay for just a single GPIO?<\/a><\/p>\n<h2>elinux.org<\/h2>\n<p><a href=\"https:\/\/elinux.org\/RPi_Low-level_peripherals\">RPi Low-level peripherals<\/a><br \/>\n<a href=\"https:\/\/elinux.org\/RPi_Tutorial_Easy_GPIO_Hardware_%26_Software\">RPi Tutorial Easy GPIO Hardware &#038; Software<\/a><br \/>\n<a href=\"https:\/\/elinux.org\/RPi_BCM2835_GPIOs\">RPi BCM2835 GPIOs<\/a><br \/>\n<a href=\"https:\/\/elinux.org\/RPi_GPIO_Code_Samples\">RPi GPIO Code Samples<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Forum GPIO: switching between ALT functions Tools and Applications pi-gpio-switch , Utility to switch Raspberry-Pi GPIO pin functions by Tim Giles 01\/04\/2013 changing pins works! Raspberry Pi And The IoT In C &#8211; Memory Mapped GPIO bcm2835 C library for Broadcom BCM 2835 as used in Raspberry Pi github.com\/SS-JIA\/bcppm2835, A C++ port of Mike&#8217;s bcm2835 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-7675","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/7675","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7675"}],"version-history":[{"count":3,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/7675\/revisions"}],"predecessor-version":[{"id":7678,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/7675\/revisions\/7678"}],"wp:attachment":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7675"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7675"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7675"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}