From: Uwe Hermann Date: Mon, 3 Apr 2017 14:03:05 +0000 (+0200) Subject: scopes: Factor out SET_ANALOG_MODE(). X-Git-Tag: sigrok-firmware-fx2lafw-0.1.6~25 X-Git-Url: http://sigrok.org/gitweb/?p=sigrok-firmware-fx2lafw.git;a=commitdiff_plain;h=be6d306de12082c887c30e364dcf66438acc6183;ds=sidebyside scopes: Factor out SET_ANALOG_MODE(). --- diff --git a/hantek_6022be.c b/hantek_6022be.c index 232237eb..84e37876 100644 --- a/hantek_6022be.c +++ b/hantek_6022be.c @@ -24,6 +24,8 @@ #include #include +#define SET_ANALOG_MODE() + /* Change to support as many interfaces as you need. */ static BYTE altiface = 0; @@ -164,6 +166,8 @@ static void start_sampling(void) { int i; + SET_ANALOG_MODE(); + clear_fifo(); for (i = 0; i < 1000; i++); @@ -389,6 +393,8 @@ static void init(void) EP4CFG = 0; EP8CFG = 0; + SET_ANALOG_MODE(); + /* In idle mode tristate all outputs. */ GPIFIDLECTL = 0x00; /* Don't enable CTL0-5 outputs. */ GPIFCTLCFG = 0x80; /* TRICTL=1. CTL0-2: CMOS outputs, tri-statable. */ diff --git a/hantek_6022bl.c b/hantek_6022bl.c index 99e43c97..a380ad08 100644 --- a/hantek_6022bl.c +++ b/hantek_6022bl.c @@ -24,6 +24,8 @@ #include #include +#define SET_ANALOG_MODE() PA7 = 1 + /* Change to support as many interfaces as you need. */ static BYTE altiface = 0; @@ -165,8 +167,7 @@ static void start_sampling(void) { int i; - /* Set analog mode. */ - PA7 = 1; + SET_ANALOG_MODE(); clear_fifo(); @@ -393,8 +394,7 @@ static void init(void) EP4CFG = 0; EP8CFG = 0; - /* Set analog mode. */ - PA7 = 1; + SET_ANALOG_MODE(); /* In idle mode tristate all outputs. */ GPIFIDLECTL = 0x00; /* Don't enable CTL0-5 outputs. */ diff --git a/sainsmart_dds120.c b/sainsmart_dds120.c index a2867e5c..26d09971 100644 --- a/sainsmart_dds120.c +++ b/sainsmart_dds120.c @@ -24,6 +24,8 @@ #include #include +#define SET_ANALOG_MODE() PA7 = 1 + /* Change to support as many interfaces as you need. */ static BYTE altiface = 0; @@ -208,6 +210,8 @@ static void start_sampling(void) { int i; + SET_ANALOG_MODE(); + clear_fifo(); for (i = 0; i < 1000; i++); @@ -459,6 +463,8 @@ static void init(void) EP4CFG = 0; EP8CFG = 0; + SET_ANALOG_MODE(); + /* In idle mode tristate all outputs. */ GPIFIDLECTL = 0x00; /* Don't enable CTL0-5 outputs. */ GPIFCTLCFG = 0x80; /* TRICTL=1. CTL0-2: CMOS outputs, tri-statable. */ @@ -509,7 +515,7 @@ static void main(void) OEC = 0xff; OEA = 0x80; - PA7 = 1; + SET_ANALOG_MODE(); while (TRUE) { if (dosud) {