summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hal/pin.h24
1 files changed, 12 insertions, 12 deletions
diff --git a/hal/pin.h b/hal/pin.h
index e45c178..29ec158 100644
--- a/hal/pin.h
+++ b/hal/pin.h
@@ -36,10 +36,10 @@ class Pin {
}
void set_af(int af) {
- if(n > 8) {
+ if(n < 8) {
g.AFRL = (g.AFRL & ~(0xf << (n * 4))) | af << (n * 4);
} else {
- g.AFRH = (g.AFRL & ~(0xf << (n * 4 - 32))) | af << (n * 4 - 32);
+ g.AFRH = (g.AFRH & ~(0xf << (n * 4 - 32))) | af << (n * 4 - 32);
}
}
@@ -59,16 +59,16 @@ class Pin {
}
}
};
-static Pin PB0(GPIOD, 0);
-static Pin PB1(GPIOD, 1);
-static Pin PB2(GPIOD, 2);
-static Pin PB3(GPIOD, 3);
-static Pin PB4(GPIOD, 4);
-static Pin PB5(GPIOD, 5);
-static Pin PB6(GPIOD, 6);
-static Pin PB7(GPIOD, 7);
-static Pin PB8(GPIOD, 8);
-static Pin PB9(GPIOD, 9);
+static Pin PB0(GPIOB, 0);
+static Pin PB1(GPIOB, 1);
+static Pin PB2(GPIOB, 2);
+static Pin PB3(GPIOB, 3);
+static Pin PB4(GPIOB, 4);
+static Pin PB5(GPIOB, 5);
+static Pin PB6(GPIOB, 6);
+static Pin PB7(GPIOB, 7);
+static Pin PB8(GPIOB, 8);
+static Pin PB9(GPIOB, 9);
static Pin PD12(GPIOD, 12);
static Pin PD13(GPIOD, 13);