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.

82 lines
1.4 KiB

11 months ago
11 months ago
11 months ago
9 months ago
11 months ago
9 months ago
11 months ago
9 months ago
11 months ago
9 months ago
9 months ago
11 months ago
9 months ago
11 months ago
9 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 ID {
  6. public:
  7. ZGPIO ID0;
  8. ZGPIO ID1;
  9. ZGPIO ID2;
  10. ZGPIO ID3;
  11. ZGPIO ID4;
  12. };
  13. class AppHardware {
  14. private:
  15. /* data */
  16. public:
  17. ZGPIO MOTO_POWER_EN;
  18. ZGPIO MOTO1_CSN;
  19. ZGPIO MOTO2_CSN;
  20. ZGPIO MOTO3_CSN;
  21. ZGPIO MOTO4_CSN;
  22. ZGPIO MOTO1_DRV_ENN;
  23. ZGPIO MOTO2_DRV_ENN;
  24. ZGPIO MOTO3_DRV_ENN;
  25. ZGPIO MOTO4_DRV_ENN;
  26. ZGPIO MOTOR1_REF_L;
  27. ZGPIO MOTOR1_REF_R;
  28. ZGPIO MOTOR2_REF_L;
  29. ZGPIO MOTOR2_REF_R;
  30. ZGPIO MOTOR3_REF_L;
  31. ZGPIO MOTOR3_REF_R;
  32. ZGPIO MOTOR4_REF_L;
  33. ZGPIO MOTOR4_REF_R;
  34. TMC51X0 MOTO1;
  35. TMC51X0 MOTO2;
  36. TMC51X0 MOTO3;
  37. TMC51X0 MOTO4;
  38. ID id;
  39. ZGPIO IO_OUT1;
  40. ZGPIO IO_OUT2;
  41. ZGPIO BLE_CONNECTED_STATE;
  42. UART_HandleTypeDef* tjcUart;
  43. ZGPIO TJC_UART_CH_SEL;
  44. ZGPIO TJC_UART_CH_EN;
  45. UART_HandleTypeDef* remoteContolerUart;
  46. M24M02_I2C_EEPROM eeprom;
  47. bool hardwareInitedOK = false;
  48. ;
  49. static AppHardware* ins() {
  50. static AppHardware instance;
  51. return &instance;
  52. }
  53. void initialize();
  54. TMC51X0* getPump(int32_t index) {
  55. if (index == 0) return &MOTO1;
  56. if (index == 1) return &MOTO2;
  57. if (index == 2) return &MOTO3;
  58. if (index == 3) return &MOTO4;
  59. ZASSERT(false);
  60. return nullptr;
  61. }
  62. bool isHardInitOk();
  63. void setTJCScreenInDownloadMode();
  64. };
  65. } // namespace iflytop