I have a basic understanding of the GPIO on the RPi. I want to adapt some of my previous software which interfaced my project board via the Parallel port via direct output to the PP address (0x378) using Outb in C. Can I directly access the GPIO using Outb in C (ofc with a different port address).
|
Having said all that, you could write your own implementation of |
|||||
|
|
You would need to take this code and write your own implementation of the outb() function, which takes the data and writes it to the GPIO pins you want to use. This could be very simple. If you just write the byte directly to the GPIO memory location, you will have eight GPIOs update immediately with the same state you would have gotten on the parallel port. Something like this ought to work:
The only problem here is that this may not update the GPIO pins you want (it may even update some GPIO pins that aren't connected - I'm not sure of the mapping) so you may need to alter the function so the pins you want are the ones used. You will also get an intermediate value appearing momentarily on the GPIO pins (when the number is half set) which may or may not be an issue. Looking at the Broadcom datasheet it doesn't look like there's a way to both set and clear GPIO pins at the same time. |
|||||
|