position_task.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * position_task.h
  3. *
  4. * Created on: Nov 6, 2024
  5. * Author: jakubski
  6. */
  7. #ifndef INC_POSITION_TASK_H_
  8. #define INC_POSITION_TASK_H_
  9. #include "cmsis_os.h"
  10. #include "main.h"
  11. enum _MovementPhases
  12. {
  13. idlePhase,
  14. startPhase,
  15. speedUpPhase,
  16. movePhase,
  17. slowDownPhase,
  18. stopPhase
  19. };
  20. typedef enum _MovementPhases MovementPhases;
  21. struct _PositionControlTaskInitArg
  22. {
  23. TIM_HandleTypeDef* htim;
  24. TIM_OC_InitTypeDef* motorTimerConfigOC;
  25. uint8_t channel1;
  26. uint8_t channel2;
  27. osTimerId_t motorTimerHandle;
  28. osMessageQueueId_t positionSettingQueue;
  29. uint8_t* switchLimiterUpStat;
  30. uint8_t* switchLimiterDownStat;
  31. uint8_t* switchLimiterCenterStat;
  32. float* currentPosition;
  33. float* positionSetting;
  34. uint8_t* motorStatus;
  35. float* motorPeakCurrent;
  36. char axe;
  37. };
  38. typedef struct _PositionControlTaskInitArg PositionControlTaskInitArg;
  39. struct _PositionControlTaskData
  40. {
  41. float positionSettingValue;
  42. };
  43. typedef struct _PositionControlTaskData PositionControlTaskData;
  44. extern PositionControlTaskInitArg positionXControlTaskInitArg;
  45. extern PositionControlTaskInitArg positionYControlTaskInitArg;
  46. void PositionControlTaskInit(void);
  47. void PositionControlTask (void* argument);
  48. #endif /* INC_POSITION_TASK_H_ */