0

I am looking to set up a simple 6 button controller for a raspberry pi project, and in order to complete the project I need to us assembly to manipulate the registers so it will "map" to certain keyboard keys.

So for instance I press the up button on the controller and the system reads a "W" as an input for example.

All buttons are working and are mapped to their respective GPIO pins.

I'm not sure where to start, and all that i have to go off of is python code, which is not what the professor wants us to use.

Any help would be appreciated.

shurburt
  • 93
  • 2
  • 6
  • 1
    how is assembly involved? if you are running on an operating system (linux) then you should not have direct access to the gpio, even if you did assembly is not required for that access, it may be required for your homework assignment, but assembly language has nothing to do with this task. – old_timer Jul 17 '18 at 19:01
  • so you want to read the gpio registers to see if an input changes then somehow you want to generate a keystroke? where is this keystroke going to go, just a printf or into the system/kernel somehow? how are you planning to access the gpio register? mmap? what operating system are you running? or is this baremetal? then if so where is the system that reads a "w"? – old_timer Jul 17 '18 at 19:05
  • @old_timer I am new to GPIO manipulation so I'm really not sure where to start but here is my idea so far. My desire is to write Assembly that would send the same address as certain keys on the keyboard. I only need to map 6. This link has c code that I like but I'm not sure how to translate that into assembly code. – shurburt Jul 17 '18 at 21:48
  • Additionally the only part of the project that need to be assembly is when I work with the GPIO, the game i am using to test the buttons will be in python, which will take keybaord inputs. – shurburt Jul 17 '18 at 21:50
  • you understand that this doesnt have to be assembly, you can use C for example, assembly doesnt grant you any special access to these registers over another language. – old_timer Jul 17 '18 at 22:28
  • please add the C code you are trying to replace in assembly language and the assembly language you have written so far to replace it if that is your question. – old_timer Jul 17 '18 at 22:29
  • If you already have some C code that is doing part of the task you should just use it as is. There are two issues here, one is the make the gpio state changes into characters somewhere (which you have not specified where). And there is the write an assembly language program, two separate tasks, the algorithm and the implementation. Do the algorithm first, test it in a language you know, then work your way toward assembly possibly stopping through C. – old_timer Jul 17 '18 at 22:31

0 Answers0