Crates.io | rk_pin |
lib.rs | rk_pin |
version | 0.1.1 |
source | src |
created_at | 2024-08-01 14:45:55.567307 |
updated_at | 2024-08-01 14:53:19.044677 |
description | A tool for converting Rockchip GPIO pin names to pin numbers and vice versa. |
homepage | |
repository | https://github.com/TrekMax/rk_pin |
max_upload_size | |
id | 1322112 |
size | 16,249 |
GPIO Converter tools for Rockchip
This Rust program calculates and converts between Rockchip GPIO pin names and pin numbers. It is useful for developers and engineers working with Rockchip hardware, who need to map GPIO pin names to their corresponding numbers and vice versa.
GPIO4_C5
) to pin numbers.The program accepts two types of command line arguments:
-p, --pin <PIN_NAME>
: Convert a GPIO pin name to a pin number.-n, --number <PIN_NUMBER>
: Convert a pin number to a GPIO pin name.To convert a GPIO pin name to a pin number:
cargo run -- -p GPIO4_C5
Output:
GPIO_NUM: 21
Pin name GPIO4_C5 corresponds to pin number: 149
To convert a pin number to a GPIO pin name:
cargo run -- -n 149
Output:
Pin number 149 corresponds to: [GPIO4_C5]
To build the project, use the following command:
cargo build --release
The optimized binary will be located in the target/release/ directory.
After building the project, you can copy the binary to a directory in your PATH or distribute it as needed.
You can also use the cargo install
command to install the program globally.
cargo install rk_pin