rk_pin

Crates.iork_pin
lib.rsrk_pin
version0.1.1
sourcesrc
created_at2024-08-01 14:45:55.567307
updated_at2024-08-01 14:53:19.044677
descriptionA tool for converting Rockchip GPIO pin names to pin numbers and vice versa.
homepage
repositoryhttps://github.com/TrekMax/rk_pin
max_upload_size
id1322112
size16,249
TianShuang Ke (TrekMax)

documentation

README

rk_pin

GPIO Converter tools for Rockchip

Description

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.

Features

  • Convert GPIO pin names (e.g., GPIO4_C5) to pin numbers.
  • Convert pin numbers back to GPIO pin names.

Usage

Command Line Arguments

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.

Examples

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]

Building

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.

Installation

You can also use the cargo install command to install the program globally.

cargo install rk_pin
Commit count: 0

cargo fmt