shark_bsp.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #pragma once
  2. #define SHARK_BOARD_SP600 1
  3. #define SHARK_BOARD_SP700 2
  4. #define SHARK_BOARD_SP600_15AH 3
  5. #define SHARK_BOARD_SP700_OLD_CS1180 1
  6. #define true TRUE
  7. #define false FALSE
  8. #ifdef CONFIG_BOARD_SP600
  9. #include "gd32f3x0.h"
  10. #define CONFIG_BOARD_TYPE SHARK_BOARD_SP600
  11. #elif defined(CONFIG_BOARD_SP700)
  12. #include "gd32f3x0.h"
  13. #define CONFIG_BOARD_TYPE SHARK_BOARD_SP700
  14. #elif defined(CONFIG_BOARD_SP600_15AH)
  15. #include "gd32f3x0.h"
  16. #define CONFIG_BOARD_TYPE SHARK_BOARD_SP600_15AH
  17. #else
  18. #error "Invalid Board"
  19. #endif
  20. #if (CONFIG_BOARD_TYPE==SHARK_BOARD_SP700)
  21. #define r_resistor 1.0f // 1ºÁÅ·
  22. #define MAX_HA (30.0f)
  23. #define MAX_SOFT_CURRENT (50)
  24. #define MAX_I2T (2500.0f * 2)
  25. #define UART_NUM 2
  26. #define CURRENT_BIGER 50000
  27. #define CURRENT_MID 40000
  28. #define CURRENT_NORMAL 30000
  29. #elif (CONFIG_BOARD_TYPE==SHARK_BOARD_SP600)
  30. #define r_resistor 2.0f
  31. #ifdef CONFIG_CAP_15AH
  32. #define MAX_HA (15.0f)
  33. #define CURRENT_BIGER 35000
  34. #define CURRENT_MID 20000
  35. #define CURRENT_NORMAL 15000
  36. #else
  37. #define MAX_HA (22.5f)
  38. #define CURRENT_BIGER 40000
  39. #define CURRENT_MID 30000
  40. #define CURRENT_NORMAL 20000
  41. #endif
  42. #define MAX_SOFT_CURRENT (25)
  43. #define MAX_I2T (900.0f * 2)
  44. #define UART_NUM 1
  45. #endif
  46. #define MIN_CURRENT_FOR_CS1180 (4000)
  47. #define SMALL_CURRENT_R (28.0f)
  48. #define CELLS_NUM 15
  49. #define PACK_TEMPS_NUM 4
  50. #define PCB_TEMP_INDEX 3
  51. #define GD32_ADC 0
  52. #define CS1180_ADC 1
  53. #define UART_TIMEOUT 3000
  54. #define CHARGER_DETECT_IRQ_CLEAR_TIMEOUT (UART_TIMEOUT + 2 * 1000)
  55. void bsp_init(void);
  56. void wdog_start(int timeout);
  57. void wdog_reload(void);
  58. int wdog_set_timeout(int timeout);
  59. void systick_close(void);
  60. void systick_open(void);