]> sigrok.org Git - sigrok-firmware-fx2lafw.git/blobdiff - fx2lafw.c
configure.ac: Bump package version to 0.1.7.
[sigrok-firmware-fx2lafw.git] / fx2lafw.c
index 629e28c00d2dd3d13a256591016fe58a057eb456..1035713da4f560736af1dd4e6ab1c6a3eac8d746 100644 (file)
--- a/fx2lafw.c
+++ b/fx2lafw.c
@@ -56,12 +56,12 @@ volatile WORD ledcounter = 0;
 static void setup_endpoints(void)
 {
        /* Setup EP2 (IN). */
-       EP2CFG = (1 << 7) |               /* EP is valid/activated */
-                (1 << 6) |               /* EP direction: IN */
-                (1 << 5) | (0 << 4) |    /* EP Type: bulk */
-                (1 << 3) |               /* EP buffer size: 1024 */
-                (0 << 2) |               /* Reserved. */
-                (0 << 1) | (0 << 0);     /* EP buffering: quad buffering */
+       EP2CFG = (1u << 7) |              /* EP is valid/activated */
+                (1u << 6) |              /* EP direction: IN */
+                (1u << 5) | (0u << 4) |  /* EP Type: bulk */
+                (1u << 3) |              /* EP buffer size: 1024 */
+                (0u << 2) |              /* Reserved. */
+                (0u << 1) | (0u << 0);   /* EP buffering: quad buffering */
        SYNCDELAY();
 
        /* Disable all other EPs (EP1, EP4, EP6, and EP8). */
@@ -78,7 +78,7 @@ static void setup_endpoints(void)
 
        /* EP2: Reset the FIFOs. */
        /* Note: RESETFIFO() gets the EP number WITHOUT bit 7 set/cleared. */
-       RESETFIFO(0x02)
+       RESETFIFO(0x02);
 
        /* EP2: Enable AUTOIN mode. Set FIFO width to 8bits. */
        EP2FIFOCFG = bmAUTOIN;
@@ -215,7 +215,7 @@ void ibn_isr(void) __interrupt IBN_ISR
         */
        if ((IBNIRQ & bmEP2IBN) && (gpif_acquiring == PREPARED)) {
                ledcounter = 1;
-               PA1 = 0;
+               LED_OFF();
                gpif_acquisition_start();
        }
 
@@ -246,11 +246,11 @@ void timer2_isr(void) __interrupt TF2_ISR
        /* Blink LED during acquisition, keep it on otherwise. */
        if (gpif_acquiring == RUNNING) {
                if (--ledcounter == 0) {
-                       PA1 = !PA1;
+                       LED_TOGGLE();
                        ledcounter = 1000;
                }
        } else if (gpif_acquiring == STOPPED) {
-               PA1 = 1; /* LED on. */
+               LED_ON();
        }
        TF2 = 0;
 }
@@ -276,10 +276,8 @@ void fx2lafw_init(void)
        ENABLE_HISPEED();
        ENABLE_USBRESET();
 
-       /* PA1 (LED) is an output. */
-       PORTACFG = 0;
-       OEA = (1 << 1);
-       PA1 = 1; /* LED on. */
+       LED_INIT();
+       LED_ON();
 
        /* Init timer2. */
        RCAP2L = -500 & 0xff;