]> sigrok.org Git - sigrok-firmware-fx2lafw.git/blobdiff - hantek_6022be.c
scopes: Factor out TOGGLE_CALIBRATION_PIN().
[sigrok-firmware-fx2lafw.git] / hantek_6022be.c
index 232237eb1296b2147222d5c9db271450f4ce460d..4dc34f2b4cfefd7d4517fa0a0e2a6734c13f8d3b 100644 (file)
 #include <delay.h>
 #include <setupdat.h>
 
+#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;
 
@@ -66,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) {
@@ -164,6 +168,8 @@ static void start_sampling(void)
 {
        int i;
 
+       SET_ANALOG_MODE();
+
        clear_fifo();
 
        for (i = 0; i < 1000; i++);
@@ -389,6 +395,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. */