diff options
author | Dave Hylands <dhylands@gmail.com> | 2015-07-28 11:13:33 -0700 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-07-30 00:38:32 +0100 |
commit | 92d4b51ad5d828930334f87d9619a78b5877a384 (patch) | |
tree | b055ba812bfce720130c6c52272bde38e80a00c9 /stmhal/extint.c | |
parent | 7e7fb0b7a3d716062281c2366de97a41a1ea87c1 (diff) | |
download | micropython-92d4b51ad5d828930334f87d9619a78b5877a384.tar.gz micropython-92d4b51ad5d828930334f87d9619a78b5877a384.zip |
stmhal: Add STM32F7DISC and associated changes.
Diffstat (limited to 'stmhal/extint.c')
-rw-r--r-- | stmhal/extint.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/stmhal/extint.c b/stmhal/extint.c index 4c45e57246..669c43812c 100644 --- a/stmhal/extint.c +++ b/stmhal/extint.c @@ -187,21 +187,41 @@ void extint_enable(uint line) { if (line >= EXTI_NUM_VECTORS) { return; } + #if defined(STM32F7) + // The Cortex-M7 doesn't have bitband support. + mp_uint_t irq_state = disable_irq(); + if (pyb_extint_mode[line] == EXTI_Mode_Interrupt) { + EXTI->IMR |= (1 << line); + } else { + EXTI->EMR |= (1 << line); + } + enable_irq(irq_state); + #else // Since manipulating IMR/EMR is a read-modify-write, and we want this to // be atomic, we use the bit-band area to just affect the bit we're // interested in. EXTI_MODE_BB(pyb_extint_mode[line], line) = 1; + #endif } void extint_disable(uint line) { if (line >= EXTI_NUM_VECTORS) { return; } + + #if defined(STM32F7) + // The Cortex-M7 doesn't have bitband support. + mp_uint_t irq_state = disable_irq(); + EXTI->IMR &= ~(1 << line); + EXTI->EMR &= ~(1 << line); + enable_irq(irq_state); + #else // Since manipulating IMR/EMR is a read-modify-write, and we want this to // be atomic, we use the bit-band area to just affect the bit we're // interested in. EXTI_MODE_BB(EXTI_Mode_Interrupt, line) = 0; EXTI_MODE_BB(EXTI_Mode_Event, line) = 0; + #endif } void extint_swint(uint line) { |