aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/platforms
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal/platforms')
-rw-r--r--os/hal/platforms/STM32/ext_lld.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/os/hal/platforms/STM32/ext_lld.c b/os/hal/platforms/STM32/ext_lld.c
index 4a3cd3c2e..ed80f524c 100644
--- a/os/hal/platforms/STM32/ext_lld.c
+++ b/os/hal/platforms/STM32/ext_lld.c
@@ -577,11 +577,11 @@ void ext_lld_channel_enable(EXTDriver *extp, expchannel_t channel) {
/* Setting the associated GPIO for external channels.*/
if (channel < 16) {
- uint32_t n = channel & 3;
- uint32_t mask = 0xF << (channel >> 2);
+ uint32_t n = channel >> 2;
+ uint32_t mask = ~(0xF << (channel & 3));
uint32_t port = ((extp->config->channels[channel].mode &
EXT_MODE_GPIO_MASK) >>
- EXT_MODE_GPIO_OFF) << (channel >> 2);
+ EXT_MODE_GPIO_OFF) << (channel & 3);
#if defined(STM32L1XX_MD) || defined(STM32F2XX) || defined(STM32F4XX)
SYSCFG->EXTICR[n] = (SYSCFG->EXTICR[n] & mask) | port;