Created
July 27, 2017 03:09
-
-
Save amaork/e20ffe04172586479f7e539408eb7149 to your computer and use it in GitHub Desktop.
Raspberry pi restore spi alt0 function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <bcm2835.h> | |
int main(int argc, char **argv) | |
{ | |
if (!bcm2835_init()) { | |
fprintf(stderr, "bcm2835_init failed!\n"); | |
return -1; | |
} | |
bcm2835_gpio_fsel(RPI_GPIO_P1_21, BCM2835_GPIO_FSEL_ALT0); /* MISO BCM 9 */ | |
bcm2835_gpio_fsel(RPI_GPIO_P1_19, BCM2835_GPIO_FSEL_ALT0); /* MOSI BCM 10 */ | |
bcm2835_gpio_fsel(RPI_GPIO_P1_23, BCM2835_GPIO_FSEL_ALT0); /* CLK BCM 11 */ | |
bcm2835_close(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment