gpio_impl.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #ifndef LIBFRAMEWORK_GPIO_IMPL_H
  2. #define LIBFRAMEWORK_GPIO_IMPL_H
  3. #include "GpioClass.h"
  4. class GPIOClassImpl : public GpioClass
  5. {
  6. public:
  7. GPIOClassImpl();
  8. ~GPIOClassImpl();
  9. //DeviceBaseClass
  10. ErrorCodeEnum GetDevCategory(DevCategoryInfo &devCategory);
  11. ErrorCodeEnum Reset();
  12. ErrorCodeEnum DevClose();
  13. ErrorCodeEnum GetLastErr(DevErrorInfo &devErrInfo);
  14. //
  15. // Device initialization.
  16. // Configure port input/output direction.
  17. //
  18. virtual ErrorCodeEnum DevOpen(GpioInitParam initParam)
  19. {
  20. ErrorCodeEnum err = Error_Succeed;
  21. return err;
  22. }
  23. //
  24. // Set ports output.
  25. // Arguments:
  26. // - dwPort:port serial number,0~MAX_PORT_NUM-1
  27. // - btData:output value
  28. // bit value 1/0 means voltage high or low
  29. // ex.dwPort=0 btData=10001010 means set port 0's the 2nd,4th,8th pin output high
  30. //
  31. virtual ErrorCodeEnum WritePort(DWORD dwPort, BYTE btData)
  32. {
  33. return Error_Succeed;
  34. }
  35. //
  36. // Get port input.
  37. // Arguments:
  38. // - dwPort:port serial number,0~MAX_PORT_NUM-1
  39. // - btStatus:input value
  40. // ex.dwPort=0 btStatus=10001010 means port 0's the 2nd,4th,8th pin with high level
  41. //
  42. virtual ErrorCodeEnum ReadPort(DWORD dwPort, BYTE& btStatus)
  43. {
  44. return Error_NotImpl;
  45. }
  46. private:
  47. int m_mode;
  48. };
  49. #endif //LIBFRAMEWORK_GPIO_IMPL_H