serialData.h 891 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /***************************************************************
  2. Copyright: 2016-2019 ROS小课堂 www.corvin.cn
  3. Author: corvin
  4. Description:
  5. 用于从arduino的串口获得命令的类,包含各种成员变量和函数.
  6. History:
  7. 20181225: initial this file.
  8. *************************************************************/
  9. #ifndef _SERIALDATA_H_
  10. #define _SERIALDATA_H_
  11. #define ENTER_CHAR '\r'
  12. class serialData
  13. {
  14. public:
  15. void resetCmdParam(void);
  16. //argCnt:arg total cnt; argIndex:arg current index.
  17. byte argCnt;
  18. byte argIndex;
  19. // Variable to hold the current single-character command
  20. char cmd_chr;
  21. // Character arrays to hold the first, second and third arguments
  22. char argv1[4];
  23. char argv2[4];
  24. char argv3[4];
  25. // The arguments converted to integers
  26. int arg1;
  27. int arg2;
  28. int arg3;
  29. };
  30. serialData serialObj;
  31. #endif