基质喷涂
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.

115 lines
2.1 KiB

  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. namespace iflytop {
  12. class ID {
  13. public:
  14. ZGPIO ID0;
  15. ZGPIO ID1;
  16. ZGPIO ID2;
  17. ZGPIO ID3;
  18. ZGPIO ID4;
  19. };
  20. class AppHardware {
  21. private:
  22. /* data */
  23. public:
  24. ZGPIO MOTO_POWER_EN;
  25. ZGPIO MOTO1_CSN;
  26. ZGPIO MOTO2_CSN;
  27. ZGPIO MOTO3_CSN;
  28. ZGPIO MOTO4_CSN;
  29. ZGPIO MOTO1_DRV_ENN;
  30. ZGPIO MOTO2_DRV_ENN;
  31. ZGPIO MOTO3_DRV_ENN;
  32. ZGPIO MOTO4_DRV_ENN;
  33. ZGPIO MOTOR1_REF_L;
  34. ZGPIO MOTOR1_REF_R;
  35. ZGPIO MOTOR2_REF_L;
  36. ZGPIO MOTOR2_REF_R;
  37. ZGPIO MOTOR3_REF_L;
  38. ZGPIO MOTOR3_REF_R;
  39. ZGPIO MOTOR4_REF_L;
  40. ZGPIO MOTOR4_REF_R;
  41. TMC51X0 MOTO1;
  42. TMC51X0 MOTO2;
  43. TMC51X0 MOTO3;
  44. // TMC51X0 MOTO4;
  45. ID id;
  46. ZGPIO IO_OUT1;
  47. ZGPIO IO_OUT2;
  48. ZGPIO BLE_CONNECTED_STATE;
  49. UART_HandleTypeDef* tjcUart;
  50. ZGPIO TJC_UART_CH_SEL;
  51. ZGPIO TJC_UART_CH_EN;
  52. UART_HandleTypeDef* remoteContolerUart;
  53. CanController can0Controller; // CAN 收发控制
  54. AirValve valve_controller; // 阀门控制
  55. ThreeWayValve three_way_valve; // 三通阀控制
  56. PumpController pump_controller; // 电机泵
  57. HighVoltagePack high_voltage_pack; // 注射泵
  58. LaserControl laser_control; // 激光
  59. bool hardwareInitedOK = false;
  60. static AppHardware* ins() {
  61. static AppHardware instance;
  62. return &instance;
  63. }
  64. AppHardware();
  65. void initialize();
  66. TMC51X0* getPump(int32_t index) {
  67. if (index == 0) return &MOTO1;
  68. if (index == 1) return &MOTO2;
  69. if (index == 2) return &MOTO3;
  70. ZASSERT(false);
  71. return nullptr;
  72. }
  73. bool isHardInitOk();
  74. void SystemPowerOn();
  75. void SystemPowerOff();
  76. void setTJCScreenInDownloadMode();
  77. void setE_Stop(bool isE_Stop);
  78. bool isE_Stop();
  79. void toggleLaunched();
  80. bool isLaunched();
  81. bool isStarted();
  82. private:
  83. bool isLaunched_ { false };
  84. bool isE_Stop_ { false };
  85. bool isStarted_;
  86. };
  87. } // namespace iflytop