alignstartup.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /************************************************************************
  2. Project: Welling Motor Control Paltform
  3. Filename: alignstartup.h
  4. Partner Filename: alignstartup.c
  5. Description: The header file of asr.c
  6. Complier: IAR Embedded Workbench for ARM 7.80, IAR Systems.
  7. CPU TYPE : GD32F3x0
  8. *************************************************************************
  9. Copyright (c) 2018 Welling Motor Technology(Shanghai) Co. Ltd.
  10. All rights reserved.
  11. *************************************************************************
  12. *************************************************************************
  13. Revising History (ECL of this file):
  14. ************************************************************************/
  15. #include "typedefine.h"
  16. /************************************************************************
  17. Beginning of File, do not put anything above here except notes
  18. Compiler Directives:
  19. *************************************************************************/
  20. #ifndef ALIGN_H
  21. #define ALIGN_H
  22. /************************************************************************
  23. Compiler Directives (N/A)
  24. *************************************************************************/
  25. #ifdef _ALIGN_C_
  26. #define _ALIGN_EXT
  27. #else
  28. #define _ALIGN_EXT extern
  29. #endif
  30. /************************************************************************
  31. Definitions & Macros (#define ...)
  32. *************************************************************************/
  33. #define ALIGN_COF_DEFAULT \
  34. { \
  35. 0, 0, 0 \
  36. } // Default value of ASR_SPDPI_COF
  37. #define ALIGN_OUT_DEFAULT \
  38. { \
  39. 0, 0, 0, 0 \
  40. } // Default value of ASR_SPDPI_OUT
  41. /************************************************************************
  42. global varibles Macros (#define ...)
  43. *************************************************************************/
  44. /************************************************************************
  45. TypeDefs & Structure defines
  46. *************************************************************************/
  47. typedef struct
  48. { // Input of " acr_voCurPI "
  49. ULONG ulStatCt; // Q14, Current reference
  50. SWORD swRotateDir; // Q14, Current feedback
  51. SWORD swCurRefrompu; // Q12, Voltage output maximum limit
  52. UWORD uwObsElecThetaPu;
  53. } ALIGN_IN;
  54. typedef struct
  55. { // Output of " acr_voCurPI "
  56. ULONG ulStatCt; // Q14, Output voltage feedback
  57. UWORD uwAngSwitchK;
  58. SLONG slIdRefPu; // Q26, Output voltage feedback
  59. SWORD swIdRefPu; // Q14, Error recorder
  60. SLONG slIqRefPu; // Q26, Output voltage feedback
  61. SWORD swIqRefPu; // Q14, Error recorder
  62. SLONG slDragSpdRefPu;
  63. SLONG slDragSpdPu;
  64. SLONG slAngManuPu;
  65. UWORD uwAngManuPu;
  66. UWORD uwAngRefPu;
  67. BOOL blStartUpOvrFlg;
  68. BOOL blCurSwitchOvrFlg;
  69. BOOL blAngSwitchOvrFlg;
  70. } ALIGN_OUT;
  71. typedef struct
  72. { // Input of " acr_voCurPI "
  73. UWORD uwAlignCurPu;
  74. ULONG ulAlignRampTbcCt; // Q12, Current coefficient of proportion
  75. ULONG ulAlignHoldTbcCt;
  76. ULONG ulAlignCurIncPerTbcPu; // Q15, Current coefficient of Integral
  77. UWORD uwDragCurPu; // Q15, Active Resistance
  78. ULONG ulDragSpdIncPerTbcPu;
  79. ULONG ulOpen2ClzCurIncPerTbcPu;
  80. ULONG ulDragSpdRampTbcCt;
  81. SLONG uwDragSpdPu;
  82. SLONG slAlignAngInit;
  83. ULONG ulOpen2ClzCurRampTbcCt;
  84. UWORD uwSPIreadOnceCt;
  85. } ALIGN_COF;
  86. /************************************************************************
  87. Exported Variables:
  88. *************************************************************************/
  89. #ifdef _ALIGN_C_
  90. _ALIGN_EXT ALIGN_COF align_stCoef = ALIGN_COF_DEFAULT;
  91. _ALIGN_EXT ALIGN_OUT align_stOut = ALIGN_OUT_DEFAULT;
  92. #else
  93. _ALIGN_EXT ALIGN_COF align_stCoef;
  94. _ALIGN_EXT ALIGN_OUT align_stOut;
  95. #endif
  96. /************************************************************************
  97. RAM ALLOCATION:
  98. *************************************************************************/
  99. #define align_stIn (*(ALIGN_IN *)TBC_BUFFER)
  100. /************************************************************************
  101. Exported Function Call Prototypes (N/A)
  102. *************************************************************************/
  103. #ifdef _ALIGN_C_
  104. _ALIGN_EXT void align_voInitPos(ALIGN_IN *in, ALIGN_COF *coef, ALIGN_OUT *out);
  105. _ALIGN_EXT void align_voStartUp(ALIGN_IN *in, ALIGN_COF *coef, ALIGN_OUT *out);
  106. _ALIGN_EXT void align_voOpen2Clz(ALIGN_IN *in, ALIGN_COF *coef, ALIGN_OUT *out);
  107. _ALIGN_EXT void align_voCoef();
  108. _ALIGN_EXT void align_voInit(void);
  109. #else
  110. _ALIGN_EXT void align_voInitPos(ALIGN_IN *in, ALIGN_COF *coef, ALIGN_OUT *out);
  111. _ALIGN_EXT void align_voStartUp(ALIGN_IN *in, ALIGN_COF *coef, ALIGN_OUT *out);
  112. _ALIGN_EXT void align_voOpen2Clz(ALIGN_IN *in, ALIGN_COF *coef, ALIGN_OUT *out);
  113. _ALIGN_EXT void align_voCoef();
  114. _ALIGN_EXT void align_voInit(void);
  115. #endif
  116. /************************************************************************
  117. Flag Define (N/A)
  118. *************************************************************************/
  119. #endif
  120. /************************************************************************
  121. Copyright (c) 2018 Welling Motor Technology(Shanghai) Co. Ltd.
  122. All rights reserved.
  123. *************************************************************************
  124. End of this File (EOF)!
  125. Do not put anything after this part!
  126. *************************************************************************/