diff --git a/.vscode/settings.json b/.vscode/settings.json index ee85816..608c7fa 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,7 @@ { "files.associations": { "*.hpp": "cpp", - "functional": "cpp" + "functional": "cpp", + "iostream": "cpp" } } \ No newline at end of file diff --git a/README.md b/README.md index ebdb595..a623f7b 100644 --- a/README.md +++ b/README.md @@ -1 +1,2 @@ - 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 + gcc -static -static-libgcc -static-libstdc++ .\rockchip_gpio_pin_num_to_name.cpp -lwsock32 -lstdc++ -o rockchip_gpio_pin_num_to_name.exe + gcc -static -static-libgcc -static-libstdc++ .\rockchip_gpio_pin_name_to_num.cpp -lwsock32 -lstdc++ -o rockchip_gpio_pin_name_to_num.exe \ No newline at end of file diff --git a/release/rockchip_gpio_pin_name_to_num.exe b/release/rockchip_gpio_pin_name_to_num.exe new file mode 100644 index 0000000..ce97121 Binary files /dev/null and b/release/rockchip_gpio_pin_name_to_num.exe differ diff --git a/rockchip_gpio_pin_name_to_num.cpp b/rockchip_gpio_pin_name_to_num.cpp new file mode 100644 index 0000000..86a1abb --- /dev/null +++ b/rockchip_gpio_pin_name_to_num.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; + int pingroup = 0; + char pinsubgroup = 0; + int pinoff = 0; + printf("Please input gpio pin name: GPIO"); + fflush(stdout); + scanf("%d-%c%d", &pingroup, &pinsubgroup, &pinoff); + gpiopinNum = pingroup * 32 + (pinsubgroup - 'A') * 8 + pinoff; + printf("GPIO%d-%c%d -> GPIO%d\n", pingroup, pinsubgroup, pinoff, gpiopinNum); + } + + return 0; +}