基质喷涂
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

135 lines
2.6 KiB

3 weeks ago
3 weeks ago
3 weeks ago
  1. #pragma once
  2. #include "can_control/can_controller.h"
  3. #include "LED/pump_controller.h"
  4. #include "LED/air_valve.h"
  5. #include "LED/three_way_valve.h"
  6. #include "LED/high_voltage_pack.h"
  7. #include "LED/laser_control.h"
  8. #include "zgpio.hpp"
  9. #include "appcfg.h"
  10. #include "stm32components.hpp"
  11. #include "LED/temp_control.h"
  12. #include "uart_control/uart_control.h"
  13. namespace iflytop {
  14. class ID {
  15. public:
  16. ZGPIO ID0;
  17. ZGPIO ID1;
  18. ZGPIO ID2;
  19. ZGPIO ID3;
  20. ZGPIO ID4;
  21. };
  22. class AppHardware {
  23. private:
  24. /* data */
  25. public:
  26. ZGPIO MOTO_POWER_EN;
  27. ZGPIO MOTO1_CSN;
  28. ZGPIO MOTO2_CSN;
  29. ZGPIO MOTO3_CSN;
  30. ZGPIO MOTO4_CSN;
  31. ZGPIO MOTO1_DRV_ENN;
  32. ZGPIO MOTO2_DRV_ENN;
  33. ZGPIO MOTO3_DRV_ENN;
  34. ZGPIO MOTO4_DRV_ENN;
  35. ZGPIO MOTOR1_REF_L;
  36. ZGPIO MOTOR1_REF_R;
  37. ZGPIO MOTOR2_REF_L;
  38. ZGPIO MOTOR2_REF_R;
  39. ZGPIO MOTOR3_REF_L;
  40. ZGPIO MOTOR3_REF_R;
  41. ZGPIO MOTOR4_REF_L;
  42. ZGPIO MOTOR4_REF_R;
  43. TMC51X0 MOTO1;
  44. TMC51X0 MOTO2;
  45. TMC51X0 MOTO3;
  46. // TMC51X0 MOTO4;
  47. ID id;
  48. ZGPIO IO_OUT1;
  49. ZGPIO IO_OUT2;
  50. ZGPIO BLE_CONNECTED_STATE;
  51. UART_HandleTypeDef* tjcUart;
  52. ZGPIO TJC_UART_CH_SEL;
  53. ZGPIO TJC_UART_CH_EN;
  54. UART_HandleTypeDef* remoteContolerUart;
  55. #if CAN_MODULE_ENABLE
  56. CanController can0Controller; // CAN 收发控制
  57. #endif
  58. UartControl uart_control;
  59. AirValve valve_controller; // 阀门控制
  60. ThreeWayValve three_way_valve; // 三通阀控制
  61. PumpController pump_controller; // 电机泵
  62. HighVoltagePack high_voltage_pack; // 注射泵
  63. LaserControl laser_control; // 激光
  64. TempControl temp_control_nozzle; // 喷嘴温度控制
  65. TempControl temp_control_slide; // 拨片温度控制
  66. bool hardwareInitedOK = false;
  67. static AppHardware* ins() {
  68. static AppHardware instance;
  69. return &instance;
  70. }
  71. AppHardware();
  72. void initialize();
  73. TMC51X0* getPump(int32_t index) {
  74. if (index == 0) return &MOTO1;
  75. if (index == 1) return &MOTO2;
  76. if (index == 2) return &MOTO3;
  77. ZASSERT(false);
  78. return nullptr;
  79. }
  80. bool isHardInitOk();
  81. void SystemPowerOn();
  82. void SystemPowerOff(bool is_force = false);
  83. void setTJCScreenInDownloadMode();
  84. void setE_Stop(bool isE_Stop);
  85. bool isE_Stop();
  86. void toggleLaunched();
  87. bool isLaunched();
  88. bool isStarted();
  89. void setFlowSpeed(uint16_t flowSpeed);
  90. void setHumidity(int16_t humidity);
  91. void setTemp(int16_t temp);
  92. uint16_t getFlowSpeed();
  93. int16_t getHumidity();
  94. int16_t getTemp();
  95. private:
  96. bool isLaunched_ { false };
  97. bool isE_Stop_ { false };
  98. bool isStarted_;
  99. osMutexId_t mutex_; // 锁
  100. uint16_t flowSpeed_; // 流速
  101. int16_t humidity_; // 湿度
  102. int16_t temp_; // 温度
  103. };
  104. } // namespace iflytop