From: Uwe Hermann Date: Mon, 24 Apr 2017 06:30:06 +0000 (+0200) Subject: scopes: Factor out TIMER2_VAL. X-Git-Tag: sigrok-firmware-fx2lafw-0.1.6~18 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=2c57c00b18c085fb72579470368bc18a5985ef37;p=sigrok-firmware-fx2lafw.git scopes: Factor out TIMER2_VAL. --- diff --git a/hantek_6022be.c b/hantek_6022be.c index ad8f5ae8..69ba9586 100644 --- a/hantek_6022be.c +++ b/hantek_6022be.c @@ -37,6 +37,8 @@ #define LED_GREEN() PC0 = 1; PC1 = 0; #define LED_RED() PC0 = 0; PC1 = 1; +#define TIMER2_VAL 500 + /* CTLx pin index (IFCLK, ADC clock input). */ #define CTL_BIT 2 @@ -488,8 +490,8 @@ static void main(void) EA = 1; /* Init timer2. */ - RCAP2L = -500 & 0xff; - RCAP2H = (-500 & 0xff00) >> 8; + RCAP2L = -TIMER2_VAL & 0xff; + RCAP2H = (-TIMER2_VAL & 0xff00) >> 8; T2CON = 0; ET2 = 1; TR2 = 1; diff --git a/hantek_6022bl.c b/hantek_6022bl.c index 3da69116..aa16921a 100644 --- a/hantek_6022bl.c +++ b/hantek_6022bl.c @@ -37,6 +37,8 @@ #define LED_GREEN() PC0 = 1; PC1 = 0; #define LED_RED() PC0 = 0; PC1 = 1; +#define TIMER2_VAL 500 + /* CTLx pin index (IFCLK, ADC clock input). */ #define CTL_BIT 0 @@ -489,8 +491,8 @@ static void main(void) EA = 1; /* Init timer2. */ - RCAP2L = -500 & 0xff; - RCAP2H = (-500 & 0xff00) >> 8; + RCAP2L = -TIMER2_VAL & 0xff; + RCAP2H = (-TIMER2_VAL & 0xff00) >> 8; T2CON = 0; ET2 = 1; TR2 = 1; diff --git a/sainsmart_dds120.c b/sainsmart_dds120.c index 06e47905..cd2de1af 100644 --- a/sainsmart_dds120.c +++ b/sainsmart_dds120.c @@ -38,6 +38,8 @@ #define LED_GREEN() NOP #define LED_RED() NOP +#define TIMER2_VAL 1000 + /* CTLx pin index (IFCLK, ADC clock input). */ #define CTL_BIT 2 @@ -530,8 +532,8 @@ static void main(void) EA = 1; /* Init timer2. */ - RCAP2L = -1000 & 0xff; - RCAP2H = (-1000 & 0xff00) >> 8; + RCAP2L = -TIMER2_VAL & 0xff; + RCAP2H = (-TIMER2_VAL & 0xff00) >> 8; T2CON = 0; ET2 = 1; TR2 = 1;