 static void toggleLed () {
 #ifdef LED_PIN
     pinMode(LED_PIN, OUTPUT);
-    digitalWrite(LED_PIN, ! digitalRead(LED_PIN));
+    digitalWrite(LED_PIN, !digitalRead(LED_PIN));
+#endif
+}
+
+// adjust the control pins to reset the target and get it into ISP mode
+static void controlPins (bool isp, bool reset) {
+#ifdef ISP_PIN
+    pinMode(ISP_PIN, OUTPUT);
+    digitalWrite(ISP_PIN, !isp);
+#endif
+#ifdef RESET_PIN
+    pinMode(RESET_PIN, OUTPUT);
+    digitalWrite(RESET_PIN, !reset);
 #endif
 }
 

    Log.print(" FAILED - got 0x");
    Log.println(b, HEX);

    while (true) { // halt, blinking rapidly
        toggleLed();
        delay(100);


// main sketch logic
void setup () {
    controlPins(false, false);

    Log.begin(115200);
    Log.print("[stm32f1init] ");
    Log.println(BOOT_LOADER);
