Fork from bluejay at github and modified for my custom ESC. I need to modify it because some mistake design on my ESC hardware.
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.

138 lines
2.9 KiB

  1. ;**** **** **** **** ****
  2. ;
  3. ; Bluejay digital ESC firmware for controlling brushless motors in multirotors
  4. ;
  5. ; Copyright 2020, 2021 Mathias Rasmussen
  6. ; Copyright 2011, 2012 Steffen Skaug
  7. ;
  8. ; This file is part of Bluejay.
  9. ;
  10. ; Bluejay is free software: you can redistribute it and/or modify
  11. ; it under the terms of the GNU General Public License as published by
  12. ; the Free Software Foundation, either version 3 of the License, or
  13. ; (at your option) any later version.
  14. ;
  15. ; Bluejay is distributed in the hope that it will be useful,
  16. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. ; GNU General Public License for more details.
  19. ;
  20. ; You should have received a copy of the GNU General Public License
  21. ; along with Bluejay. If not, see <http://www.gnu.org/licenses/>.
  22. ;
  23. ;**** **** **** **** ****
  24. ;
  25. ; Hardware definition file "J"
  26. ; L2 L1 L0 RC CC MB MC MA X X Cc Bc Ac Cp Bp Ap
  27. ;
  28. ;**** **** **** **** ****
  29. PWM_ACTIVE_HIGH EQU 1 ; Pwm non-inverted
  30. COM_ACTIVE_HIGH EQU 1 ; Damping inverted
  31. COMPARATOR_PORT EQU 0 ; All comparator (mux) pins must be on the same port
  32. IF DEADTIME == 0
  33. PCA0CPM_POWER EQU PCA0CPM0
  34. PCA0CPL_POWER EQU PCA0CPL0
  35. PCA0CPH_POWER EQU PCA0CPH0
  36. PCA0CPM_DAMP EQU PCA0CPM1
  37. PCA0CPL_DAMP EQU PCA0CPL1
  38. PCA0CPH_DAMP EQU PCA0CPH1
  39. ELSE
  40. PCA0CPM_POWER EQU PCA0CPM0
  41. PCA0CPL_POWER EQU PCA0CPL0
  42. PCA0CPH_POWER EQU PCA0CPH0
  43. PCA0CPM_DAMP EQU PCA0CPM1
  44. PCA0CPL_DAMP EQU PCA0CPL1
  45. PCA0CPH_DAMP EQU PCA0CPH1
  46. ENDIF
  47. ;*********************
  48. ; PORT 0 definitions *
  49. ;*********************
  50. LED_2 EQU 7
  51. LED_1 EQU 6
  52. LED_0 EQU 5
  53. RTX_PIN EQU 4
  54. V_Mux EQU 3
  55. B_Mux EQU 2
  56. C_Mux EQU 1
  57. A_Mux EQU 0
  58. P0_DIGITAL EQU NOT((1 SHL A_Mux) + (1 SHL B_Mux) + (1 SHL C_Mux) + (1 SHL V_Mux))
  59. P0_INIT EQU 0FFh
  60. P0_PUSHPULL EQU (1 SHL LED_0) + (1 SHL LED_1) + (1 SHL LED_2)
  61. P0_SKIP EQU 0FFh
  62. ;*********************
  63. ; PORT 1 definitions *
  64. ;*********************
  65. ; EQU 7
  66. ; EQU 6
  67. C_Com EQU 5
  68. B_Com EQU 4
  69. A_Com EQU 3
  70. C_Pwm EQU 2
  71. B_Pwm EQU 1
  72. A_Pwm EQU 0
  73. P1_DIGITAL EQU (1 SHL A_Pwm) + (1 SHL B_Pwm) + (1 SHL C_Pwm) + (1 SHL A_Com) + (1 SHL B_Com) + (1 SHL C_Com)
  74. P1_INIT EQU 00h
  75. P1_PUSHPULL EQU (1 SHL A_Pwm) + (1 SHL B_Pwm) + (1 SHL C_Pwm) + (1 SHL A_Com) + (1 SHL B_Com) + (1 SHL C_Com)
  76. P1_SKIP EQU 0FFh
  77. ;*********************
  78. ; PORT 2 definitions *
  79. ;*********************
  80. DebugPin EQU 0
  81. P2_DIGITAL EQU (1 SHL DebugPin)
  82. P2_PUSHPULL EQU (1 SHL DebugPin)
  83. P2_SKIP EQU (1 SHL DebugPin)
  84. ;**** **** **** **** ****
  85. ; LED configuration
  86. ;**** **** **** **** ****
  87. Set_LED_0 MACRO
  88. clr P0.LED_0
  89. ENDM
  90. Clear_LED_0 MACRO
  91. setb P0.LED_0
  92. ENDM
  93. Set_LED_1 MACRO
  94. clr P0.LED_1
  95. ENDM
  96. Clear_LED_1 MACRO
  97. setb P0.LED_1
  98. ENDM
  99. Set_LED_2 MACRO
  100. clr P0.LED_2
  101. ENDM
  102. Clear_LED_2 MACRO
  103. setb P0.LED_2
  104. ENDM
  105. Set_LED_3 MACRO
  106. ENDM
  107. Clear_LED_3 MACRO
  108. ENDM
  109. ;**** **** **** **** ****
  110. ; Inherit base layout
  111. ;**** **** **** **** ****
  112. $set(CUSTOM_LED)
  113. $include (Base.inc)