mbed library sources

Fork of mbed-src by mbed official

Files at this revision

API Documentation at this revision

Comitter:
mbed_official
Date:
Thu May 07 09:15:08 2015 +0100
Parent:
536:c48d7048ab6e
Child:
538:3c6246291cdb
Commit message:
Synchronized with git revision ffd558657c5c47dd311c937f6c716bc0b1c46e50

Full URL: https://github.com/mbedmicro/mbed/commit/ffd558657c5c47dd311c937f6c716bc0b1c46e50/

commit 2f006d6f51ab4746d10f53d24667e551fa3a7896
Merge: a1e04f7 ca6d764
Author: 0xc0170 <c0170@rocketmail.com>
Date: Thu May 7 09:00:36 2015 +0100

Merge branch 'pinmap_stm32f1' of https://github.com/raulMrello/mbed into raulMrello-pinmap_stm32f1

commit ca6d7649a560d7a5c81f3486c4c340ede6a2bd19
Merge: 88e7489 d50b62d
Author: raulMrello <raul.martin.rello@gmail.com>
Date: Mon May 4 09:39:59 2015 +0200

Merge remote-tracking branch 'upstream/master' into pinmap_stm32f1

commit 88e74898622e58701d1153e5b757505246ba9e2b
Merge: dd27e29 ffaae4b
Author: raulMrello <raul.martin.rello@gmail.com>
Date: Mon May 4 09:27:28 2015 +0200

Merge remote-tracking branch 'upstream/master' into pinmap_stm32f1

commit dd27e29bde03eb80d019506ad7d788b57f9bbdb4
Merge: 3d1afb8 f54dc44
Author: raulMrello <raul.martin.rello@gmail.com>
Date: Mon May 4 09:24:33 2015 +0200

Merge remote-tracking branch 'upstream/master' into pinmap_stm32f1

commit 3d1afb814211328b8c044ee3dd22d39a077afba6
Author: raulMrello <raul.martin.rello@gmail.com>
Date: Mon May 4 09:16:01 2015 +0200

Updated pinmap.c in target_stm32f1

Changed in this revision

targets/hal/TARGET_STM/TARGET_STM32F1/pinmap.c Show annotated file Show diff for this revision Revisions of this file
--- 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)