Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
non-destructive text micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
badge fixer
non-destructive text micropython
Commits
79b66885
Commit
79b66885
authored
Jul 3, 2019
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
stm32/extint: Simplify bitband support config for different MCUs.
parent
14bec796
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
ports/stm32/extint.c
+10
-11
10 additions, 11 deletions
ports/stm32/extint.c
with
10 additions
and
11 deletions
ports/stm32/extint.c
+
10
−
11
View file @
79b66885
...
...
@@ -84,11 +84,12 @@
// TODO Add python method to change callback object.
#if defined(STM32F4) || defined(STM32L4)
// These MCUs have bitband support so define macros to atomically set/clear bits in IMR/EMR and SWIER
#define EXTI_OFFSET (EXTI_BASE - PERIPH_BASE)
// Macro used to set/clear the bit corresponding to the line in the IMR/EMR
// register in an atomic fashion by using bitband addressing.
#define EXTI_MODE_BB(mode, line) (*(__IO uint32_t *)(PERIPH_BB_BASE + ((EXTI_OFFSET + (mode)) * 32) + ((line) * 4)))
#define EXTI_SWIER_BB(line) (*(__IO uint32_t *)(PERIPH_BB_BASE + ((EXTI_OFFSET + offsetof(EXTI_TypeDef, SWIER)) * 32) + ((line) * 4)))
#endif
#if defined(STM32L4)
// The L4 MCU supports 40 Events/IRQs lines of the type configurable and direct.
...
...
@@ -116,8 +117,6 @@
#define EXTI_FTSR EXTI->FTSR
#endif
#define EXTI_SWIER_BB(line) (*(__IO uint32_t *)(PERIPH_BB_BASE + ((EXTI_OFFSET + offsetof(EXTI_TypeDef, SWIER)) * 32) + ((line) * 4)))
typedef
struct
{
mp_obj_base_t
base
;
mp_int_t
line
;
...
...
@@ -349,8 +348,8 @@ void extint_enable(uint line) {
if
(
line
>=
EXTI_NUM_VECTORS
)
{
return
;
}
#if
defined(STM32F0) || defined(STM32F7) || defined(STM32H7
)
// Th
e Cortex-M7
doesn't have bitband support.
#if
!defined(EXTI_MODE_BB
)
// Th
is MCU
doesn't have bitband support.
mp_uint_t
irq_state
=
disable_irq
();
if
(
pyb_extint_mode
[
line
]
==
EXTI_Mode_Interrupt
)
{
#if defined(STM32H7)
...
...
@@ -379,8 +378,8 @@ void extint_disable(uint line) {
return
;
}
#if
defined(STM32F0) || defined(STM32F7) || defined(STM32H7
)
// Th
e Cortex-M7
doesn't have bitband support.
#if
!defined(EXTI_MODE_BB
)
// Th
is MCU
doesn't have bitband support.
mp_uint_t
irq_state
=
disable_irq
();
#if defined(STM32H7)
EXTI_D1
->
IMR1
&=
~
(
1
<<
line
);
...
...
@@ -417,8 +416,8 @@ void extint_trigger_mode(uint line, uint32_t mode) {
if
(
line
>=
EXTI_NUM_VECTORS
)
{
return
;
}
#if
defined(STM32F0) || defined(STM32F7) || defined(STM32H7
)
// Th
e Cortex-M7
doesn't have bitband support.
#if
!defined(EXTI_MODE_BB
)
// Th
is MCU
doesn't have bitband support.
mp_uint_t
irq_state
=
disable_irq
();
// Enable or disable the rising detector
if
((
mode
&
GPIO_MODE_IT_RISING
)
==
GPIO_MODE_IT_RISING
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment