Stuart Northfield / mbed-src

Fork of mbed-src by mbed official

Revision:
227:7bd0639b8911
Parent:
113:65a335a675de
diff -r b062af740e40 -r 7bd0639b8911 targets/hal/TARGET_NXP/TARGET_LPC23XX/gpio_api.c
--- a/targets/hal/TARGET_NXP/TARGET_LPC23XX/gpio_api.c	Wed Jun 11 09:45:09 2014 +0100
+++ b/targets/hal/TARGET_NXP/TARGET_LPC23XX/gpio_api.c	Wed Jun 11 16:00:09 2014 +0100
@@ -13,6 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+#include "mbed_assert.h"
 #include "gpio_api.h"
 #include "pinmap.h"
 
@@ -25,8 +26,8 @@
 }
 
 void gpio_init(gpio_t *obj, PinName pin) {
-    if (pin == NC) return;
-    
+    if (pin == (PinName)NC)
+        return;
     obj->pin = pin;
     obj->mask = gpio_set(pin);
     
@@ -43,6 +44,8 @@
 }
 
 void gpio_dir(gpio_t *obj, PinDirection direction) {
+    if (obj->pin == (PinName)NC)
+        return;
     switch (direction) {
         case PIN_INPUT : *obj->reg_dir &= ~obj->mask; break;
         case PIN_OUTPUT: *obj->reg_dir |=  obj->mask; break;