Created
April 25, 2014 08:38
-
-
Save yamanetoshi/11282290 to your computer and use it in GitHub Desktop.
init_gpio 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
void init_gpio(void){ | |
int i; | |
// pullup all | |
*GPPUD = 0x02; | |
// wait 150 cycle | |
for(i=0;i<150;i++){ | |
// nop | |
asm("mov r0,r0"); | |
} | |
*GPPUDCLK0 = 0xffffffff; | |
*GPPUDCLK1 = 0xffffffff; | |
// wait 150 cycle | |
for(i=0;i<150;i++){ | |
// nop | |
asm("mov r0,r0"); | |
} | |
*GPPUDCLK0 = 0; | |
*GPPUDCLK1 = 0; | |
*GPFSEL0 = 0; | |
*GPFSEL1 = 0; | |
*GPFSEL2 = 0; | |
*GPFSEL3 = 0; | |
*GPFSEL4 = 0; | |
*GPFSEL5 = 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment