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.

59 lines
1.1 KiB

11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
  1. #pragma once
  2. #include "uappbase/base.hpp"
  3. #include "ucomponents/eeprom/m24m02_i2c_eeprom.hpp"
  4. namespace iflytop {
  5. class AppHardware {
  6. private:
  7. /* data */
  8. public:
  9. TMC51X0 MOTO1;
  10. TMC51X0 MOTO2;
  11. TMC51X0 MOTO3;
  12. TMC51X0 MOTO4;
  13. ZGPIO MOTO_POWER_EN;
  14. ZGPIO MOTO1_CSN;
  15. ZGPIO MOTO2_CSN;
  16. ZGPIO MOTO3_CSN;
  17. ZGPIO MOTO4_CSN;
  18. ZGPIO MOTO1_DRV_ENN;
  19. ZGPIO MOTO2_DRV_ENN;
  20. ZGPIO MOTO3_DRV_ENN;
  21. ZGPIO MOTO4_DRV_ENN;
  22. ZGPIO ID1;
  23. ZGPIO ID2;
  24. ZGPIO ID3;
  25. ZGPIO ID4;
  26. ZGPIO ID5;
  27. ZGPIO IO_OUT1;
  28. ZGPIO IO_OUT2;
  29. ZGPIO BLE_CONNECTED_STATE_IO_PE6;
  30. UART_HandleTypeDef* tjcUart;
  31. UART_HandleTypeDef* remoteContolerUart;
  32. M24M02_I2C_EEPROM eeprom;
  33. bool hardwareInitedOK = false;;
  34. static AppHardware* ins() {
  35. static AppHardware instance;
  36. return &instance;
  37. }
  38. void initialize();
  39. TMC51X0* getPump(int32_t index) {
  40. if (index == 0) return &MOTO1;
  41. if (index == 1) return &MOTO2;
  42. if (index == 2) return &MOTO3;
  43. if (index == 3) return &MOTO4;
  44. ZASSERT(false);
  45. return nullptr;
  46. }
  47. bool isHardInitOk();
  48. };
  49. } // namespace iflytop