CMD0x31_ReadBack_ProbeStatus.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #include "CommandsDefine.h"
  2. #include "ProjectConfig.h"
  3. #include "Probe.h"
  4. #include "Helper.h"
  5. #include "usart.h"
  6. short Probe_ConnectState;
  7. short Probe_ButtonState;
  8. short Last_Probe_ConnectState = 0xFFFF;
  9. short Last_Probe_ButtonState = 0xFFFF;
  10. void Timer_ReadBack_ProbeStatus(u8 checkChanged,u8 bIsContentBitInverted_SendBack)
  11. {
  12. #ifndef RUNNING_WHERE_AT_BOOT
  13. Probe_ConnectState = Probe_GetConnectState();
  14. Probe_ButtonState = Probe_GetButtonState();
  15. if(checkChanged == 1
  16. && Last_Probe_ConnectState==Probe_ConnectState
  17. && Last_Probe_ButtonState==Probe_ButtonState)
  18. {
  19. return;
  20. }
  21. Last_Probe_ConnectState = Probe_ConnectState;
  22. Last_Probe_ButtonState = Probe_ButtonState;
  23. u8 dataBytes=2;
  24. USART_WR_BUF[0]= Probe_ConnectState & 0xff;
  25. USART_WR_BUF[1]= Probe_ButtonState & 0xff;
  26. USART6_Send(CMD0x31_Request_ReadBack_ProbeStatus,dataBytes,bIsContentBitInverted_SendBack);
  27. Last_Probe_ConnectState = Probe_ConnectState;
  28. Last_Probe_ButtonState = Probe_ButtonState;
  29. #endif
  30. }
  31. void CMD0x31_Request_ReadBack_ProbeStatus_process(u8 *pData,u16 dataLen,u8 bIsContentBitInverted_Recv,u8 bIsContentBitInverted_SendBack)
  32. {
  33. Timer_ReadBack_ProbeStatus(1,bIsContentBitInverted_SendBack);
  34. }