Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed-src by
Diff: targets/hal/TARGET_STM/TARGET_STM32F1/pinmap.c
- Revision:
- 537:c61a9ac6f5c2
- Parent:
- 508:4f5903e025e6
--- a/targets/hal/TARGET_STM/TARGET_STM32F1/pinmap.c Thu May 07 09:00:08 2015 +0100 +++ b/targets/hal/TARGET_STM/TARGET_STM32F1/pinmap.c Thu May 07 09:15:08 2015 +0100 @@ -177,12 +177,21 @@ if (pin_index < 8) { if ((gpio->CRL & (0x03 << (pin_index * 4))) == 0) { // MODE bits = Input mode gpio->CRL |= (0x08 << (pin_index * 4)); // Set pull-up / pull-down + gpio->CRL &= ~(0x08 << ((pin_index * 4)-1)); // ENSURES GPIOx_CRL.CNFx.bit0 = 0 } } else { if ((gpio->CRH & (0x03 << ((pin_index % 8) * 4))) == 0) { // MODE bits = Input mode gpio->CRH |= (0x08 << ((pin_index % 8) * 4)); // Set pull-up / pull-down + gpio->CRH &= ~(0x08 << (((pin_index % 8) * 4)-1)); // ENSURES GPIOx_CRH.CNFx.bit0 = 0 } } + // Now it's time to setup properly if pullup or pulldown. This is done in ODR register: + // set pull-up => bit=1, set pull-down => bit = 0 + if (mode == PullUp) { + gpio->ODR |= (0x01 << (pin_index)); // Set pull-up + } else{ + gpio->ODR &= ~(0x01 << (pin_index)); // Set pull-down + } break; case OpenDrain: // Set open-drain for Output mode (General Purpose or Alternate Function)