You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
724 B

2 years ago
  1. #include <fstream>
  2. #include <functional>
  3. #include <iostream>
  4. #include <list>
  5. #include <map>
  6. #include <memory>
  7. #include <set>
  8. #include <sstream>
  9. #include <string>
  10. #include <vector>
  11. using namespace std;
  12. int main(int argc, char const *argv[]) {
  13. //
  14. cout << "============== Rockchip gpio computer ==============" << endl;
  15. while (true) {
  16. int gpiopinNum = 0;
  17. int pingroup = 0;
  18. char pinsubgroup = 0;
  19. int pinoff = 0;
  20. printf("Please input gpio pin name: GPIO");
  21. fflush(stdout);
  22. scanf("%d-%c%d", &pingroup, &pinsubgroup, &pinoff);
  23. gpiopinNum = pingroup * 32 + (pinsubgroup - 'A') * 8 + pinoff;
  24. printf("GPIO%d-%c%d -> GPIO%d\n", pingroup, pinsubgroup, pinoff, gpiopinNum);
  25. }
  26. return 0;
  27. }