mbed libraries for KL25Z

Dependents:   FRDM_RGBLED

Revision:
8:c14af7958ef5
Child:
9:663789d7729f
diff -r 73c5efe92a6c -r c14af7958ef5 KL25Z/gpio_object.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/KL25Z/gpio_object.h	Fri Nov 09 11:33:53 2012 +0000
@@ -0,0 +1,36 @@
+/* mbed Microcontroller Library - gpio_object
+ * Copyright (c) 2009-2011 ARM Limited. All rights reserved.
+ */
+#ifndef MBED_GPIO_OBJECT_H
+#define MBED_GPIO_OBJECT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct {
+    PinName  pin;
+    uint32_t mask;
+    
+    __IO uint32_t *reg_dir;
+    __IO uint32_t *reg_set;
+    __IO uint32_t *reg_clr;
+    __I  uint32_t *reg_in;
+} gpio_object;
+
+static inline void gpio_write(gpio_object *obj, int value) {
+    if (value)
+        *obj->reg_set = obj->mask;
+    else
+        *obj->reg_clr = obj->mask;
+}
+
+static inline int gpio_read(gpio_object *obj) {
+    return ((*obj->reg_in & obj->mask) ? 1 : 0);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif