Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RIOT
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cm-projects
RIOT
Commits
cfed0e33
Commit
cfed0e33
authored
9 years ago
by
Hauke Petersen
Browse files
Options
Downloads
Patches
Plain Diff
cpu/cc2538: adapted to GPIO inerface changes
parent
c36efa0f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cpu/cc2538/periph/gpio.c
+26
-18
26 additions, 18 deletions
cpu/cc2538/periph/gpio.c
with
26 additions
and
18 deletions
cpu/cc2538/periph/gpio.c
+
26
−
18
View file @
cfed0e33
...
@@ -343,13 +343,7 @@ static const uint8_t reverse_pin_lut[] = {
...
@@ -343,13 +343,7 @@ static const uint8_t reverse_pin_lut[] = {
#endif
#endif
};
};
static
const
uint32_t
ioc_mask_lut
[]
=
{
int
gpio_init
(
gpio_t
dev
,
gpio_mode_t
mode
)
[
GPIO_NOPULL
]
=
IOC_OVERRIDE_DIS
,
[
GPIO_PULLUP
]
=
IOC_OVERRIDE_PUE
,
[
GPIO_PULLDOWN
]
=
IOC_OVERRIDE_PDE
,
};
int
gpio_init
(
gpio_t
dev
,
gpio_dir_t
dir
,
gpio_pp_t
pushpull
)
{
{
int
pin
;
int
pin
;
...
@@ -360,28 +354,42 @@ int gpio_init(gpio_t dev, gpio_dir_t dir, gpio_pp_t pushpull)
...
@@ -360,28 +354,42 @@ int gpio_init(gpio_t dev, gpio_dir_t dir, gpio_pp_t pushpull)
pin
=
pin_lut
[
dev
];
pin
=
pin_lut
[
dev
];
gpio_software_control
(
pin
);
gpio_software_control
(
pin
);
if
(
dir
==
GPIO_DIR_OUT
)
{
switch
(
mode
)
{
gpio_dir_output
(
pin
);
case
GPIO_IN
:
/* configure the pin's pull resistor state */
gpio_dir_input
(
pin
);
IOC_PXX_OVER
[
pin
]
=
IOC_OVERRIDE_OE
|
ioc_mask_lut
[
pushpull
];
/* configure the pin's pull resistor state */
}
IOC_PXX_OVER
[
pin
]
=
(
IOC_OVERRIDE_DIS
);
else
{
break
;
gpio_dir_input
(
pin
);
case
GPIO_IN_PD
:
/* configure the pin's pull resistor state */
gpio_dir_input
(
pin
);
IOC_PXX_OVER
[
pin
]
=
ioc_mask_lut
[
pushpull
];
/* configure the pin's pull resistor state */
IOC_PXX_OVER
[
pin
]
=
(
IOC_OVERRIDE_PDE
);
break
;
case
GPIO_IN_PU
:
gpio_dir_input
(
pin
);
/* configure the pin's pull resistor state */
IOC_PXX_OVER
[
pin
]
=
(
IOC_OVERRIDE_PUE
);
case
GPIO_OUT
:
gpio_dir_output
(
pin
);
/* configure the pin's pull resistor state */
IOC_PXX_OVER
[
pin
]
=
(
IOC_OVERRIDE_OE
|
IOC_OVERRIDE_DIS
);
break
;
default:
return
-
1
;
}
}
return
0
;
return
0
;
}
}
int
gpio_init_int
(
gpio_t
dev
,
gpio_pp_t
pullup
,
gpio_flank_t
flank
,
gpio_cb_t
cb
,
void
*
arg
)
int
gpio_init_int
(
gpio_t
dev
,
gpio_mode_t
mode
,
gpio_flank_t
flank
,
gpio_cb_t
cb
,
void
*
arg
)
{
{
int
res
,
pin
,
irq_num
;
int
res
,
pin
,
irq_num
;
uint32_t
mask
;
uint32_t
mask
;
cc2538_gpio_t
*
instance
;
cc2538_gpio_t
*
instance
;
/* Note: gpio_init() also checks if the gpio is enabled. */
/* Note: gpio_init() also checks if the gpio is enabled. */
res
=
gpio_init
(
dev
,
GPIO_DIR_IN
,
pullup
);
res
=
gpio_init
(
dev
,
mode
);
if
(
res
<
0
)
{
if
(
res
<
0
)
{
return
res
;
return
res
;
}
}
...
...
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