commit 42b02bf55f0e9b5445a0a2152895582e6654c3e5 Author: zhaohe Date: Mon Sep 11 17:30:16 2023 +0800 add rockchip_gpio_pin_num_to_name.cpp diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..1abe734 --- /dev/null +++ b/.clang-format @@ -0,0 +1,5 @@ +# Defines the Chromium style for automatic reformatting. +# http://clang.llvm.org/docs/ClangFormatStyleOptions.html +Language: Cpp +BasedOnStyle: Google +ColumnLimit: 250 \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..ee85816 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "files.associations": { + "*.hpp": "cpp", + "functional": "cpp" + } +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..ebdb595 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ + gcc -static -static-libgcc -static-libstdc++ .\rockchip_gpio_pin_num_to_name.cpp -lwsock32 -lstdc++ -o rockchip_gpio_pin_num_to_name.exe \ No newline at end of file diff --git a/release/rockchip_gpio_pin_num_to_name.exe b/release/rockchip_gpio_pin_num_to_name.exe new file mode 100644 index 0000000..20fc3e1 Binary files /dev/null and b/release/rockchip_gpio_pin_num_to_name.exe differ diff --git a/rockchip_gpio_pin_num_to_name.cpp b/rockchip_gpio_pin_num_to_name.cpp new file mode 100644 index 0000000..8beea5d --- /dev/null +++ b/rockchip_gpio_pin_num_to_name.cpp @@ -0,0 +1,30 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +using namespace std; + +int main(int argc, char const *argv[]) { + // + cout << "============== Rockchip gpio computer ==============" << endl; + + while (true) { + int gpiopinNum = 0; + printf("Please input gpio pin number: \n"); + scanf("%d", &gpiopinNum); + int pingroup = gpiopinNum / 32; + int pinsubgroup = gpiopinNum % 32 / 8; + char pinsubgroup_c = 'A' + pinsubgroup; + int pinoff = gpiopinNum % 8; + + printf("GPIO%d -> GPIO%d-%c%d\n", gpiopinNum, pingroup, pinsubgroup_c, pinoff); + } + + return 0; +}