Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


products:sbc:common:applications:gpio:get-gpio-number

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
products:sbc:common:applications:gpio:get-gpio-number [2024/08/06 05:47]
nick ↷ Page name changed from products:sbc:common:applications:gpio:cal-gpio-number to products:sbc:common:applications:gpio:get-gpio-number
products:sbc:common:applications:gpio:get-gpio-number [2024/08/06 06:05] (current)
nick
Line 1: Line 1:
  
-====== Get GPIO Number ======+====== Get GPIO number ======
  
-To use a GPIO pin, you need to know its PIN number. +**Calculation:**
- +
-==== Calculation ====+
  
 GPIO PIN number calculation method: ''Number = Range Base + Pin Index'' GPIO PIN number calculation method: ''Number = Range Base + Pin Index''
  
-1. ''Range Base'' refers to the base value of GPIO ranges. +  * ''Range Base'' refers to the base value of GPIO ranges 
- +  ''Pin Index'' refers to the sorting of the GPIO pins you need to calculate in the corresponding ranges
-2. ''Pin Index'' refers to the sorting of the GPIO pins you need to calculate in the corresponding ranges.+
  
-===== Example =====+**Example:**
  
 1. Get ''Range Base'': 1. Get ''Range Base'':
  
-```sh+```shell
 # cat /sys/kernel/debug/pinctrl/fe000000.apb4\:pinctrl\@4000-pinctrl-meson/gpio-ranges # cat /sys/kernel/debug/pinctrl/fe000000.apb4\:pinctrl\@4000-pinctrl-meson/gpio-ranges
 GPIO ranges handled: GPIO ranges handled:
Line 24: Line 21:
 2. Get ''Pin Index'': 2. Get ''Pin Index'':
  
-```sh+```shell
 # cat /sys/kernel/debug/pinctrl/fe000000.apb4\:pinctrl\@4000-pinctrl-meson/pins # cat /sys/kernel/debug/pinctrl/fe000000.apb4\:pinctrl\@4000-pinctrl-meson/pins
 registered pins: 82 registered pins: 82
Last modified: 2024/08/06 05:47 by nick