motorcontrol.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /**
  2. ******************************************************************************
  3. * @file motorcontrol.c
  4. * @author Motor Control SDK Team, ST Microelectronics
  5. * @brief Motor Control Subsystem initialization functions.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
  10. * All rights reserved.</center></h2>
  11. *
  12. * This software component is licensed by ST under Ultimate Liberty license
  13. * SLA0044, the "License"; You may not use this file except in compliance with
  14. * the License. You may obtain a copy of the License at:
  15. * www.st.com/SLA0044
  16. *
  17. ******************************************************************************
  18. */
  19. #include "main.h"
  20. #include "mc_tuning.h"
  21. #include "mc_interface.h"
  22. #include "mc_tasks.h"
  23. #include "ui_task.h"
  24. #include "motorcontrol.h"
  25. /** @addtogroup MCSDK
  26. * @{
  27. */
  28. /** @addtogroup MCAPI
  29. * @{
  30. */
  31. #define FIRMWARE_VERS "ST MC SDK\tVer.5.4.4"
  32. const char s_fwVer[32] = FIRMWARE_VERS;
  33. MCI_Handle_t* pMCI[NBR_OF_MOTORS];
  34. MCT_Handle_t* pMCT[NBR_OF_MOTORS];
  35. uint32_t wConfig[NBR_OF_MOTORS] = {UI_CONFIG_M1,UI_CONFIG_M2};
  36. /**
  37. * @brief Initializes and configures the Motor Control Subsystem
  38. *
  39. * This function initializes and configures all the structures and components needed
  40. * for the Motor Control subsystem required by the Application. It expects that
  41. * all the peripherals needed for Motor Control purposes are already configured but
  42. * that their interrupts are not enabled yet.
  43. *
  44. * CubeMX calls this function after all peripherals initializations and
  45. * before the NVIC is configured
  46. */
  47. __weak void MX_MotorControl_Init(void)
  48. {
  49. /* Reconfigure the SysTick interrupt to fire every 500 us. */
  50. HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/SYS_TICK_FREQUENCY);
  51. /* Initialize the Motor Control Subsystem */
  52. MCboot(pMCI,pMCT);
  53. mc_lock_pins();
  54. /* Initialize the MC User Interface */
  55. UI_TaskInit(wConfig,NBR_OF_MOTORS,pMCI,pMCT,s_fwVer);
  56. }
  57. /**
  58. * @}
  59. */
  60. /**
  61. * @}
  62. */
  63. /******************* (C) COPYRIGHT 2019 STMicroelectronics *****END OF FILE****/