diff options
author | Giovanni Di Sirio <gdisirio@gmail.com> | 2017-09-03 17:10:49 +0000 |
---|---|---|
committer | Giovanni Di Sirio <gdisirio@gmail.com> | 2017-09-03 17:10:49 +0000 |
commit | 6ddf9cf1ee0dfc6b13575f16880f44237f93454c (patch) | |
tree | c5e34453b640a2a3f93234851fc8193465408123 /os/hal/ports/STM32/LLD/GPIOv2 | |
parent | 8651533a88df17b268c1aac9a7d3909796327d6d (diff) | |
download | ChibiOS-6ddf9cf1ee0dfc6b13575f16880f44237f93454c.tar.gz ChibiOS-6ddf9cf1ee0dfc6b13575f16880f44237f93454c.tar.bz2 ChibiOS-6ddf9cf1ee0dfc6b13575f16880f44237f93454c.zip |
Fixed a problem in PAL callbacks STM32 LLDs.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10547 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/ports/STM32/LLD/GPIOv2')
-rw-r--r-- | os/hal/ports/STM32/LLD/GPIOv2/hal_pal_lld.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/os/hal/ports/STM32/LLD/GPIOv2/hal_pal_lld.c b/os/hal/ports/STM32/LLD/GPIOv2/hal_pal_lld.c index ab6864474..dc0fd71c9 100644 --- a/os/hal/ports/STM32/LLD/GPIOv2/hal_pal_lld.c +++ b/os/hal/ports/STM32/LLD/GPIOv2/hal_pal_lld.c @@ -235,7 +235,7 @@ void _pal_lld_enablepadevent(ioportid_t port, iopadid_t pad,
ioeventmode_t mode) {
- uint32_t padmask, cridx, crmask, portidx;
+ uint32_t padmask, cridx, croff, crmask, portidx;
/* Mask of the pad.*/
padmask = 1U << (uint32_t)pad;
@@ -248,14 +248,15 @@ void _pal_lld_enablepadevent(ioportid_t port, /* Index and mask of the SYSCFG CR register to be used.*/
cridx = (uint32_t)pad >> 2U;
- crmask = ~(0xFU << (((uint32_t)pad & 3U) * 4U));
+ croff = ((uint32_t)pad & 3U) * 4U;
+ crmask = ~(0xFU << croff);
/* Port index is obtained assuming that GPIO ports are placed at regular
0x400 intervals in memory space. So far this is true for all devices.*/
- portidx = (uint32_t)port >> 10U;
+ portidx = ((uint32_t)port >> 10U) & 0xFU;
/* Port selection in SYSCFG.*/
- SYSCFG->EXTICR[cridx] = (SYSCFG->EXTICR[cridx] & crmask) | portidx;
+ SYSCFG->EXTICR[cridx] = (SYSCFG->EXTICR[cridx] & crmask) | (portidx << croff);
/* Programming edge registers.*/
if (mode & PAL_EVENT_MODE_RISING_EDGE)
@@ -300,7 +301,7 @@ void _pal_lld_disablepadevent(ioportid_t port, iopadid_t pad) { /* Port index is obtained assuming that GPIO ports are placed at regular
0x400 intervals in memory space. So far this is true for all devices.*/
- portidx = (uint32_t)port >> 10U;
+ portidx = ((uint32_t)port >> 10U) & 0xFU;
crport = (SYSCFG->EXTICR[cridx] >> croff) & 0xFU;
|