sipeed / TangNano-9K-example

TangNano-9K-example project
211 stars 66 forks source link

What are the pin numbers for the two buttons on Tang Nano 9K? #12

Closed juj closed 1 year ago

juj commented 1 year ago

I am unable to figure out the pin numbers for the two buttons on the Tang Nano 9K board based on the pinout diagram at https://wiki.sipeed.com/hardware/en/tang/Tang-Nano-9K/Nano-9K.html

image

Does anyone know what those would be?

(btw that pinout diagram also does not list the LED numbers, although those can be found at

https://github.com/sipeed/TangNano-9K-example/blob/11c872b14a242ffeb52a451ed708796ce072ff32/led/src/9K_LED_project.cst#L9-L20

)

juj commented 1 year ago

Answering myself through trial and error - the buttons on Tang Nano 9K are assigned to pins 3 and 4, and accessing them via

IO_LOC  "btn1_n" 3;
IO_PORT "btn1_n" PULL_MODE=UP;
IO_LOC  "btn2_n" 4;
IO_PORT "btn2_n" PULL_MODE=UP;

works.