Hardware Reference
In-Depth Information
printf ( "Start copying GPIO_07 to GPIO_31 \n " );
while ( keepgoing ) {
if (* gpio_datain & GPIO_07 ) {
* gpio_setdataout_addr = GPIO_31 ;
} else {
* gpio_cleardataout_addr = GPIO_31 ;
}
//usleep(1);
}
munmap (( void *) gpio_addr , GPIO0_SIZE );
close ( fd );
return 0 ;
}
Now, compile and run the code:
bone# gcc -O3 pushLEDmmap.c -o pushLEDmmap
bone# ./pushLEDmmap
Mapping 44E07000 - 44E08000 (size: 1000)
GPIO mapped to 0xb6fac000
GPIO SETDATAOUTADDR mapped to 0xb6fac194
GPIO CLEARDATAOUT mapped to 0xb6fac190
Start copying GPIO_07 to GPIO_31
^C
Ctrl-C pressed, cleaning up and exiting...
The code is in a tight while loop that checks the status of GPIO 7 and copies it to GPIO
31.
Search WWH ::




Custom Search