|
|
@ -1,4 +1,34 @@ |
|
|
|
|
|
|
|
;**** **** **** **** **** |
|
|
|
; |
|
|
|
; Bluejay digital ESC firmware for controlling brushless motors in multirotors |
|
|
|
; |
|
|
|
; Copyright 2020 Mathias Rasmussen |
|
|
|
; Copyright 2011, 2012 Steffen Skaug |
|
|
|
; |
|
|
|
; This file is part of Bluejay. |
|
|
|
; |
|
|
|
; Bluejay is free software: you can redistribute it and/or modify |
|
|
|
; it under the terms of the GNU General Public License as published by |
|
|
|
; the Free Software Foundation, either version 3 of the License, or |
|
|
|
; (at your option) any later version. |
|
|
|
; |
|
|
|
; Bluejay is distributed in the hope that it will be useful, |
|
|
|
; but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
|
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
|
|
; GNU General Public License for more details. |
|
|
|
; |
|
|
|
; You should have received a copy of the GNU General Public License |
|
|
|
; along with Bluejay. If not, see <http://www.gnu.org/licenses/>. |
|
|
|
; |
|
|
|
;**** **** **** **** **** |
|
|
|
; |
|
|
|
; Base layout |
|
|
|
; |
|
|
|
; The inheriting layout should |
|
|
|
; - Specify PWM_ACTIVE_HIGH, COMPWM_ACTIVE_HIGH and COMP_PORT |
|
|
|
; - Set CUSTOM_* flags to override default implementation |
|
|
|
; |
|
|
|
;**** **** **** **** **** |
|
|
|
|
|
|
|
|
|
|
|
;**** **** **** **** **** |
|
|
@ -122,22 +152,22 @@ $endif |
|
|
|
|
|
|
|
|
|
|
|
;**** **** **** **** **** |
|
|
|
; Fets on/off toggling |
|
|
|
; Toggling FETs on/off |
|
|
|
;**** **** **** **** **** |
|
|
|
$if NOT CUSTOM_FET_TOGGLING |
|
|
|
|
|
|
|
IF PWM_ACTIVE_HIGH == 1 ; fet active high |
|
|
|
IF PWM_ACTIVE_HIGH == 1 ; PWM FET active high |
|
|
|
pON LIT 'setb' |
|
|
|
pOFF LIT 'clr' |
|
|
|
ELSE ; fet active low |
|
|
|
ELSE ; PWM FET active low |
|
|
|
pON LIT 'clr' |
|
|
|
pOFF LIT 'setb' |
|
|
|
ENDIF |
|
|
|
|
|
|
|
IF COMPWM_ACTIVE_HIGH == 1 ; comfet active high |
|
|
|
IF COMPWM_ACTIVE_HIGH == 1 ; COM FET active high |
|
|
|
cON LIT 'setb' |
|
|
|
cOFF LIT 'clr' |
|
|
|
ELSE ; comfet active low |
|
|
|
ELSE ; COM FET active low |
|
|
|
cON LIT 'clr' |
|
|
|
cOFF LIT 'setb' |
|
|
|
ENDIF |
|
|
@ -194,7 +224,6 @@ All_pwmFETs_Off MACRO |
|
|
|
ENDM |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AcomFET_on MACRO |
|
|
|
IF FETON_DELAY == 0 |
|
|
|
pOFF P_ApwmFET |
|
|
@ -237,34 +266,6 @@ ENDM |
|
|
|
$endif |
|
|
|
|
|
|
|
|
|
|
|
$if NOT CUSTOM_LED |
|
|
|
|
|
|
|
Set_LED_0 MACRO |
|
|
|
ENDM |
|
|
|
|
|
|
|
Clear_LED_0 MACRO |
|
|
|
ENDM |
|
|
|
|
|
|
|
Set_LED_1 MACRO |
|
|
|
ENDM |
|
|
|
|
|
|
|
Clear_LED_1 MACRO |
|
|
|
ENDM |
|
|
|
|
|
|
|
Set_LED_2 MACRO |
|
|
|
ENDM |
|
|
|
|
|
|
|
Clear_LED_2 MACRO |
|
|
|
ENDM |
|
|
|
|
|
|
|
Set_LED_3 MACRO |
|
|
|
ENDM |
|
|
|
|
|
|
|
Clear_LED_3 MACRO |
|
|
|
ENDM |
|
|
|
|
|
|
|
$endif |
|
|
|
|
|
|
|
;**** **** **** **** **** |
|
|
|
; ADC and temperature measurement |
|
|
|
;**** **** **** **** **** |
|
|
@ -296,3 +297,33 @@ Stop_Adc MACRO |
|
|
|
ENDM |
|
|
|
|
|
|
|
|
|
|
|
;**** **** **** **** **** |
|
|
|
; LEDs |
|
|
|
;**** **** **** **** **** |
|
|
|
$if NOT CUSTOM_LED |
|
|
|
|
|
|
|
Set_LED_0 MACRO |
|
|
|
ENDM |
|
|
|
|
|
|
|
Clear_LED_0 MACRO |
|
|
|
ENDM |
|
|
|
|
|
|
|
Set_LED_1 MACRO |
|
|
|
ENDM |
|
|
|
|
|
|
|
Clear_LED_1 MACRO |
|
|
|
ENDM |
|
|
|
|
|
|
|
Set_LED_2 MACRO |
|
|
|
ENDM |
|
|
|
|
|
|
|
Clear_LED_2 MACRO |
|
|
|
ENDM |
|
|
|
|
|
|
|
Set_LED_3 MACRO |
|
|
|
ENDM |
|
|
|
|
|
|
|
Clear_LED_3 MACRO |
|
|
|
ENDM |
|
|
|
|
|
|
|
$endif |