Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
95ea4f0c
Commit
95ea4f0c
authored
Aug 06, 2014
by
Damien George
Browse files
stmhal: Enable relevant GPIO clock when Pin obj is init'd.
parent
7cc20e7e
Changes
1
Show whitespace changes
Inline
Side-by-side
stmhal/pin.c
View file @
95ea4f0c
...
...
@@ -285,6 +285,32 @@ STATIC mp_obj_t pin_obj_init(uint n_args, mp_obj_t *args) {
}
}
// enable the peripheral clock for the port of this pin
switch
(
self
->
port
)
{
case
PORT_A
:
__GPIOA_CLK_ENABLE
();
break
;
case
PORT_B
:
__GPIOB_CLK_ENABLE
();
break
;
case
PORT_C
:
__GPIOC_CLK_ENABLE
();
break
;
case
PORT_D
:
__GPIOD_CLK_ENABLE
();
break
;
#ifdef __GPIOE_CLK_ENABLE
case
PORT_E
:
__GPIOE_CLK_ENABLE
();
break
;
#endif
#ifdef __GPIOF_CLK_ENABLE
case
PORT_F
:
__GPIOF_CLK_ENABLE
();
break
;
#endif
#ifdef __GPIOG_CLK_ENABLE
case
PORT_G
:
__GPIOG_CLK_ENABLE
();
break
;
#endif
#ifdef __GPIOH_CLK_ENABLE
case
PORT_H
:
__GPIOH_CLK_ENABLE
();
break
;
#endif
#ifdef __GPIOI_CLK_ENABLE
case
PORT_I
:
__GPIOI_CLK_ENABLE
();
break
;
#endif
#ifdef __GPIOJ_CLK_ENABLE
case
PORT_J
:
__GPIOJ_CLK_ENABLE
();
break
;
#endif
}
// configure the GPIO as requested
GPIO_InitTypeDef
GPIO_InitStructure
;
GPIO_InitStructure
.
Pin
=
self
->
pin_mask
;
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment