Ken Todotani / mbed-src

Fork of mbed-src by mbed official

Revision:
227:7bd0639b8911
Parent:
174:8bb9f3a33240
Child:
250:a49055e7a707
--- a/targets/hal/TARGET_STM/TARGET_NUCLEO_F103RB/pinmap.c	Wed Jun 11 09:45:09 2014 +0100
+++ b/targets/hal/TARGET_STM/TARGET_NUCLEO_F103RB/pinmap.c	Wed Jun 11 16:00:09 2014 +0100
@@ -27,6 +27,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *******************************************************************************
  */
+#include "mbed_assert.h"
 #include "pinmap.h"
 #include "PortNames.h"
 #include "error.h"
@@ -77,8 +78,7 @@
  * Configure pin (input, output, alternate function or analog) + output speed + AF
  */
 void pin_function(PinName pin, int data) {
-    if (pin == NC) return;
-
+    MBED_ASSERT(pin != (PinName)NC);
     // Get the pin informations
     uint32_t mode  = STM_PIN_MODE(data);
     uint32_t afnum = STM_PIN_AFNUM(data);
@@ -120,10 +120,9 @@
  * Configure pin pull-up/pull-down
  */
 void pin_mode(PinName pin, PinMode mode) {
+    MBED_ASSERT(pin != (PinName)NC);
     GPIO_InitTypeDef GPIO_InitStructure;
 
-    if (pin == NC) return;
-
     uint32_t port_index = STM_PORT(pin);
     uint32_t pin_index  = STM_PIN(pin);