From 67e4f967422abcf68f3f9b00e36ed3e857fbdaa5 Mon Sep 17 00:00:00 2001 From: Mathias Rasmussen Date: Mon, 26 Oct 2020 22:16:39 +0100 Subject: [PATCH] refactor: Reorganize pca interrupt and macros --- Bluejay.asm | 20 ++++++++++++++------ Common.inc | 10 ---------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/Bluejay.asm b/Bluejay.asm index 2d066b7..71080b7 100644 --- a/Bluejay.asm +++ b/Bluejay.asm @@ -1020,19 +1020,27 @@ pca_int_hi_pwm: jb ACC.(PCA_BIT-1), pca_int_exit pca_int_set_pwm: - Set_Power_Pwm_Regs - Set_Damp_Pwm_Regs - mov Current_Power_Pwm_Reg_H, Power_Pwm_Reg_H - Disable_COVF_Interrupt +ENDIF + + ; Set power pwm registers + mov PCA0_POWER_L, Power_Pwm_Reg_L + mov PCA0_POWER_H, Power_Pwm_Reg_H + +IF FETON_DELAY != 0 + ; Set damp pwm registers + mov PCA0_DAMP_L, Damp_Pwm_Reg_L + mov PCA0_DAMP_H, Damp_Pwm_Reg_H +ENDIF -ELSE ; EN/PWM style drivers - Set_Power_Pwm_Regs mov Current_Power_Pwm_Reg_H, Power_Pwm_Reg_H + Disable_COVF_Interrupt +IF FETON_DELAY == 0 ; EN/PWM style drivers Disable_CCF_Interrupt ENDIF anl EIE1, #0EFh ; Pwm updated, disable pca interrupts + pca_int_exit: Clear_COVF_Interrupt IF FETON_DELAY == 0 diff --git a/Common.inc b/Common.inc index 8716f70..9f4d918 100644 --- a/Common.inc +++ b/Common.inc @@ -220,16 +220,6 @@ ELSE ENDIF ENDM -Set_Power_Pwm_Regs MACRO - mov PCA0_POWER_L, Power_Pwm_Reg_L - mov PCA0_POWER_H, Power_Pwm_Reg_H -ENDM - -Set_Damp_Pwm_Regs MACRO - mov PCA0_DAMP_L, Damp_Pwm_Reg_L - mov PCA0_DAMP_H, Damp_Pwm_Reg_H -ENDM - Clear_COVF_Interrupt MACRO anl PCA0PWM, #0DFh ENDM