From: Uwe Hermann Date: Sat, 8 Apr 2017 14:39:07 +0000 (+0200) Subject: scopes: Factor out TOGGLE_CALIBRATION_PIN(). X-Git-Tag: sigrok-firmware-fx2lafw-0.1.6~24 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=e583c3fcd0bd1e4a44846fba5e80bbea1ff215a2;p=sigrok-firmware-fx2lafw.git scopes: Factor out TOGGLE_CALIBRATION_PIN(). --- diff --git a/hantek_6022be.c b/hantek_6022be.c index 84e37876..4dc34f2b 100644 --- a/hantek_6022be.c +++ b/hantek_6022be.c @@ -26,6 +26,9 @@ #define SET_ANALOG_MODE() +/* Toggle the 1kHz calibration pin, only accurate up to ca. 8MHz. */ +#define TOGGLE_CALIBRATION_PIN() PA7 = !PA7 + /* Change to support as many interfaces as you need. */ static BYTE altiface = 0; @@ -68,8 +71,7 @@ void suspend_isr(void) __interrupt SUSPEND_ISR void timer2_isr(void) __interrupt TF2_ISR { - /* Toggle the 1kHz calibration pin, only accurate up to ca. 8MHz. */ - PA7 = !PA7; + TOGGLE_CALIBRATION_PIN(); if (ledcounter) { if (--ledcounter == 0) { diff --git a/hantek_6022bl.c b/hantek_6022bl.c index a380ad08..4920047c 100644 --- a/hantek_6022bl.c +++ b/hantek_6022bl.c @@ -26,6 +26,9 @@ #define SET_ANALOG_MODE() PA7 = 1 +/* Toggle the 1kHz calibration pin, only accurate up to ca. 8MHz. */ +#define TOGGLE_CALIBRATION_PIN() PC2 = !PC2 + /* Change to support as many interfaces as you need. */ static BYTE altiface = 0; @@ -68,8 +71,7 @@ void suspend_isr(void) __interrupt SUSPEND_ISR void timer2_isr(void) __interrupt TF2_ISR { - /* Toggle the 1kHz calibration pin, only accurate up to ca. 8MHz. */ - PC2 = !PC2; + TOGGLE_CALIBRATION_PIN(); if (ledcounter) { if (--ledcounter == 0) { diff --git a/sainsmart_dds120.c b/sainsmart_dds120.c index 26d09971..a4591961 100644 --- a/sainsmart_dds120.c +++ b/sainsmart_dds120.c @@ -26,6 +26,10 @@ #define SET_ANALOG_MODE() PA7 = 1 +/* Toggle the 1kHz calibration pin, only accurate up to ca. 8MHz. */ +/* Note: There's no PE2 as IOE is not bit-addressable (see TRM 15.2). */ +#define TOGGLE_CALIBRATION_PIN() IOE = IOE ^ 0x04 + /* Change to support as many interfaces as you need. */ static BYTE altiface = 0; @@ -66,8 +70,8 @@ void suspend_isr(void) __interrupt SUSPEND_ISR void timer2_isr(void) __interrupt TF2_ISR { - /* Toggle the 1kHz calibration pin, only accurate up to ca. 8MHz. */ - IOE = IOE^0x04; + TOGGLE_CALIBRATION_PIN(); + TF2 = 0; }