soft_poweramp.h 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. #ifndef SOFT_POWERAMP_H
  2. #define SOFT_POWERAMP_H
  3. #include "stdint.h"
  4. #include "stdbool.h"
  5. #include "common.h"
  6. ///////////////////
  7. // #define POWERAMP_CRC8_KEY (0x2A)
  8. // /*
  9. // Number Item Data Index Remark
  10. // 1 ����ܵ�ѹ Data[0-1] unsigned int, 16bits�� mV,Range: 0 �C 60000mV
  11. // 2 ��ŵ���� Data[2-3] signed int�� 16bits�� 10mA
  12. // Range: �C 300000 to 80000mA
  13. // Positive for charging
  14. // Negative for discharging.
  15. // 3 Max allowable charging current
  16. // Data[4-5] signed int�� 16bits�� 10mA
  17. // Range: �C 300000 to 80000mA
  18. // Positive for charging
  19. // Negative for discharging.
  20. // Remark:
  21. // If communicating with UAV, this value
  22. // will be 0.
  23. // 4 ������ Data[6-7] signed int�� 16bits�� 0.1 Degree C, range: -40 to 125 degree C
  24. // 5 ������ Data[8-9] signed int�� 16bits�� 0.1 Degree C, range: -40 to 125 degree C
  25. // 6 ��Գ��״̬ Data[10-11] unsigned int�� 16bits�� 0.1% 0 to 1000 (0 to 1000��)
  26. // 7 ���Գ��״̬ Data[12-13] unsigned int�� 16bits�� 0.1% 0 to 1000 (0 to 1000��)
  27. // 8 ʣ������ Data[14-15] unsigned int�� 16bits�� mAH 0 mA to 20000 mAH
  28. // 9 ����оѹ�� Data[16-17] unsigned int�� 16bits�� mV, 0mV to 1000mV
  29. // 10 Cell 1 ��ѹ Data[18-19] unsigned int�� 16bits�� mV 0 to 4500mV
  30. // 11 Cell 2 ��ѹ Data[20-21] unsigned int�� 16bits�� mV 0 to 4500mV
  31. // 12 Cell 3 ��ѹ Data[22-23] unsigned int�� 16bits�� mV 0 to 4500mV
  32. // 13 Cell 4 ��ѹ Data[24-25] unsigned int�� 16bits�� mV 0 to 4500mV
  33. // 14 Cell 5 ��ѹ Data[26-27] unsigned int�� 16bits�� mV 0 to 4500mV
  34. // 15 Cell 6 ��ѹ Data[28-29] unsigned int�� 16bits�� mV 0 to 4500mV
  35. // 16 Cell 7 ��ѹ Data[30-31] unsigned int�� 16bits�� mV 0 to 4500mV
  36. // 17 Cell 8 ��ѹ Data[32-33] unsigned int�� 16bits�� mV 0 to 4500mV
  37. // 18 Cell 9 ��ѹ Data[34-35] unsigned int�� 16bits�� mV 0 to 4500mV
  38. // 19 Cell 10 ��ѹ Data[36-37] unsigned int�� 16bits�� mV 0 to 4500mV
  39. // 20 Cell 11 ��ѹ Data[38-39] unsigned int�� 16bits�� mV 0 to 4500mV
  40. // 21 Cell 12 ��ѹ Data[40-41] unsigned int�� 16bits�� mV 0 to 4500mV
  41. // 22 Cell 13 ��ѹ Data[42-43] unsigned int�� 16bits�� mV 0 to 4500mV
  42. // 23 Warning level Data[44-45] Unsigned char, 8 bits,
  43. // Value:
  44. // 0: no warning
  45. // 1: level 1 warning, UAV shall return
  46. // 2: level 2 warning, UAV shall land
  47. // 24 ϵͳ״̬ Data[46-47] unsigned int, 16 bits
  48. // Permanent Fault Alarm:
  49. // Bit0: 1:��оѹ���, 0: ����
  50. // Bit1: 1:ѭ������������ 0: ����
  51. // Bit2: 1:��о�¶ȸߣ� 0: ����
  52. // Bit3: 1:����ʧЧ�� 0: ����
  53. // Cell Fault Alarm��
  54. // Bit4: 1�� ��оѹ��ϴ�, 0: ����
  55. // Discharging Alarm:
  56. // Bit5: 1:��طŵ����, 0: ����
  57. // Bit6: 1:��طŵ����, 0: ����
  58. // Bit7, Bit8: �ŵ��ѹ�澯
  59. // value: 0: ����
  60. // value: 1: level 1, ��о��ѹ 3.4V ��
  61. // SOC 30%, See Spec for details.
  62. // value: 2: level 2, ��о��ѹ 3.0V ��
  63. // SOC 20%, See Spec for details.
  64. // value: 3: level 3, ��о��ѹ 2.8V ��
  65. // SOC 10%, See Spec for details.
  66. // Bit9: 1:�ŵ������ 0: ����
  67. // Charging Alarm:
  68. // Bit10: 1:�����£� 0: ����
  69. // Bit11: 1:�����£� 0: ����
  70. // Bit12: 1:����ѹ�� 0: ����
  71. // Bit13: 1:�������� 0: ����
  72. // Bit14: 1:������� 0: ����
  73. // Remark:
  74. // For charger: when BMS encounters
  75. // the Charging Alarm or Cell fault
  76. // alarm, BMS will turn off the charging
  77. // MOSFET to stop charging.For UAV: when BMS encounters the
  78. // Discharging Alarm or Cell fault alarm
  79. // (UAV not in operation), BMS will turn
  80. // off the discharging MOSFET.
  81. // */
  82. // #pragma pack(1)
  83. // typedef struct
  84. // {
  85. // short amp_data[24]; //
  86. // }_POWERAMP_INF;
  87. // #pragma pack()
  88. // extern _POWERAMP_INF poweramp_inf;
  89. // /*
  90. // Number Item Data Index Remark
  91. // 1 �����汾�� Data[0-1] unsigned char, 2 bytes.
  92. // Data[0]: major version
  93. // Data[1]: minor version
  94. // e.g.: v02.60, Data [0]=2, Data[1]=60
  95. // 2 Ӳ���汾�� Data[2-3] unsigned char, 2 bytes.
  96. // Data[0]: major version
  97. // Data[1]: minor version
  98. // e.g.: v02.60, Data [0]=2, Data[1]=60
  99. // 3 ͨ��Э��汾�� Data[4-5] unsigned char, 2 bytes.
  100. // Data[0]: major version
  101. // Data[1]: minor version
  102. // e.g.: v02.60, Data [0]=2, Data[1]=60
  103. // */
  104. // #pragma pack(1)
  105. // typedef struct
  106. // {
  107. // unsigned char amp_ver[6]; //
  108. // }_POWERAMP_VER;
  109. // #pragma pack()
  110. // extern _POWERAMP_VER poweramp_ver;
  111. // /*
  112. // Number Item Data Index Remark
  113. // 1 BMS ������� Data[0-1] unsigned int�� 16bits�� 0.1AH Max value 6553.5 AH
  114. // 2 ��ش��� Data[2] unsigned char, 8bits, unit: 1 Value: 13
  115. // 3 ��ؽ����� Data[3-4] unsigned int�� 16bits�� 0.1% Range: 0 to 1000 (0 to 1000��)
  116. // 4 ���ѭ������ Data[5-6] unsigned int, 16bits, unit: 1 time
  117. // 5 ��ع������ Data[7-8] unsigned int, 16bits, unit: 1 time
  118. // 6 ��ع��Ŵ��� Data[9-10] unsigned int, 16bits, unit: 1 time
  119. // 7 ��ع��´��� Data[11-12] unsigned int, 16bits, unit: 1 time
  120. // 8 ��ع������� Data[13-14] unsigned int, 16bits, unit: 1 time
  121. // 9 �����������ѹ Data[15-16] unsigned int, 16bits, mV
  122. // 10 �����ع��ŵ�ѹ Data[17-18] unsigned int, 16bits, mV
  123. // 11 ��ر�� Data[19-25] 7 bytes,
  124. // Data [19-20]: ��J����M��
  125. // Data [21]: year, 19-50, offset 2000,
  126. // 2019-2050
  127. // Data [22]: month, 0-12
  128. // Data [23]: day,0-31max
  129. // Data [24-25]: unsigned int, production
  130. // line SN
  131. // 12 �� Data[26] unsigned char, 8 bits, offset 2000 E.g.: 19+2000 = 2019
  132. // 13 �� Data[27] unsigned char, 8 bitsRange: 0 - 12
  133. // 14 �� Data[28] unsigned char, 8 bitsRange: 0 �C 31 max
  134. // 15 ʱ Data[29] unsigned char, 8 bitsRange: 0 - 23
  135. // 16 �� Data[20] unsigned char, 8 bitsRange: 0 - 59
  136. // 17 �� Data[31] unsigned char, 8 bitsRang
  137. // */
  138. // #pragma pack(1)
  139. // typedef struct
  140. // {
  141. // uint16_t amp_cap; //����
  142. // uint8_t amp_cellnum; //����
  143. // uint16_t amp_soh; //������
  144. // uint16_t amp_cycle; //ѭ������
  145. // uint16_t amp_chg_count; //
  146. // uint16_t amp_dsg_count;
  147. // uint16_t amp_otp_count;
  148. // uint16_t amp_ocp_count;
  149. // uint16_t amp_fullchg_cellvolt;
  150. // uint16_t amp_uvd_cellvolt;
  151. // uint8_t amp_sn[14]; //���
  152. // uint8_t amp_year;
  153. // uint8_t amp_month;
  154. // uint8_t amp_day;
  155. // uint8_t amp_hour;
  156. // uint8_t amp_min;
  157. // uint8_t amp_sencond;
  158. // }_POWERAMP_SYS;
  159. // #pragma pack()
  160. // extern _POWERAMP_SYS poweramp_sys;
  161. // extern Connect_check Poweramp_Link;
  162. // void PowerAmpCanRecvHookFunction(uint32_t cellCanID, uint8_t* data, uint8_t len);
  163. // void send_msg_to_poweramp(void);
  164. // void check_poweramp_link(void);
  165. // extern uint32_t time_poweramp_lastrecv;
  166. #endif