dio(5579).h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. #ifndef __HS_DIO_H
  2. #define __HS_DIO_H
  3. typedef enum
  4. {
  5. LowActive = 0,
  6. HighActive
  7. }LowHighActive;
  8. struct stHSDIOTask__{
  9. char DORunFlag;
  10. char DIRunFlag;
  11. unsigned char DISecCount;
  12. int DORunPeriodTime;
  13. int DIRunPeriodTime;
  14. };
  15. typedef struct stHSDIOTask__ stHSDIOTask;
  16. typedef struct stHSDIn__{
  17. unsigned char in;
  18. unsigned char onFlag;
  19. unsigned char softRelease;
  20. unsigned char pressedSec;
  21. //unsigned char SecCount;
  22. unsigned int pressTime;
  23. unsigned int longPressTimeOne;
  24. unsigned int longPressTimeKeep;
  25. unsigned int prevTime;
  26. unsigned int pressCount;
  27. unsigned int longPressCount;
  28. void (*Pressed)(struct stHSDIn__*);
  29. void (*Released)(struct stHSDIn__*);
  30. void (*LongPressedOne)(struct stHSDIn__*);
  31. void (*LongPressedKeep)(struct stHSDIn__*);
  32. }stHSDIn;
  33. struct stHSDOut__{
  34. uint8_t Mode; // 1:Normal, 2:Repeate, 3:Toggle
  35. uint8_t LimitMode;
  36. uint8_t Trigger;
  37. uint8_t Out;
  38. uint8_t Run;
  39. uint8_t StartFalg;
  40. uint8_t Err;
  41. uint8_t DischageEnable;
  42. int DischargeTimer;
  43. int32_t AliveTimer;
  44. int32_t AliveCounter; // Not used : -1
  45. int32_t OnDelay;
  46. int32_t StopFuncDelay;
  47. int32_t StopFuncDelaySet;
  48. int32_t RefleshTime;
  49. int32_t OnTime;
  50. int32_t OffTime;
  51. int32_t PulseCounter;
  52. int32_t UpdateTime; // MODE3-timer for on/off switching MODE1-Trigger Repeat
  53. uint32_t PrevTick;
  54. void (*StartFunc)(struct stHSDOut__*);
  55. void (*StopFunc)(struct stHSDOut__*);
  56. void (*OptFunc)(struct stHSDOut__*);
  57. void (*UpdateFunc)(struct stHSDOut__*);
  58. };
  59. typedef struct stHSDOut__ stHSDOut;
  60. int DITask();
  61. int DOTask();
  62. void DioTask();
  63. #if 0
  64. void HSDataBitInit();
  65. void HSDOutInit();
  66. void HSDOutProcess(stHSDOut* DOut, const stDIOPortMap* PinMap, int Len);
  67. void HSDInInit();
  68. void HSDInRun(stHSDIn* DIn, const stDIOPortMap* PinMap, int Len);
  69. void HOT_1_Init( char output );
  70. void HSDataBitInRun(stHSDIn* DIn, uint32_t DataBit, int Len);
  71. void HSDOut_0_Start(stHSDOut* pDout);
  72. void HSDOut_0_Stop(stHSDOut* pDout);
  73. void HSDOut_0_Opt(stHSDOut* pDout);
  74. void HSDOut_1_Start(stHSDOut* pDout);
  75. void HSDOut_1_Stop(stHSDOut* pDout);
  76. void HSDOut_1_Opt(stHSDOut* pDout);
  77. void HSDOut_2_Start(stHSDOut* pDout);
  78. void HSDOut_2_Stop(stHSDOut* pDout);
  79. void HSDOut_2_Opt(stHSDOut* pDout);
  80. #endif
  81. void Key_0_Pressed(stHSDIn* pDin);
  82. void Key_0_Released(stHSDIn* pDin);
  83. void Key_1_Pressed(stHSDIn* pDin);
  84. void Key_1_Released(stHSDIn* pDin);
  85. void Key_2_Pressed(stHSDIn* pDin);
  86. void Key_2_Released(stHSDIn* pDin);
  87. void Key_3_Pressed(stHSDIn* pDin);
  88. void Key_3_Released(stHSDIn* pDin);
  89. void Key_4_Pressed(stHSDIn* pDin);
  90. void Key_4_Released(stHSDIn* pDin);
  91. void DevRegLongPressedOne(stHSDIn* pDin);
  92. void TriggerEmg();
  93. void TriggerLineTest();
  94. void TriggerRegDev();
  95. #if 0
  96. void Key_5_Pressed(stHSDIn* pDin);
  97. void Key_5_Released(stHSDIn* pDin);
  98. void Key_6_Pressed(stHSDIn* pDin);
  99. void Key_6_Released(stHSDIn* pDin);
  100. void Key_7_Pressed(stHSDIn* pDin);
  101. void Key_7_Released(stHSDIn* pDin);
  102. void Key_8_Pressed(stHSDIn* pDin);
  103. void Key_8_Released(stHSDIn* pDin);
  104. void Key_9_Pressed(stHSDIn* pDin);
  105. void Key_9_Released(stHSDIn* pDin);
  106. void Key_10_Pressed(stHSDIn* pDin);
  107. void Key_10_Released(stHSDIn* pDin);
  108. void Key_11_Pressed(stHSDIn* pDin);
  109. void Key_11_Released(stHSDIn* pDin);
  110. void Key_12_Pressed(stHSDIn* pDin);
  111. void Key_12_Released(stHSDIn* pDin);
  112. void Key_13_Pressed(stHSDIn* pDin);
  113. void Key_13_Released(stHSDIn* pDin);
  114. void Key_14_Pressed(stHSDIn* pDin);
  115. void Key_14_Released(stHSDIn* pDin);
  116. void Key_15_Pressed(stHSDIn* pDin);
  117. void Key_15_Released(stHSDIn* pDin);
  118. void Key_16_Pressed(stHSDIn* pDin);
  119. void Key_16_Released(stHSDIn* pDin);
  120. void Key_17_Pressed(stHSDIn* pDin);
  121. void Key_17_Released(stHSDIn* pDin);
  122. #endif
  123. extern uint32_t ADCCurrent[];
  124. extern uint32_t ADCCurrentPos;
  125. extern float SetAmp;
  126. extern char SetAmpUpdate;
  127. extern stHSDOut HSDOut[];
  128. extern stHSDIOTask HSDIOTask;
  129. extern uint32_t TimeSlice[];
  130. extern char Key1Flag;
  131. extern void Buzzer_Select(uint8_t state);
  132. #endif