]> sigrok.org Git - sigrok-firmware-fx2lafw.git/blobdiff - hantek_6022bl.c
scopes: Factor out TOGGLE_CALIBRATION_PIN().
[sigrok-firmware-fx2lafw.git] / hantek_6022bl.c
index 99e43c97218382f104172250f795be03ae059cd4..4920047cdfed7ccf0a4e294465fd6c1683b5f71e 100644 (file)
 #include <delay.h>
 #include <setupdat.h>
 
+#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;
 
@@ -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. */
-       PC2 = !PC2;
+       TOGGLE_CALIBRATION_PIN();
 
        if (ledcounter) {
                if (--ledcounter == 0) {
@@ -165,8 +169,7 @@ static void start_sampling(void)
 {
        int i;
 
-       /* Set analog mode. */
-       PA7 = 1;
+       SET_ANALOG_MODE();
 
        clear_fifo();
 
@@ -393,8 +396,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. */