user_interface.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443
  1. /**
  2. ******************************************************************************
  3. * @file user_interface.h
  4. * @author Motor Control SDK Team, ST Microelectronics
  5. * @brief This file contains all definitions and functions prototypes for the
  6. * user interface component of the Motor Control SDK.
  7. ******************************************************************************
  8. * @attention
  9. *
  10. * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
  11. * All rights reserved.</center></h2>
  12. *
  13. * This software component is licensed by ST under Ultimate Liberty license
  14. * SLA0044, the "License"; You may not use this file except in compliance with
  15. * the License. You may obtain a copy of the License at:
  16. * www.st.com/SLA0044
  17. *
  18. ******************************************************************************
  19. * @ingroup MCUI
  20. */
  21. /* Define to prevent recursive inclusion -------------------------------------*/
  22. #ifndef __USERINTERFACE_H
  23. #define __USERINTERFACE_H
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif /* __cplusplus */
  27. /* Includes ------------------------------------------------------------------*/
  28. #include "mc_type.h"
  29. #include "mc_interface.h"
  30. #include "mc_tuning.h"
  31. #include "state_machine.h"
  32. /** @addtogroup MCSDK
  33. * @{
  34. */
  35. /** @addtogroup MCUI
  36. * @{
  37. */
  38. /* Exported types ------------------------------------------------------------*/
  39. /**
  40. * @brief Motor control protocol registers
  41. *
  42. * Enumerates the variables and information that can be exchanged across the Motor Control Protocol
  43. */
  44. typedef enum
  45. {
  46. MC_PROTOCOL_REG_TARGET_MOTOR, /* 0 */
  47. MC_PROTOCOL_REG_FLAGS, /* 1 */
  48. MC_PROTOCOL_REG_STATUS, /* 2 */
  49. MC_PROTOCOL_REG_CONTROL_MODE, /* 3 */
  50. MC_PROTOCOL_REG_SPEED_REF, /* 4 */
  51. MC_PROTOCOL_REG_SPEED_KP, /* 5 */
  52. MC_PROTOCOL_REG_SPEED_KI, /* 6 */
  53. MC_PROTOCOL_REG_SPEED_KD, /* 7 */
  54. MC_PROTOCOL_REG_TORQUE_REF, /* 8 */
  55. MC_PROTOCOL_REG_TORQUE_KP, /* 9 */
  56. MC_PROTOCOL_REG_TORQUE_KI, /* 10 */
  57. MC_PROTOCOL_REG_TORQUE_KD, /* 11 */
  58. MC_PROTOCOL_REG_FLUX_REF, /* 12 */
  59. MC_PROTOCOL_REG_FLUX_KP, /* 13 */
  60. MC_PROTOCOL_REG_FLUX_KI, /* 14 */
  61. MC_PROTOCOL_REG_FLUX_KD, /* 15 */
  62. MC_PROTOCOL_REG_OBSERVER_C1, /* 16 */
  63. MC_PROTOCOL_REG_OBSERVER_C2, /* 17 */
  64. MC_PROTOCOL_REG_OBSERVER_CR_C1, /* 18 */
  65. MC_PROTOCOL_REG_OBSERVER_CR_C2, /* 19 */
  66. MC_PROTOCOL_REG_PLL_KI, /* 20 */
  67. MC_PROTOCOL_REG_PLL_KP, /* 21 */
  68. MC_PROTOCOL_REG_FLUXWK_KP, /* 22 */
  69. MC_PROTOCOL_REG_FLUXWK_KI, /* 23 */
  70. MC_PROTOCOL_REG_FLUXWK_BUS, /* 24 */
  71. MC_PROTOCOL_REG_BUS_VOLTAGE, /* 25 */
  72. MC_PROTOCOL_REG_HEATS_TEMP, /* 26 */
  73. MC_PROTOCOL_REG_MOTOR_POWER, /* 27 */
  74. MC_PROTOCOL_REG_DAC_OUT1, /* 28 */
  75. MC_PROTOCOL_REG_DAC_OUT2, /* 29 */
  76. MC_PROTOCOL_REG_SPEED_MEAS, /* 30 */
  77. MC_PROTOCOL_REG_TORQUE_MEAS, /* 31 */
  78. MC_PROTOCOL_REG_FLUX_MEAS, /* 32 */
  79. MC_PROTOCOL_REG_FLUXWK_BUS_MEAS, /* 33 */
  80. MC_PROTOCOL_REG_RUC_STAGE_NBR, /* 34 */
  81. MC_PROTOCOL_REG_I_A, /* 35 */
  82. MC_PROTOCOL_REG_I_B, /* 36 */
  83. MC_PROTOCOL_REG_I_ALPHA, /* 37 */
  84. MC_PROTOCOL_REG_I_BETA, /* 38 */
  85. MC_PROTOCOL_REG_I_Q, /* 39 */
  86. MC_PROTOCOL_REG_I_D, /* 40 */
  87. MC_PROTOCOL_REG_I_Q_REF, /* 41 */
  88. MC_PROTOCOL_REG_I_D_REF, /* 42 */
  89. MC_PROTOCOL_REG_V_Q, /* 43 */
  90. MC_PROTOCOL_REG_V_D, /* 44 */
  91. MC_PROTOCOL_REG_V_ALPHA, /* 45 */
  92. MC_PROTOCOL_REG_V_BETA, /* 46 */
  93. MC_PROTOCOL_REG_MEAS_EL_ANGLE, /* 47 */
  94. MC_PROTOCOL_REG_MEAS_ROT_SPEED, /* 48 */
  95. MC_PROTOCOL_REG_OBS_EL_ANGLE, /* 49 */
  96. MC_PROTOCOL_REG_OBS_ROT_SPEED, /* 50 */
  97. MC_PROTOCOL_REG_OBS_I_ALPHA, /* 51 */
  98. MC_PROTOCOL_REG_OBS_I_BETA, /* 52 */
  99. MC_PROTOCOL_REG_OBS_BEMF_ALPHA, /* 53 */
  100. MC_PROTOCOL_REG_OBS_BEMF_BETA, /* 54 */
  101. MC_PROTOCOL_REG_OBS_CR_EL_ANGLE, /* 55 */
  102. MC_PROTOCOL_REG_OBS_CR_ROT_SPEED, /* 56 */
  103. MC_PROTOCOL_REG_OBS_CR_I_ALPHA, /* 57 */
  104. MC_PROTOCOL_REG_OBS_CR_I_BETA, /* 58 */
  105. MC_PROTOCOL_REG_OBS_CR_BEMF_ALPHA, /* 59 */
  106. MC_PROTOCOL_REG_OBS_CR_BEMF_BETA, /* 60 */
  107. MC_PROTOCOL_REG_DAC_USER1, /* 61 */
  108. MC_PROTOCOL_REG_DAC_USER2, /* 62 */
  109. MC_PROTOCOL_REG_MAX_APP_SPEED, /* 63 */
  110. MC_PROTOCOL_REG_MIN_APP_SPEED, /* 64 */
  111. MC_PROTOCOL_REG_IQ_SPEEDMODE, /* 65 */
  112. MC_PROTOCOL_REG_EST_BEMF_LEVEL, /* 66 */
  113. MC_PROTOCOL_REG_OBS_BEMF_LEVEL, /* 67 */
  114. MC_PROTOCOL_REG_EST_CR_BEMF_LEVEL, /* 68 */
  115. MC_PROTOCOL_REG_OBS_CR_BEMF_LEVEL, /* 69 */
  116. MC_PROTOCOL_REG_FF_1Q, /* 70 */
  117. MC_PROTOCOL_REG_FF_1D, /* 71 */
  118. MC_PROTOCOL_REG_FF_2, /* 72 */
  119. MC_PROTOCOL_REG_FF_VQ, /* 73 */
  120. MC_PROTOCOL_REG_FF_VD, /* 74 */
  121. MC_PROTOCOL_REG_FF_VQ_PIOUT, /* 75 */
  122. MC_PROTOCOL_REG_FF_VD_PIOUT, /* 76 */
  123. MC_PROTOCOL_REG_PFC_STATUS, /* 77 */
  124. MC_PROTOCOL_REG_PFC_FAULTS, /* 78 */
  125. MC_PROTOCOL_REG_PFC_DCBUS_REF, /* 79 */
  126. MC_PROTOCOL_REG_PFC_DCBUS_MEAS, /* 80 */
  127. MC_PROTOCOL_REG_PFC_ACBUS_FREQ, /* 81 */
  128. MC_PROTOCOL_REG_PFC_ACBUS_RMS, /* 82 */
  129. MC_PROTOCOL_REG_PFC_I_KP, /* 83 */
  130. MC_PROTOCOL_REG_PFC_I_KI, /* 84 */
  131. MC_PROTOCOL_REG_PFC_I_KD, /* 85 */
  132. MC_PROTOCOL_REG_PFC_V_KP, /* 86 */
  133. MC_PROTOCOL_REG_PFC_V_KI, /* 87 */
  134. MC_PROTOCOL_REG_PFC_V_KD, /* 88 */
  135. MC_PROTOCOL_REG_PFC_STARTUP_DURATION, /* 89 */
  136. MC_PROTOCOL_REG_PFC_ENABLED, /* 90 */
  137. MC_PROTOCOL_REG_RAMP_FINAL_SPEED, /* 91 */
  138. MC_PROTOCOL_REG_RAMP_DURATION, /* 92 */
  139. MC_PROTOCOL_REG_HFI_EL_ANGLE, /* 93 */
  140. MC_PROTOCOL_REG_HFI_ROT_SPEED, /* 94 */
  141. MC_PROTOCOL_REG_HFI_CURRENT, /* 95 */
  142. MC_PROTOCOL_REG_HFI_INIT_ANG_PLL, /* 96 */
  143. MC_PROTOCOL_REG_HFI_INIT_ANG_SAT_DIFF, /* 97 */
  144. MC_PROTOCOL_REG_HFI_PI_PLL_KP, /* 98 */
  145. MC_PROTOCOL_REG_HFI_PI_PLL_KI, /* 99 */
  146. MC_PROTOCOL_REG_HFI_PI_TRACK_KP, /* 100 */
  147. MC_PROTOCOL_REG_HFI_PI_TRACK_KI, /* 101 */
  148. MC_PROTOCOL_REG_SC_CHECK, /* 102 */
  149. MC_PROTOCOL_REG_SC_STATE, /* 103 */
  150. MC_PROTOCOL_REG_SC_RS, /* 104 */
  151. MC_PROTOCOL_REG_SC_LS, /* 105 */
  152. MC_PROTOCOL_REG_SC_KE, /* 106 */
  153. MC_PROTOCOL_REG_SC_VBUS, /* 107 */
  154. MC_PROTOCOL_REG_SC_MEAS_NOMINALSPEED, /* 108 */
  155. MC_PROTOCOL_REG_SC_STEPS, /* 109 */
  156. MC_PROTOCOL_REG_SPEED_KP_DIV, /* 110 */
  157. MC_PROTOCOL_REG_SPEED_KI_DIV, /* 111 */
  158. MC_PROTOCOL_REG_UID, /* 112 */
  159. MC_PROTOCOL_REG_HWTYPE, /* 113 */
  160. MC_PROTOCOL_REG_CTRBDID, /* 114 */
  161. MC_PROTOCOL_REG_PWBDID, /* 115 */
  162. MC_PROTOCOL_REG_SC_PP, /* 116 */
  163. MC_PROTOCOL_REG_SC_CURRENT, /* 117 */
  164. MC_PROTOCOL_REG_SC_SPDBANDWIDTH, /* 118 */
  165. MC_PROTOCOL_REG_SC_LDLQRATIO, /* 119 */
  166. MC_PROTOCOL_REG_SC_NOMINAL_SPEED, /* 120 */
  167. MC_PROTOCOL_REG_SC_CURRBANDWIDTH, /* 121 */
  168. MC_PROTOCOL_REG_SC_J, /* 122 */
  169. MC_PROTOCOL_REG_SC_F, /* 123 */
  170. MC_PROTOCOL_REG_SC_MAX_CURRENT, /* 124 */
  171. MC_PROTOCOL_REG_SC_STARTUP_SPEED, /* 125 */
  172. MC_PROTOCOL_REG_SC_STARTUP_ACC, /* 126 */
  173. MC_PROTOCOL_REG_SC_PWM_FREQUENCY, /* 127 */
  174. MC_PROTOCOL_REG_SC_FOC_REP_RATE, /* 128 */
  175. MC_PROTOCOL_REG_PWBDID2, /* 129 */
  176. MC_PROTOCOL_REG_SC_COMPLETED, /* 130 */
  177. MC_PROTOCOL_REG_CURRENT_POSITION, /* 131 */
  178. MC_PROTOCOL_REG_TARGET_POSITION, /* 132 */
  179. MC_PROTOCOL_REG_MOVE_DURATION, /* 133 */
  180. MC_PROTOCOL_REG_POSITION_KP, /* 134 */
  181. MC_PROTOCOL_REG_POSITION_KI, /* 135 */
  182. MC_PROTOCOL_REG_POSITION_KD, /* 136 */
  183. MC_PROTOCOL_REG_UNDEFINED
  184. } MC_Protocol_REG_t;
  185. /* @brief To configure the UI use MAIN Sensor (4bit)|AUX Sensor (4 bit) as first byte of CFG.*/
  186. #define UI_SCODE_NONE 0x0u
  187. #define UI_SCODE_HALL 0x1u /*!< This code identifies the Hall sensor.*/
  188. #define UI_SCODE_ENC 0x2u /*!< This code identifies the Encoder sensor.*/
  189. #define UI_SCODE_STO_PLL 0x9u /*!< This code identifies the State observer + PLL sensor.*/
  190. #define UI_SCODE_STO_CR 0xAu /*!< This code identifies the State observer + CORDIC sensor.*/
  191. #define UI_SCODE_HFINJ 0xBu /*!< This code identifies the HF injection sensor.*/
  192. #define UI_CFGOPT_NONE 0x00000000u /*!< Enable this option when no other
  193. option is selected.*/
  194. #define UI_CFGOPT_FW 0x00000001u /*!< Enable this option when the flux
  195. weakening is enabled in the MC
  196. firmware.*/
  197. #define UI_CFGOPT_SPEED_KD 0x00000002u /*!< Enable this option when the speed
  198. controller has derivative action.
  199. */
  200. #define UI_CFGOPT_Iq_KD 0x00000004u /*!< Enable this option when the Iq
  201. controller has derivative action.
  202. */
  203. #define UI_CFGOPT_Id_KD 0x00000008u /*!< Enable this option when the Id
  204. controller has derivative action.
  205. */
  206. #define UI_CFGOPT_DAC 0x00000010u /*!< Enable this option if a DAC object
  207. will be associated with the UI.*/
  208. #define UI_CFGOPT_SETIDINSPDMODE 0x00000020u /*!< Enable this option to allow setting
  209. the Id reference when MC is in
  210. speed mode.*/
  211. #define UI_CFGOPT_PLLTUNING 0x00000040u /*!< Enable this option to allow setting
  212. the PLL KP and KI.*/
  213. #define UI_CFGOPT_PFC 0x00000080u /*!< Enable this option to allow PFC tuning.*/
  214. #define UI_CFGOPT_PFC_I_KD 0x00000100u /*!< Enable this option when PFC current
  215. controller has derivative action.*/
  216. #define UI_CFGOPT_PFC_V_KD 0x00000200u /*!< Enable this option when PFC voltage
  217. controller has derivative action.*/
  218. #define MC_PROTOCOL_CODE_SET_REG 0x01
  219. #define MC_PROTOCOL_CODE_GET_REG 0x02
  220. #define MC_PROTOCOL_CODE_EXECUTE_CMD 0x03
  221. #define MC_PROTOCOL_CODE_STORE_TOADDR 0x04
  222. #define MC_PROTOCOL_CODE_LOAD_FROMADDR 0x05
  223. #define MC_PROTOCOL_CODE_GET_BOARD_INFO 0x06
  224. #define MC_PROTOCOL_CODE_SET_SPEED_RAMP 0x07
  225. #define MC_PROTOCOL_CODE_GET_REVUP_DATA 0x08
  226. #define MC_PROTOCOL_CODE_SET_REVUP_DATA 0x09
  227. #define MC_PROTOCOL_CODE_SET_CURRENT_REF 0x0A
  228. #define MC_PROTOCOL_CODE_GET_MP_INFO 0x0B
  229. #define MC_PROTOCOL_CODE_GET_FW_VERSION 0x0C
  230. #define MC_PROTOCOL_CODE_SET_TORQUE_RAMP 0x0D
  231. #define MC_PROTOCOL_CODE_SET_POSITION_CMD 0x12
  232. #define MC_PROTOCOL_CMD_START_MOTOR 0x01
  233. #define MC_PROTOCOL_CMD_STOP_MOTOR 0x02
  234. #define MC_PROTOCOL_CMD_STOP_RAMP 0x03
  235. #define MC_PROTOCOL_CMD_RESET 0x04
  236. #define MC_PROTOCOL_CMD_PING 0x05
  237. #define MC_PROTOCOL_CMD_START_STOP 0x06
  238. #define MC_PROTOCOL_CMD_FAULT_ACK 0x07
  239. #define MC_PROTOCOL_CMD_ENCODER_ALIGN 0x08
  240. #define MC_PROTOCOL_CMD_IQDREF_CLEAR 0x09
  241. #define MC_PROTOCOL_CMD_PFC_ENABLE 0x0A
  242. #define MC_PROTOCOL_CMD_PFC_DISABLE 0x0B
  243. #define MC_PROTOCOL_CMD_PFC_FAULT_ACK 0x0C
  244. #define MC_PROTOCOL_CMD_SC_START 0x0D
  245. #define MC_PROTOCOL_CMD_SC_STOP 0x0E
  246. #define CTRBDID 0
  247. #define PWBDID 0
  248. #define MC_UID 883328122
  249. /**
  250. * @brief UserInterface class parameters definition
  251. */
  252. typedef const void UserInterfaceParams_t, *pUserInterfaceParams_t;
  253. /**
  254. * @brief This structure is used to handle an instance of the UI component
  255. *
  256. */
  257. typedef struct UI_Handle UI_Handle_t;
  258. /**
  259. * @brief Polymorphic function. The function called can change in run-time and
  260. * is assigned by the library to one of the callback pointers
  261. * pFctSwitchOffPwm
  262. * pFctSwitchOnPwm
  263. * pFctCurrReadingCalib
  264. * pFctTurnOnLowSides
  265. * pFctRLDetectionModeEnable
  266. * pFctRLDetectionModeDisable
  267. *
  268. *
  269. */
  270. typedef void (*UI_Generic_Cb_t)( UI_Handle_t *pHandle);
  271. /**
  272. * @brief Polymorphic function. The function called can change in run-time and
  273. * is assigned by the library to the callback pointer pFctIrqHandler
  274. *
  275. */
  276. typedef void* (*UI_IrqHandler_Cb_t)( void *pHandle, unsigned char flag, unsigned short rx_data);
  277. /**
  278. * @brief UI_Handle structure used for User Interface
  279. *
  280. */
  281. struct UI_Handle
  282. {
  283. UI_IrqHandler_Cb_t pFctIrqHandler;
  284. uint8_t bDriveNum; /*!< Total number of MC objects.*/
  285. MCI_Handle_t** pMCI; /*!< Pointer of MC interface list.*/
  286. MCT_Handle_t** pMCT; /*!< Pointer of MC tuning list.*/
  287. uint32_t* pUICfg; /*!< Pointer of UI configuration list.*/
  288. uint8_t bSelectedDrive; /*!< Current selected MC object in the list.*/
  289. };
  290. /**
  291. * @brief Initialization of UI object. It perform the link between the UI
  292. * object and the MC interface and MC tuning objects. It must be called
  293. * before the derived class initialization.
  294. */
  295. void UI_Init(UI_Handle_t *pHandle, uint8_t bMCNum, MCI_Handle_t** pMCI, MCT_Handle_t** pMCT, uint32_t* pUICfg);
  296. /**
  297. * @brief It is used to select the MC on which UI operates.
  298. */
  299. bool UI_SelectMC(UI_Handle_t *pHandle,uint8_t bSelectMC);
  300. /**
  301. * @brief It is used to retrive the MC on which UI currently operates.
  302. * @param pHandle pointer on the target component handle.
  303. * @retval uint8_t It returns the currently selected MC, zero based, on which
  304. * UI operates.
  305. */
  306. uint8_t UI_GetSelectedMC(UI_Handle_t *pHandle);
  307. /**
  308. * @brief It is used to retrive the configuration of the MC on which UI
  309. * currently operates.
  310. * @param pHandle pointer on the target component handle.
  311. * @retval uint32_t It returns the currently configuration of selected MC on
  312. * which UI operates.
  313. * It represents a bit field containing one (or more) of
  314. * the exported configuration option UI_CFGOPT_xxx (eventually OR-ed).
  315. */
  316. uint32_t UI_GetSelectedMCConfig(UI_Handle_t *pHandle);
  317. /**
  318. * @brief It is used to execute a SetReg command coming from the user.
  319. * @param pHandle pointer on the target component handle.
  320. * @param bRegID Code of register to be updated. Valid code is one of the
  321. * MC_PROTOCOL_REG_xxx values exported by UserInterfaceClass.
  322. * @param wValue is the new value to be set.
  323. * @retval bool It returns true if the SetReg command has been performed
  324. * succesfully otherwise returns false.
  325. */
  326. bool UI_SetReg(UI_Handle_t *pHandle, MC_Protocol_REG_t bRegID, int32_t wValue);
  327. /**
  328. * @brief It is used to execute a GetReg command coming from the user.
  329. * @param pHandle pointer on the target component handle.
  330. * @param bRegID Code of register to be updated. Valid code is one of the
  331. * MC_PROTOCOL_REG_xxx values exported by UserInterfaceClass.
  332. * @param success if not NULL, the function sets success to true if tregister
  333. * @p bRegID is known bby the application and false otherwise.
  334. *
  335. * @retval int32_t is the current value of register bRegID.
  336. *
  337. * If @p success is set to false by the function, then the return value is meaningless.
  338. */
  339. int32_t UI_GetReg(UI_Handle_t *pHandle, MC_Protocol_REG_t bRegID, bool * success );
  340. /**
  341. * @brief It is used to execute a command coming from the user.
  342. * @param pHandle pointer on the target component handle.
  343. * @param bCmdID Code of register to be updated. Valid code is one of the
  344. * MC_PROTOCOL_CMD_xxx define exported by UserInterfaceClass.
  345. * @retval bool It returns true if the command has been performed
  346. * succesfully otherwise returns false.
  347. */
  348. bool UI_ExecCmd(UI_Handle_t *pHandle, uint8_t bCmdID);
  349. /* Executes a speed ramp command coming from the user.*/
  350. bool UI_ExecSpeedRamp(UI_Handle_t *pHandle, int32_t wFinalMecSpeedUnit, uint16_t hDurationms);
  351. /**
  352. * @brief It is used to execute a torque ramp command coming from the user.
  353. * @param pHandle pointer on the target component handle.
  354. * @param hTargetFinal final torque value. See MCI interface for more
  355. details.
  356. * @param hDurationms the duration of the ramp expressed in milliseconds. It
  357. * is possible to set 0 to perform an instantaneous change in the value.
  358. * @retval bool It returns true if the command has been performed
  359. * succesfully otherwise returns false.
  360. */
  361. bool UI_ExecTorqueRamp(UI_Handle_t *pHandle, int16_t hTargetFinal, uint16_t hDurationms);
  362. /* Executes a get Revup data command coming from the user */
  363. bool UI_GetRevupData(UI_Handle_t *pHandle, uint8_t bStage, uint16_t* pDurationms,
  364. int16_t* pFinalMecSpeedUnit, int16_t* pFinalTorque );
  365. /** Executes a set Revup data command coming from the user. */
  366. bool UI_SetRevupData(UI_Handle_t *pHandle, uint8_t bStage, uint16_t hDurationms,
  367. int16_t hFinalMecSpeedUnit, int16_t hFinalTorque );
  368. /**
  369. * @brief It is used to execute a set current reference command coming from
  370. * the user.
  371. * @param pHandle pointer on the target component handle.
  372. * @param hIqRef is the current Iq reference on qd reference frame. This value
  373. * is expressed in digit. To convert current expressed in digit to
  374. * current expressed in Amps is possible to use the formula:
  375. * Current(Amp) = [Current(digit) * Vdd micro] / [65536 * Rshunt * Aop]
  376. * @param hIdRef is the current Id reference on qd reference frame. This value
  377. * is expressed in digit. See hIqRef param description.
  378. * @retval none.
  379. */
  380. void UI_SetCurrentReferences(UI_Handle_t *pHandle, int16_t hIqRef, int16_t hIdRef);
  381. /**
  382. * @brief Function to get information about MP registers available for each
  383. * step. PC send to the FW the list of steps to get the available
  384. * registers. The FW returs the list of available registers for that
  385. * steps.
  386. * @param stepList List of requested steps.
  387. * @param pMPInfo The returned list of register.
  388. * It is populated by this function.
  389. * @retval true if MP is enabled, false otherwise.
  390. */
  391. bool UI_GetMPInfo(pMPInfo_t stepList, pMPInfo_t MPInfo);
  392. /**
  393. * @}
  394. */
  395. /**
  396. * @}
  397. */
  398. /**
  399. * @}
  400. */
  401. #ifdef __cplusplus
  402. }
  403. #endif /* __cpluplus */
  404. #endif /*__USERINTERFACE_H*/
  405. /************************ (C) COPYRIGHT 2019 STMicroelectronics *****END OF FILE****/