Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pico-sdk
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
Microcontroller
pico-sdk
Commits
86aab81c
Unverified
Commit
86aab81c
authored
1 year ago
by
Mr. Jake
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
IRQ enabling guard (when no callback set) (#1504)
parent
74b9ea4d
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/rp2_common/hardware_gpio/gpio.c
+9
-1
9 additions, 1 deletion
src/rp2_common/hardware_gpio/gpio.c
with
9 additions
and
1 deletion
src/rp2_common/hardware_gpio/gpio.c
+
9
−
1
View file @
86aab81c
...
...
@@ -174,6 +174,13 @@ static void _gpio_set_irq_enabled(uint gpio, uint32_t events, bool enabled, io_i
}
void
gpio_set_irq_enabled
(
uint
gpio
,
uint32_t
events
,
bool
enabled
)
{
// either this call disables the interrupt
// or callback should already be set (raw or using gpio_set_irq_callback)
// this protects against enabling the interrupt without callback set
assert
(
!
enabled
||
(
raw_irq_mask
[
get_core_num
()]
&
(
1u
<<
gpio
))
||
callbacks
[
get_core_num
()]);
// Separate mask/force/status per-core, so check which core called, and
// set the relevant IRQ controls.
io_irq_ctrl_hw_t
*
irq_ctrl_base
=
get_core_num
()
?
...
...
@@ -182,8 +189,9 @@ void gpio_set_irq_enabled(uint gpio, uint32_t events, bool enabled) {
}
void
gpio_set_irq_enabled_with_callback
(
uint
gpio
,
uint32_t
events
,
bool
enabled
,
gpio_irq_callback_t
callback
)
{
gpio_set_irq_enabled
(
gpio
,
events
,
enabled
);
// first set callback, then enable the interrupt
gpio_set_irq_callback
(
callback
);
gpio_set_irq_enabled
(
gpio
,
events
,
enabled
);
if
(
enabled
)
irq_set_enabled
(
IO_IRQ_BANK0
,
true
);
}
...
...
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