Skip to content

Fix setting STM32 GPIO input/output mode. #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 2, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions libraries/mbed/targets/hal/STM/TARGET_STM32F4XX/gpio_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ uint32_t gpio_set(PinName pin) {
// Enable GPIO peripheral clock
RCC->AHB1ENR |= 1 << port_index;

pin_function(pin, 0);
pin_function(pin, STM_PIN_DATA(0, 0));
return 1 << ((uint32_t) pin & 0xF);
}

Expand Down Expand Up @@ -55,7 +55,7 @@ void gpio_mode(gpio_t *obj, PinMode mode) {

void gpio_dir(gpio_t *obj, PinDirection direction) {
switch (direction) {
case PIN_INPUT : pin_function(obj->pin, 0); break;
case PIN_OUTPUT: pin_function(obj->pin, 1); break;
case PIN_INPUT : pin_function(obj->pin, STM_PIN_DATA(0, 0)); break;
case PIN_OUTPUT: pin_function(obj->pin, STM_PIN_DATA(1, 0)); break;
}
}