aboutsummaryrefslogtreecommitdiff
path: root/stmhal/usrsw.c
diff options
context:
space:
mode:
authorDamien George2015-08-03 00:05:16 +0100
committerDamien George2015-08-03 00:14:48 +0100
commit0851751615580d02bd6f841e13651923f05fde59 (patch)
tree28b788def0d7a128b57512a923a84657d65d11be /stmhal/usrsw.c
parent6f1c00869c761ff84b21939a057d7752e0c01be9 (diff)
stmhal: Factor GPIO clock enable logic into mp_hal_gpio_clock_enable.
Extracted GPIO clock enable logic into mp_hal_gpio_clock_enable and called from anyplace which might need to use GPIO functions on ports other than A-D. Thanks to Dave Hylands for the patch.
Diffstat (limited to 'stmhal/usrsw.c')
-rw-r--r--stmhal/usrsw.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/stmhal/usrsw.c b/stmhal/usrsw.c
index 821df6010..225373ca8 100644
--- a/stmhal/usrsw.c
+++ b/stmhal/usrsw.c
@@ -30,6 +30,7 @@
#include "extint.h"
#include "pin.h"
#include "genhdr/pins.h"
+#include "mphal.h"
#include "usrsw.h"
#if MICROPY_HW_HAS_SWITCH
@@ -53,6 +54,7 @@
// this function inits the switch GPIO so that it can be used
void switch_init0(void) {
+ mp_hal_gpio_clock_enable(MICROPY_HW_USRSW_PIN.gpio);
GPIO_InitTypeDef init;
init.Pin = MICROPY_HW_USRSW_PIN.pin_mask;
init.Mode = GPIO_MODE_INPUT;