]> sigrok.org Git - sigrok-firmware-fx2lafw.git/blobdiff - hw/sainsmart-dds120/fw.c
scopes: improve C preprocessor macro robustness
[sigrok-firmware-fx2lafw.git] / hw / sainsmart-dds120 / fw.c
index d67e7c912f2d80f7fd1904a812bc96f2eaccb8f2..64d88dd7862d16d0365da08ede5304323ccc2866 100644 (file)
 #include <delay.h>
 #include <setupdat.h>
 
-#define SET_ANALOG_MODE() PA7 = 1
+#define SET_ANALOG_MODE() do { PA7 = 1; } while (0)
 
 #define SET_COUPLING(x) set_coupling(x)
 
 #define SET_CALIBRATION_PULSE(x) set_calibration_pulse(x)
 
 /* Note: There's no PE2 as IOE is not bit-addressable (see TRM 15.2). */
-#define TOGGLE_CALIBRATION_PIN() IOE = IOE ^ 0x04
+#define TOGGLE_CALIBRATION_PIN() do { IOE = IOE ^ 0x04; } while (0)
 
 #define LED_CLEAR() NOP
 #define LED_GREEN() NOP