Browse Source

add rockchip_gpio_pin_num_to_name.cpp

master
zhaohe 2 years ago
commit
42b02bf55f
  1. 5
      .clang-format
  2. 6
      .vscode/settings.json
  3. 1
      README.md
  4. BIN
      release/rockchip_gpio_pin_num_to_name.exe
  5. 30
      rockchip_gpio_pin_num_to_name.cpp

5
.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

6
.vscode/settings.json

@ -0,0 +1,6 @@
{
"files.associations": {
"*.hpp": "cpp",
"functional": "cpp"
}
}

1
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

BIN
release/rockchip_gpio_pin_num_to_name.exe

30
rockchip_gpio_pin_num_to_name.cpp

@ -0,0 +1,30 @@
#include <fstream>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <set>
#include <sstream>
#include <string>
#include <vector>
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;
}
Loading…
Cancel
Save