mbed libraries for KL25Z

Dependents:   FRDM_RGBLED

Files at this revision

API Documentation at this revision

Comitter:
emilmont
Date:
Mon Feb 18 09:41:56 2013 +0000
Parent:
8:c14af7958ef5
Commit message:
Update mbed-KL25Z to latest build

Changed in this revision

AnalogIn.h Show annotated file Show diff for this revision Revisions of this file
AnalogOut.h Show annotated file Show diff for this revision Revisions of this file
BusIn.h Show annotated file Show diff for this revision Revisions of this file
BusInOut.h Show annotated file Show diff for this revision Revisions of this file
BusOut.h Show annotated file Show diff for this revision Revisions of this file
CAN.h Show annotated file Show diff for this revision Revisions of this file
DigitalIn.h Show annotated file Show diff for this revision Revisions of this file
DigitalInOut.h Show annotated file Show diff for this revision Revisions of this file
DigitalOut.h Show annotated file Show diff for this revision Revisions of this file
DirHandle.h Show annotated file Show diff for this revision Revisions of this file
Ethernet.h Show annotated file Show diff for this revision Revisions of this file
FileBase.h Show annotated file Show diff for this revision Revisions of this file
FileHandle.h Show annotated file Show diff for this revision Revisions of this file
FileLike.h Show annotated file Show diff for this revision Revisions of this file
FilePath.h Show annotated file Show diff for this revision Revisions of this file
FileSystemLike.h Show annotated file Show diff for this revision Revisions of this file
FunctionPointer.h Show annotated file Show diff for this revision Revisions of this file
I2C.h Show annotated file Show diff for this revision Revisions of this file
I2CSlave.h Show annotated file Show diff for this revision Revisions of this file
InterruptIn.h Show annotated file Show diff for this revision Revisions of this file
KL25Z/ARM/capi.ar Show diff for this revision Revisions of this file
KL25Z/ARM/cmsis_nvic.o Show annotated file Show diff for this revision Revisions of this file
KL25Z/ARM/core_cm0.o Show annotated file Show diff for this revision Revisions of this file
KL25Z/ARM/cpp.ar Show diff for this revision Revisions of this file
KL25Z/ARM/mbed.ar Show annotated file Show diff for this revision Revisions of this file
KL25Z/ARM/startup_MKL25Z4.o Show annotated file Show diff for this revision Revisions of this file
KL25Z/ARM/sys.o Show annotated file Show diff for this revision Revisions of this file
KL25Z/ARM/system_MKL25Z4.o Show annotated file Show diff for this revision Revisions of this file
KL25Z/PeripheralNames.h Show annotated file Show diff for this revision Revisions of this file
KL25Z/PinNames.h Show annotated file Show diff for this revision Revisions of this file
KL25Z/PortNames.h Show annotated file Show diff for this revision Revisions of this file
KL25Z/core_cm0plus.h Show annotated file Show diff for this revision Revisions of this file
KL25Z/core_cmInstr.h Show annotated file Show diff for this revision Revisions of this file
KL25Z/device.h Show annotated file Show diff for this revision Revisions of this file
KL25Z/gpio_object.h Show annotated file Show diff for this revision Revisions of this file
KL25Z/objects.h Show annotated file Show diff for this revision Revisions of this file
KL25Z/uARM/capi.ar Show diff for this revision Revisions of this file
KL25Z/uARM/cmsis_nvic.o Show annotated file Show diff for this revision Revisions of this file
KL25Z/uARM/core_cm0.o Show annotated file Show diff for this revision Revisions of this file
KL25Z/uARM/cpp.ar Show diff for this revision Revisions of this file
KL25Z/uARM/mbed.ar Show annotated file Show diff for this revision Revisions of this file
KL25Z/uARM/startup_MKL25Z4.o Show annotated file Show diff for this revision Revisions of this file
KL25Z/uARM/sys.o Show annotated file Show diff for this revision Revisions of this file
KL25Z/uARM/system_MKL25Z4.o Show annotated file Show diff for this revision Revisions of this file
LocalFileSystem.h Show annotated file Show diff for this revision Revisions of this file
PortIn.h Show annotated file Show diff for this revision Revisions of this file
PortInOut.h Show annotated file Show diff for this revision Revisions of this file
PortOut.h Show annotated file Show diff for this revision Revisions of this file
PwmOut.h Show annotated file Show diff for this revision Revisions of this file
SPI.h Show annotated file Show diff for this revision Revisions of this file
SPIHalfDuplex.h Show diff for this revision Revisions of this file
SPISlave.h Show annotated file Show diff for this revision Revisions of this file
Serial.h Show annotated file Show diff for this revision Revisions of this file
SerialHalfDuplex.h Show diff for this revision Revisions of this file
Stream.h Show annotated file Show diff for this revision Revisions of this file
Ticker.h Show annotated file Show diff for this revision Revisions of this file
Timeout.h Show annotated file Show diff for this revision Revisions of this file
Timer.h Show annotated file Show diff for this revision Revisions of this file
TimerEvent.h Show annotated file Show diff for this revision Revisions of this file
analogin_api.h Show annotated file Show diff for this revision Revisions of this file
analogout_api.h Show annotated file Show diff for this revision Revisions of this file
can_api.h Show annotated file Show diff for this revision Revisions of this file
can_helper.h Show annotated file Show diff for this revision Revisions of this file
error.h Show annotated file Show diff for this revision Revisions of this file
ethernet_api.h Show annotated file Show diff for this revision Revisions of this file
gpio_api.h Show annotated file Show diff for this revision Revisions of this file
gpio_irq_api.h Show annotated file Show diff for this revision Revisions of this file
i2c_api.h Show annotated file Show diff for this revision Revisions of this file
mbed.h Show annotated file Show diff for this revision Revisions of this file
mbed_debug.h Show annotated file Show diff for this revision Revisions of this file
mbed_interface.h Show annotated file Show diff for this revision Revisions of this file
pinmap.h Show annotated file Show diff for this revision Revisions of this file
platform.h Show annotated file Show diff for this revision Revisions of this file
port_api.h Show annotated file Show diff for this revision Revisions of this file
pwmout_api.h Show annotated file Show diff for this revision Revisions of this file
rtc_api.h Show annotated file Show diff for this revision Revisions of this file
rtc_time.h Show annotated file Show diff for this revision Revisions of this file
semihost_api.h Show annotated file Show diff for this revision Revisions of this file
serial_api.h Show annotated file Show diff for this revision Revisions of this file
sleep_api.h Show annotated file Show diff for this revision Revisions of this file
spi_api.h Show annotated file Show diff for this revision Revisions of this file
toolchain.h Show annotated file Show diff for this revision Revisions of this file
us_ticker_api.h Show annotated file Show diff for this revision Revisions of this file
wait_api.h Show annotated file Show diff for this revision Revisions of this file
--- a/AnalogIn.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/AnalogIn.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,5 +1,17 @@
-/* mbed Microcontroller Library - AnalogIn
- * Copyright (c) 2006-2011 ARM Limited. All rights reserved.
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 #ifndef MBED_ANALOGIN_H
 #define MBED_ANALOGIN_H
@@ -8,6 +20,8 @@
 
 #if DEVICE_ANALOGIN
 
+#include "analogin_api.h"
+
 namespace mbed {
 
 /** An analog input, used for reading the voltage on a pin
@@ -15,11 +29,11 @@
  * Example:
  * @code
  * // Print messages when the AnalogIn is greater than 50%
- * 
+ *
  * #include "mbed.h"
- * 
+ *
  * AnalogIn temperature(p20);
- * 
+ *
  * int main() {
  *     while(1) {
  *         if(temperature > 0.5) {
@@ -35,23 +49,29 @@
 
     /** Create an AnalogIn, connected to the specified pin
      *
-     * @param pin AnalogIn pin to connect to 
+     * @param pin AnalogIn pin to connect to
      * @param name (optional) A string to identify the object
      */
-    AnalogIn(PinName pin);
-    
+    AnalogIn(PinName pin) {
+        analogin_init(&_adc, pin);
+    }
+
     /** Read the input voltage, represented as a float in the range [0.0, 1.0]
      *
      * @returns A floating-point value representing the current input voltage, measured as a percentage
      */
-    float read();
+    float read() {
+        return analogin_read(&_adc);
+    }
 
     /** Read the input voltage, represented as an unsigned short in the range [0x0, 0xFFFF]
      *
      * @returns
-     *   16-bit unsigned short representing the current input voltage, normalised to a 16-bit value 
+     *   16-bit unsigned short representing the current input voltage, normalised to a 16-bit value
      */
-    unsigned short read_u16();
+    unsigned short read_u16() {
+        return analogin_read_u16(&_adc);
+    }
 
 #ifdef MBED_OPERATORS
     /** An operator shorthand for read()
@@ -62,16 +82,18 @@
      * @code
      * float x = volume.read();
      * float x = volume;
-     * 
+     *
      * if(volume.read() > 0.25) { ... }
      * if(volume > 0.25) { ... }
      * @endcode
      */
-    operator float();
+    operator float() {
+        return read();
+    }
 #endif
 
 protected:
-    ADCName _adc;
+    analogin_t _adc;
 };
 
 } // namespace mbed
--- a/AnalogOut.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/AnalogOut.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,5 +1,17 @@
-/* mbed Microcontroller Library - AnalogOut
- * Copyright (c) 2006-2011 ARM Limited. All rights reserved.
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 #ifndef MBED_ANALOGOUT_H
 #define MBED_ANALOGOUT_H
@@ -8,6 +20,8 @@
 
 #if DEVICE_ANALOGOUT
 
+#include "analogout_api.h"
+
 namespace mbed {
 
 /** An analog output, used for setting the voltage on a pin
@@ -15,9 +29,9 @@
  * Example:
  * @code
  * // Make a sawtooth output
- *  
+ *
  * #include "mbed.h"
- *  
+ *
  * AnalogOut tri(p18);
  * int main() {
  *     while(1) {
@@ -35,52 +49,69 @@
 public:
 
     /** Create an AnalogOut connected to the specified pin
-     * 
+     *
      *  @param AnalogOut pin to connect to (18)
      */
-    AnalogOut(PinName pin);
-    
+    AnalogOut(PinName pin) {
+        analogout_init(&_dac, pin);
+    }
+
     /** Set the output voltage, specified as a percentage (float)
      *
-     *  @param value A floating-point value representing the output voltage, 
+     *  @param value A floating-point value representing the output voltage,
      *    specified as a percentage. The value should lie between
      *    0.0f (representing 0v / 0%) and 1.0f (representing 3.3v / 100%).
      *    Values outside this range will be saturated to 0.0f or 1.0f.
      */
-    void write(float value);
-    
+    void write(float value) {
+        analogout_write(&_dac, value);
+    }
+
     /** Set the output voltage, represented as an unsigned short in the range [0x0, 0xFFFF]
      *
      *  @param value 16-bit unsigned short representing the output voltage,
      *            normalised to a 16-bit value (0x0000 = 0v, 0xFFFF = 3.3v)
      */
-    void write_u16(unsigned short value);
+    void write_u16(unsigned short value) {
+        analogout_write_u16(&_dac, value);
+    }
 
     /** Return the current output voltage setting, measured as a percentage (float)
      *
      *  @returns
-     *    A floating-point value representing the current voltage being output on the pin, 
+     *    A floating-point value representing the current voltage being output on the pin,
      *    measured as a percentage. The returned value will lie between
      *    0.0f (representing 0v / 0%) and 1.0f (representing 3.3v / 100%).
      *
      *  @note
      *    This value may not match exactly the value set by a previous write().
      */
-    float read();
+    float read() {
+        return analogout_read(&_dac);
+    }
 
 #ifdef MBED_OPERATORS
     /** An operator shorthand for write()
      */
-    AnalogOut& operator= (float percent);
-    AnalogOut& operator= (AnalogOut& rhs);
+    AnalogOut& operator= (float percent) {
+        write(percent);
+        return *this;
+    }
+
+    AnalogOut& operator= (AnalogOut& rhs) {
+        write(rhs.read());
+        return *this;
+    }
 
     /** An operator shorthand for read()
      */
-    operator float();
+    operator float() {
+        return read();
+    }
 #endif
 
 protected:
-    DACName _dac;
+    dac_t _dac;
 };
 
 } // namespace mbed
--- a/BusIn.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/BusIn.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,5 +1,17 @@
-/* mbed Microcontroller Library - DigitalIn
- * Copyright (c) 2007-2009 ARM Limited. All rights reserved.
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 #ifndef MBED_BUSIN_H
 #define MBED_BUSIN_H
@@ -23,16 +35,16 @@
      * @note
      *  It is only required to specify as many pin variables as is required
      *  for the bus; the rest will default to NC (not connected)
-     */ 
+     */
     BusIn(PinName p0, PinName p1 = NC, PinName p2 = NC, PinName p3 = NC,
           PinName p4 = NC, PinName p5 = NC, PinName p6 = NC, PinName p7 = NC,
           PinName p8 = NC, PinName p9 = NC, PinName p10 = NC, PinName p11 = NC,
           PinName p12 = NC, PinName p13 = NC, PinName p14 = NC, PinName p15 = NC);
 
     BusIn(PinName pins[16]);
-    
+
     virtual ~BusIn();
-    
+
     /** Read the value of the input bus
      *
      *  @returns
--- a/BusInOut.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/BusInOut.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,5 +1,17 @@
-/* mbed Microcontroller Library - BusInOut
- * Copyright (c) 2009 ARM Limited. All rights reserved.
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 #ifndef MBED_BUSINOUT_H
 #define MBED_BUSINOUT_H
@@ -13,7 +25,7 @@
 class BusInOut {
 
 public:
-    
+
     /** Create an BusInOut, connected to the specified pins
      *
      *  @param p<n> DigitalInOut pin to connect to bus bit p<n> (p5-p30, NC)
@@ -21,7 +33,7 @@
      *  @note
      *  It is only required to specify as many pin variables as is required
      *  for the bus; the rest will default to NC (not connected)
-        */ 
+     */
     BusInOut(PinName p0, PinName p1 = NC, PinName p2 = NC, PinName p3 = NC,
              PinName p4 = NC, PinName p5 = NC, PinName p6 = NC, PinName p7 = NC,
              PinName p8 = NC, PinName p9 = NC, PinName p10 = NC, PinName p11 = NC,
@@ -39,7 +51,7 @@
      */
     void write(int value);
 
-        
+
     /** Read the value currently output on the bus
      *
      *  @returns
@@ -60,7 +72,7 @@
      *  @param mode PullUp, PullDown, PullNone
      */
     void mode(PinMode pull);
- 
+
 #ifdef MBED_OPERATORS
      /** A shorthand for write()
      */
--- a/BusOut.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/BusOut.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,5 +1,17 @@
-/* mbed Microcontroller Library - BusOut
- * Copyright (c) 2007-2009 ARM Limited. All rights reserved.
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 #ifndef MBED_BUSOUT_H
 #define MBED_BUSOUT_H
@@ -21,7 +33,7 @@
      *  @note
      *  It is only required to specify as many pin variables as is required
      *  for the bus; the rest will default to NC (not connected)
-        */ 
+     */
     BusOut(PinName p0, PinName p1 = NC, PinName p2 = NC, PinName p3 = NC,
            PinName p4 = NC, PinName p5 = NC, PinName p6 = NC, PinName p7 = NC,
            PinName p8 = NC, PinName p9 = NC, PinName p10 = NC, PinName p11 = NC,
--- a/CAN.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/CAN.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,5 +1,17 @@
-/* mbed Microcontroller Library - can
- * Copyright (c) 2009-2011 ARM Limited. All rights reserved.
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 #ifndef MBED_CAN_H
 #define MBED_CAN_H
@@ -8,11 +20,10 @@
 
 #if DEVICE_CAN
 
-#include "can_helper.h" 
+#include "can_api.h"
+#include "can_helper.h"
 #include "FunctionPointer.h"
 
-#include <string.h>
-
 namespace mbed {
 
 /** CANMessage class
@@ -29,7 +40,7 @@
         id     = 0;
         memset(data, 0, 8);
     }
-    
+
     /** Creates CAN message with specific content.
      */
     CANMessage(int _id, const char *_data, char _len = 8, CANType _type = CANData, CANFormat _format = CANStandard) {
@@ -64,23 +75,23 @@
      * Example:
      * @code
      * #include "mbed.h"
-     *  
+     *
      * Ticker ticker;
      * DigitalOut led1(LED1);
      * DigitalOut led2(LED2);
      * CAN can1(p9, p10);
      * CAN can2(p30, p29);
-     *  
+     *
      * char counter = 0;
-     *  
+     *
      * void send() {
      *     if(can1.write(CANMessage(1337, &counter, 1))) {
      *         printf("Message sent: %d\n", counter);
      *         counter++;
-     *     } 
+     *     }
      *     led1 = !led1;
      * }
-     *  
+     *
      * int main() {
      *     ticker.attach(&send, 1);
      *    CANMessage msg;
@@ -88,15 +99,15 @@
      *         if(can2.read(msg)) {
      *             printf("Message received: %d\n\n", msg.data[0]);
      *             led2 = !led2;
-     *         } 
+     *         }
      *         wait(0.2);
      *     }
-     * } 
+     * }
      * @endcode
      */
     CAN(PinName rd, PinName td);
     virtual ~CAN();
-    
+
     /** Set the frequency of the CAN interface
      *
      *  @param hz The bus frequency in hertz
@@ -106,7 +117,7 @@
      *    0 otherwise
      */
     int frequency(int hz);
-    
+
     /** Write a CANMessage to the bus.
      *
      *  @param msg The CANMessage to write.
@@ -116,9 +127,9 @@
      *    1 if write was successful
      */
     int write(CANMessage msg);
-    
+
     /** Read a CANMessage from the bus.
-     * 
+     *
      *  @param msg A CANMessage to read to.
      *
      *  @returns
@@ -126,19 +137,19 @@
      *    1 if message arrived
      */
     int read(CANMessage &msg);
-    
+
     /** Reset CAN interface.
      *
      * To use after error overflow.
      */
     void reset();
-    
+
     /** Puts or removes the CAN interface into silent monitoring mode
      *
      *  @param silent boolean indicating whether to go into silent mode or not
      */
     void monitor(bool silent);
-    
+
     /** Returns number of read errors to detect read overflow errors.
      */
     unsigned char rderror();
@@ -153,7 +164,7 @@
      *  @param fptr A pointer to a void function, or 0 to set as none
      */
     void attach(void (*fptr)(void));
-   
+
    /** Attach a member function to call whenever a CAN frame received interrupt
     *  is generated.
     *
@@ -169,11 +180,11 @@
             remove_interrupt();
         }
     }
-    
+
 private:
-    CANName _id;
+    can_t _can;
     FunctionPointer _rxirq;
-    
+
     void setup_interrupt(void);
     void remove_interrupt(void);
 };
--- a/DigitalIn.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/DigitalIn.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,5 +1,17 @@
-/* mbed Microcontroller Library - DigitalIn
- * Copyright (c) 2006-2011 ARM Limited. All rights reserved.
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 #ifndef MBED_DIGITALIN_H
 #define MBED_DIGITALIN_H
@@ -15,12 +27,12 @@
  * Example:
  * @code
  * // Flash an LED while a DigitalIn is true
- * 
+ *
  * #include "mbed.h"
- * 
+ *
  * DigitalIn enable(p5);
  * DigitalOut led(LED1);
- * 
+ *
  * int main() {
  *     while(1) {
  *         if(enable) {
@@ -39,22 +51,28 @@
      *  @param pin DigitalIn pin to connect to
      *  @param name (optional) A string to identify the object
      */
-    DigitalIn(PinName pin);
-    
+    DigitalIn(PinName pin) {
+        gpio_init(&gpio, pin, PIN_INPUT);
+    }
+
     /** Read the input, represented as 0 or 1 (int)
      *
      *  @returns
-     *    An integer representing the state of the input pin, 
+     *    An integer representing the state of the input pin,
      *    0 for logical 0, 1 for logical 1
      */
-    int read();
-    
+    int read() {
+        return gpio_read(&gpio);
+    }
+
     /** Set the input pin mode
      *
      *  @param mode PullUp, PullDown, PullNone, OpenDrain
      */
-    void mode(PinMode pull);
-    
+    void mode(PinMode pull) {
+        gpio_mode(&gpio, pull);
+    }
+
 #ifdef MBED_OPERATORS
     /** An operator shorthand for read()
      */
@@ -64,7 +82,7 @@
 #endif
 
 protected:
-    gpio_object gpio;
+    gpio_t gpio;
 };
 
 } // namespace mbed
--- a/DigitalInOut.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/DigitalInOut.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,79 +1,103 @@
-/* mbed Microcontroller Library - DigitalInOut
- * Copyright (c) 2006-2011 ARM Limited. All rights reserved.
- */
-#ifndef MBED_DIGITALINOUT_H
-#define MBED_DIGITALINOUT_H
-
-#include "platform.h"
-
-#include "gpio_api.h"
-
-namespace mbed {
-
-/** A digital input/output, used for setting or reading a bi-directional pin
- */
-class DigitalInOut {
-
-public:
-    /** Create a DigitalInOut connected to the specified pin
-     *
-     *  @param pin DigitalInOut pin to connect to
-     */
-    DigitalInOut(PinName pin);
-    
-    /** Set the output, specified as 0 or 1 (int)
-     *
-     *  @param value An integer specifying the pin output value, 
-     *      0 for logical 0, 1 (or any other non-zero value) for logical 1 
-     */
-    void write(int value);
-    
-    /** Return the output setting, represented as 0 or 1 (int)
-     *
-     *  @returns
-     *    an integer representing the output setting of the pin if it is an output, 
-     *    or read the input if set as an input
-     */
-    int read();
-    
-    /** Set as an output
-     */
-    void output();
-    
-    /** Set as an input
-     */
-    void input();
-    
-    /** Set the input pin mode
-     *
-     *  @param mode PullUp, PullDown, PullNone, OpenDrain
-     */
-    void mode(PinMode pull);
-    
-#ifdef MBED_OPERATORS
-    /** A shorthand for write()
-     */
-    DigitalInOut& operator= (int value) {
-        write(value);
-        return *this;
-    }
-    
-    DigitalInOut& operator= (DigitalInOut& rhs) {
-        write(rhs.read());
-        return *this;
-    }
-    
-    /** A shorthand for read()
-     */
-    operator int() {
-        return read();
-    }
-#endif
-
-protected:
-    gpio_object gpio;
-};
-
-} // namespace mbed
-
-#endif
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef MBED_DIGITALINOUT_H
+#define MBED_DIGITALINOUT_H
+
+#include "platform.h"
+
+#include "gpio_api.h"
+
+namespace mbed {
+
+/** A digital input/output, used for setting or reading a bi-directional pin
+ */
+class DigitalInOut {
+
+public:
+    /** Create a DigitalInOut connected to the specified pin
+     *
+     *  @param pin DigitalInOut pin to connect to
+     */
+    DigitalInOut(PinName pin) {
+        gpio_init(&gpio, pin, PIN_INPUT);
+    }
+
+    /** Set the output, specified as 0 or 1 (int)
+     *
+     *  @param value An integer specifying the pin output value,
+     *      0 for logical 0, 1 (or any other non-zero value) for logical 1
+     */
+    void write(int value) {
+        gpio_write(&gpio, value);
+    }
+
+    /** Return the output setting, represented as 0 or 1 (int)
+     *
+     *  @returns
+     *    an integer representing the output setting of the pin if it is an output,
+     *    or read the input if set as an input
+     */
+    int read() {
+        return gpio_read(&gpio);
+    }
+
+    /** Set as an output
+     */
+    void output() {
+        gpio_dir(&gpio, PIN_OUTPUT);
+    }
+
+    /** Set as an input
+     */
+    void input() {
+        gpio_dir(&gpio, PIN_INPUT);
+    }
+
+    /** Set the input pin mode
+     *
+     *  @param mode PullUp, PullDown, PullNone, OpenDrain
+     */
+    void mode(PinMode pull) {
+        gpio_mode(&gpio, pull);
+    }
+
+#ifdef MBED_OPERATORS
+    /** A shorthand for write()
+     */
+    DigitalInOut& operator= (int value) {
+        write(value);
+        return *this;
+    }
+
+    DigitalInOut& operator= (DigitalInOut& rhs) {
+        write(rhs.read());
+        return *this;
+    }
+
+    /** A shorthand for read()
+     */
+    operator int() {
+        return read();
+    }
+#endif
+
+protected:
+    gpio_t gpio;
+};
+
+} // namespace mbed
+
+#endif
--- a/DigitalOut.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/DigitalOut.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,5 +1,17 @@
-/* mbed Microcontroller Library - DigitalOut
- * Copyright (c) 2006-2011 ARM Limited. All rights reserved.
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 #ifndef MBED_DIGITALOUT_H
 #define MBED_DIGITALOUT_H
@@ -15,9 +27,9 @@
  * @code
  * // Toggle a LED
  * #include "mbed.h"
- * 
+ *
  * DigitalOut led(LED1);
- * 
+ *
  * int main() {
  *     while(1) {
  *         led = !led;
@@ -33,27 +45,29 @@
      *
      *  @param pin DigitalOut pin to connect to
      */
-    DigitalOut(PinName pin);
-    
+    DigitalOut(PinName pin) {
+        gpio_init(&gpio, pin, PIN_OUTPUT);
+    }
+
     /** Set the output, specified as 0 or 1 (int)
      *
-     *  @param value An integer specifying the pin output value, 
-     *      0 for logical 0, 1 (or any other non-zero value) for logical 1 
+     *  @param value An integer specifying the pin output value,
+     *      0 for logical 0, 1 (or any other non-zero value) for logical 1
      */
     void write(int value) {
         gpio_write(&gpio, value);
     }
-    
+
     /** Return the output setting, represented as 0 or 1 (int)
      *
      *  @returns
-     *    an integer representing the output setting of the pin, 
+     *    an integer representing the output setting of the pin,
      *    0 for logical 0, 1 for logical 1
      */
     int read() {
         return gpio_read(&gpio);
     }
-    
+
 #ifdef MBED_OPERATORS
     /** A shorthand for write()
      */
@@ -61,12 +75,12 @@
         write(value);
         return *this;
     }
-    
+
     DigitalOut& operator= (DigitalOut& rhs) {
         write(rhs.read());
         return *this;
     }
-    
+
     /** A shorthand for read()
      */
     operator int() {
@@ -75,9 +89,9 @@
 #endif
 
 protected:
-    gpio_object gpio;
+    gpio_t gpio;
 };
 
 } // namespace mbed
 
-#endif 
+#endif
--- a/DirHandle.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/DirHandle.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,15 +1,29 @@
-/* mbed Microcontroller Library - DirHandler
- * Copyright (c) 2008-2009 ARM Limited. All rights reserved.
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 #ifndef MBED_DIRHANDLE_H
 #define MBED_DIRHANDLE_H
 
-#ifdef __ARMCC_VERSION
-# define NAME_MAX 255
+#if defined(__ARMCC_VERSION) || defined(__ICCARM__)
+#   define NAME_MAX 255
 typedef int mode_t;
+
 #else
-# include <sys/syslimits.h>
+#   include <sys/syslimits.h>
 #endif
+
 #include "FileHandle.h"
 
 struct dirent {
@@ -23,7 +37,7 @@
  *  at least closedir, readdir and rewinddir.
  *
  *  If a FileSystemLike class defines the opendir method, then the
- *  directories of an object of that type can be accessed by 
+ *  directories of an object of that type can be accessed by
  *  DIR *d = opendir("/example/directory") (or opendir("/example")
  *  to open the root of the filesystem), and then using readdir(d) etc.
  *
@@ -41,7 +55,7 @@
      *   -1 on error.
      */
     virtual int closedir()=0;
-    
+
     /** Return the directory entry at the current position, and
      *  advances the position to the next entry.
      *
@@ -69,7 +83,7 @@
      *  @param location The location to seek to. Must be a value returned by telldir.
      */
     virtual void seekdir(off_t location) { }
-    
+
     virtual ~DirHandle() {}
 };
 
--- a/Ethernet.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/Ethernet.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,158 +1,170 @@
-/* mbed Microcontroller Library - Ethernet
- * Copyright (c) 2009-2011 ARM Limited. All rights reserved.
- */
-#ifndef MBED_ETHERNET_H
-#define MBED_ETHERNET_H
-
-#include "platform.h"
-
-#if DEVICE_ETHERNET
-
-namespace mbed {
-
-/** An ethernet interface, to use with the ethernet pins.
- *
- * Example:
- * @code
- * // Read destination and source from every ethernet packet
- * 
- * #include "mbed.h"
- *
- * Ethernet eth;
- *  
- * int main() {
- *     char buf[0x600];
- *     
- *     while(1) {
- *         int size = eth.receive();
- *         if(size > 0) {
- *             eth.read(buf, size);
- *             printf("Destination:  %02X:%02X:%02X:%02X:%02X:%02X\n",
- *                     buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
- *             printf("Source: %02X:%02X:%02X:%02X:%02X:%02X\n",
- *                     buf[6], buf[7], buf[8], buf[9], buf[10], buf[11]);
- *         }
- *         
- *         wait(1);
- *     }
- * }
- * @endcode
- */
-class Ethernet {
-
-public:
-    
-    /** Initialise the ethernet interface.
-     */
-    Ethernet();
-
-    /** Powers the hardware down.
-     */
-    virtual ~Ethernet();
-
-    enum Mode {
-        AutoNegotiate,
-        HalfDuplex10,
-        FullDuplex10,
-        HalfDuplex100,
-        FullDuplex100
-    };
-
-    /** Writes into an outgoing ethernet packet.
-     *
-     *  It will append size bytes of data to the previously written bytes.
-     *  
-     *  @param data An array to write.
-     *  @param size The size of data.
-     *
-     *  @returns
-     *   The number of written bytes.
-     */
-    int write(const char *data, int size);
-
-    /** Send an outgoing ethernet packet.
-     *
-     *  After filling in the data in an ethernet packet it must be send.
-     *  Send will provide a new packet to write to.
-     *
-     *  @returns
-     *    0 if the sending was failed,
-     *    1 if the package is successfully sent.
-     */
-    int send();
-
-    /** Recevies an arrived ethernet packet.
-     *
-     *  Receiving an ethernet packet will drop the last received ethernet packet 
-     *  and make a new ethernet packet ready to read.
-     *  If no ethernet packet is arrived it will return 0.
-     *
-     *  @returns
-     *    0 if no ethernet packet is arrived,
-     *    or the size of the arrived packet.
-     */
-    int receive();
-
-    /** Read from an recevied ethernet packet.
-     *
-     *  After receive returnd a number bigger than 0it is
-     *  possible to read bytes from this packet.
-     *  Read will write up to size bytes into data.
-     *
-     *  It is possible to use read multible times. 
-     *  Each time read will start reading after the last read byte before.
-     *
-     *  @returns
-     *  The number of byte read.
-     */
-    int read(char *data, int size);
-    
-    /** Gives the ethernet address of the mbed.
-     *
-     *  @param mac Must be a pointer to a 6 byte char array to copy the ethernet address in.
-     */
-    void address(char *mac);
-
-    /** Returns if an ethernet link is pressent or not. It takes a wile after Ethernet initializion to show up.
-     * 
-     *  @returns
-     *   0 if no ethernet link is pressent,
-     *   1 if an ethernet link is pressent.
-     *
-     * Example:
-     * @code
-     * // Using the Ethernet link function
-     * #include "mbed.h"
-     * 
-     * Ethernet eth;
-     *
-     * int main() {
-     *     wait(1); // Needed after startup.
-     *     if (eth.link()) {
-     *          printf("online\n");
-     *     } else {
-     *          printf("offline\n");
-     *     }
-     * }
-     * @endcode
-     */
-    int link();
-
-    /** Sets the speed and duplex parameters of an ethernet link
-     *
-     * - AutoNegotiate      Auto negotiate speed and duplex
-     * - HalfDuplex10       10 Mbit, half duplex
-     * - FullDuplex10       10 Mbit, full duplex
-     * - HalfDuplex100      100 Mbit, half duplex
-     * - FullDuplex100      100 Mbit, full duplex
-     *
-     *  @param mode the speed and duplex mode to set the link to:
-     */
-    void set_link(Mode mode);
-};
-
-} // namespace mbed
-
-#endif
-
-#endif
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef MBED_ETHERNET_H
+#define MBED_ETHERNET_H
+
+#include "platform.h"
+
+#if DEVICE_ETHERNET
+
+namespace mbed {
+
+/** An ethernet interface, to use with the ethernet pins.
+ *
+ * Example:
+ * @code
+ * // Read destination and source from every ethernet packet
+ *
+ * #include "mbed.h"
+ *
+ * Ethernet eth;
+ *
+ * int main() {
+ *     char buf[0x600];
+ *
+ *     while(1) {
+ *         int size = eth.receive();
+ *         if(size > 0) {
+ *             eth.read(buf, size);
+ *             printf("Destination:  %02X:%02X:%02X:%02X:%02X:%02X\n",
+ *                     buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
+ *             printf("Source: %02X:%02X:%02X:%02X:%02X:%02X\n",
+ *                     buf[6], buf[7], buf[8], buf[9], buf[10], buf[11]);
+ *         }
+ *
+ *         wait(1);
+ *     }
+ * }
+ * @endcode
+ */
+class Ethernet {
+
+public:
+
+    /** Initialise the ethernet interface.
+     */
+    Ethernet();
+
+    /** Powers the hardware down.
+     */
+    virtual ~Ethernet();
+
+    enum Mode {
+        AutoNegotiate,
+        HalfDuplex10,
+        FullDuplex10,
+        HalfDuplex100,
+        FullDuplex100
+    };
+
+    /** Writes into an outgoing ethernet packet.
+     *
+     *  It will append size bytes of data to the previously written bytes.
+     *
+     *  @param data An array to write.
+     *  @param size The size of data.
+     *
+     *  @returns
+     *   The number of written bytes.
+     */
+    int write(const char *data, int size);
+
+    /** Send an outgoing ethernet packet.
+     *
+     *  After filling in the data in an ethernet packet it must be send.
+     *  Send will provide a new packet to write to.
+     *
+     *  @returns
+     *    0 if the sending was failed,
+     *    1 if the package is successfully sent.
+     */
+    int send();
+
+    /** Recevies an arrived ethernet packet.
+     *
+     *  Receiving an ethernet packet will drop the last received ethernet packet
+     *  and make a new ethernet packet ready to read.
+     *  If no ethernet packet is arrived it will return 0.
+     *
+     *  @returns
+     *    0 if no ethernet packet is arrived,
+     *    or the size of the arrived packet.
+     */
+    int receive();
+
+    /** Read from an recevied ethernet packet.
+     *
+     *  After receive returnd a number bigger than 0it is
+     *  possible to read bytes from this packet.
+     *  Read will write up to size bytes into data.
+     *
+     *  It is possible to use read multible times.
+     *  Each time read will start reading after the last read byte before.
+     *
+     *  @returns
+     *  The number of byte read.
+     */
+    int read(char *data, int size);
+
+    /** Gives the ethernet address of the mbed.
+     *
+     *  @param mac Must be a pointer to a 6 byte char array to copy the ethernet address in.
+     */
+    void address(char *mac);
+
+    /** Returns if an ethernet link is pressent or not. It takes a wile after Ethernet initializion to show up.
+     *
+     *  @returns
+     *   0 if no ethernet link is pressent,
+     *   1 if an ethernet link is pressent.
+     *
+     * Example:
+     * @code
+     * // Using the Ethernet link function
+     * #include "mbed.h"
+     *
+     * Ethernet eth;
+     *
+     * int main() {
+     *     wait(1); // Needed after startup.
+     *     if (eth.link()) {
+     *          printf("online\n");
+     *     } else {
+     *          printf("offline\n");
+     *     }
+     * }
+     * @endcode
+     */
+    int link();
+
+    /** Sets the speed and duplex parameters of an ethernet link
+     *
+     * - AutoNegotiate      Auto negotiate speed and duplex
+     * - HalfDuplex10       10 Mbit, half duplex
+     * - FullDuplex10       10 Mbit, full duplex
+     * - HalfDuplex100      100 Mbit, half duplex
+     * - FullDuplex100      100 Mbit, full duplex
+     *
+     *  @param mode the speed and duplex mode to set the link to:
+     */
+    void set_link(Mode mode);
+};
+
+} // namespace mbed
+
+#endif
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/FileBase.h	Mon Feb 18 09:41:56 2013 +0000
@@ -0,0 +1,75 @@
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef MBED_FILEBASE_H
+#define MBED_FILEBASE_H
+
+typedef int FILEHANDLE;
+
+#include <stdio.h>
+
+#if defined(__ARMCC_VERSION) || defined(__ICCARM__)
+#    define O_RDONLY 0
+#    define O_WRONLY 1
+#    define O_RDWR   2
+#    define O_CREAT  0x0200
+#    define O_TRUNC  0x0400
+#    define O_APPEND 0x0008
+
+#    define NAME_MAX 255
+
+typedef int mode_t;
+typedef int ssize_t;
+typedef long off_t;
+
+#else
+#    include <sys/fcntl.h>
+#    include <sys/types.h>
+#    include <sys/syslimits.h>
+#endif
+
+#include "platform.h"
+
+namespace mbed {
+
+typedef enum {
+    FilePathType,
+    FileSystemPathType
+} PathType;
+
+class FileBase {
+public:
+    FileBase(const char *name, PathType t);
+
+    virtual ~FileBase();
+
+    const char* getName(void);
+    PathType    getPathType(void);
+
+    static FileBase *lookup(const char *name, unsigned int len);
+
+    static FileBase *get(int n);
+
+protected:
+    static FileBase *_head;
+
+    FileBase   *_next;
+    const char *_name;
+    PathType    _path_type;
+};
+
+} // namespace mbed
+
+#endif
--- a/FileHandle.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/FileHandle.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,5 +1,17 @@
-/* mbed Microcontroller Library - FileHandler
- * Copyright (c) 2007-2009 ARM Limited. All rights reserved.
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 #ifndef MBED_FILEHANDLE_H
 #define MBED_FILEHANDLE_H
@@ -7,14 +19,16 @@
 typedef int FILEHANDLE;
 
 #include <stdio.h>
-#ifdef __ARMCC_VERSION
+
+#if defined(__ARMCC_VERSION) || defined(__ICCARM__)
 typedef int ssize_t;
 typedef long off_t;
+
 #else
-#include <sys/types.h>
+#   include <sys/types.h>
 #endif
 
-namespace mbed { 
+namespace mbed {
 
 /** An OO equivalent of the internal FILEHANDLE variable
  *  and associated _sys_* functions.
@@ -22,7 +36,7 @@
  * FileHandle is an abstract class, needing at least sys_write and
  *  sys_read to be implmented for a simple interactive device.
  *
- * No one ever directly tals to/instanciates a FileHandle - it gets 
+ * No one ever directly tals to/instanciates a FileHandle - it gets
  *  created by FileSystem, and wrapped up by stdio.
  */
 class FileHandle {
@@ -96,7 +110,7 @@
         lseek(pos, SEEK_SET);
         return res;
     }
-    
+
     virtual ~FileHandle();
 };
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/FileLike.h	Mon Feb 18 09:41:56 2013 +0000
@@ -0,0 +1,44 @@
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef MBED_FILELIKE_H
+#define MBED_FILELIKE_H
+
+#include "FileBase.h"
+#include "FileHandle.h"
+
+namespace mbed {
+
+/* Class FileLike
+ *  A file-like object is one that can be opened with fopen by
+ *  fopen("/name", mode). It is intersection of the classes Base and
+ *  FileHandle.
+ */
+class FileLike : public FileHandle, public FileBase {
+
+public:
+    /* Constructor FileLike
+     *
+     * Variables
+     *  name - The name to use to open the file.
+     */
+    FileLike(const char *name);
+
+    virtual ~FileLike();
+};
+
+} // namespace mbed
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/FilePath.h	Mon Feb 18 09:41:56 2013 +0000
@@ -0,0 +1,45 @@
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef MBED_FILEPATH_H
+#define MBED_FILEPATH_H
+
+#include "platform.h"
+
+#include "FileSystemLike.h"
+#include "FileLike.h"
+
+namespace mbed {
+
+class FilePath {
+public:
+    FilePath(const char* file_path);
+
+    const char* fileName(void);
+
+    bool          isFileSystem(void);
+    FileSystemLike* fileSystem(void);
+
+    bool    isFile(void);
+    FileLike* file(void);
+
+private:
+    const char* file_name;
+    FileBase* fb;
+};
+
+} // namespace mbed
+
+#endif
--- a/FileSystemLike.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/FileSystemLike.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,132 +1,104 @@
-/* mbed Microcontroller Library - FileSystemLike
- * Copyright (c) 2008-2009 ARM Limited. All rights reserved.
- */
-#ifndef MBED_FILESYSTEMLIKE_H
-#define MBED_FILESYSTEMLIKE_H
-
-#ifdef __ARMCC_VERSION
-#    define O_RDONLY 0
-#    define O_WRONLY 1
-#    define O_RDWR   2
-#    define O_CREAT  0x0200
-#    define O_TRUNC  0x0400
-#    define O_APPEND 0x0008
-typedef int mode_t;
-
-#else
-#    include <sys/fcntl.h>
-#endif
-
-#include "platform.h"
-
-#include "FileHandle.h"
-#include "DirHandle.h"
-
-namespace mbed {
-
-/** A filesystem-like object is one that can be used to open files
- *  though it by fopen("/name/filename", mode)
- *
- *  Implementations must define at least open (the default definitions
- *  of the rest of the functions just return error values).
- */
-class FileSystemLike {
-
-public:
-    /** FileSystemLike constructor
-     *
-     *  @param name The name to use for the filesystem.
-     */
-    FileSystemLike(const char *name);
-    
-    virtual ~FileSystemLike();
-    
-    /* Function lookup
-     *  Lookup and return the object that has the given name.
-     *
-     * Variables
-     *  name - the name to lookup.
-     *  len - the length of name.
-     */
-    static FileSystemLike *lookup(const char *name, unsigned int len);
-    
-    static DirHandle *opendir();
-    friend class BaseDirHandle;
-    
-    /** Opens a file from the filesystem
-     *
-     *  @param filename The name of the file to open.
-     *  @param flags One of O_RDONLY, O_WRONLY, or O_RDWR, OR'd with
-     *    zero or more of O_CREAT, O_TRUNC, or O_APPEND.
-     *
-     *  @returns
-     *    A pointer to a FileHandle object representing the
-     *   file on success, or NULL on failure.
-     */
-    virtual FileHandle *open(const char *filename, int flags) = 0;
-
-    /** Remove a file from the filesystem.
-     *
-     *  @param filename the name of the file to remove.
-     *  @param returns 0 on success, -1 on failure.
-     */
-    virtual int remove(const char *filename) { return -1; };
-
-    /** Rename a file in the filesystem.
-     *
-     *  @param oldname the name of the file to rename.
-     *  @param newname the name to rename it to.
-     *
-     *  @returns
-     *    0 on success,
-     *   -1 on failure.
-     */
-    virtual int rename(const char *oldname, const char *newname) { return -1; };
-
-    /** Opens a directory in the filesystem and returns a DirHandle
-     *   representing the directory stream.
-     *
-     *  @param name The name of the directory to open.
-     *
-     *  @returns
-     *    A DirHandle representing the directory stream, or
-     *   NULL on failure.
-     */
-    virtual DirHandle *opendir(const char *name) { return NULL; };
-
-    /** Creates a directory in the filesystem.
-     *
-     *  @param name The name of the directory to create.
-     *  @param mode The permissions to create the directory with.
-     *
-     *  @returns
-     *    0 on success,
-     *   -1 on failure.
-     */
-    virtual int mkdir(const char *name, mode_t mode) { return -1; }
-
-    // TODO other filesystem functions (mkdir, rm, rn, ls etc)
-
-protected: 
-    static FileSystemLike *_head;
-    FileSystemLike *_next;
-    const char *_name;
-};
-
-class FilePath {
-public:
-    FilePath(const char* file_path);
-    
-    const char* fileName(void);
-    FileSystemLike* fileSystem(void);
-    
-    static FileSystemLike* getFileSystem(const char* path);
-
-private:
-    const char* file_name;
-    FileSystemLike* fs;
-};
-
-} // namespace mbed
-
-#endif
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef MBED_FILESYSTEMLIKE_H
+#define MBED_FILESYSTEMLIKE_H
+
+#include "platform.h"
+
+#include "FileBase.h"
+#include "FileHandle.h"
+#include "DirHandle.h"
+
+namespace mbed {
+
+/** A filesystem-like object is one that can be used to open files
+ *  though it by fopen("/name/filename", mode)
+ *
+ *  Implementations must define at least open (the default definitions
+ *  of the rest of the functions just return error values).
+ */
+class FileSystemLike : public FileBase {
+
+public:
+    /** FileSystemLike constructor
+     *
+     *  @param name The name to use for the filesystem.
+     */
+    FileSystemLike(const char *name);
+
+    virtual ~FileSystemLike();
+
+    static DirHandle *opendir();
+    friend class BaseDirHandle;
+
+    /** Opens a file from the filesystem
+     *
+     *  @param filename The name of the file to open.
+     *  @param flags One of O_RDONLY, O_WRONLY, or O_RDWR, OR'd with
+     *    zero or more of O_CREAT, O_TRUNC, or O_APPEND.
+     *
+     *  @returns
+     *    A pointer to a FileHandle object representing the
+     *   file on success, or NULL on failure.
+     */
+    virtual FileHandle *open(const char *filename, int flags) = 0;
+
+    /** Remove a file from the filesystem.
+     *
+     *  @param filename the name of the file to remove.
+     *  @param returns 0 on success, -1 on failure.
+     */
+    virtual int remove(const char *filename) { return -1; };
+
+    /** Rename a file in the filesystem.
+     *
+     *  @param oldname the name of the file to rename.
+     *  @param newname the name to rename it to.
+     *
+     *  @returns
+     *    0 on success,
+     *   -1 on failure.
+     */
+    virtual int rename(const char *oldname, const char *newname) { return -1; };
+
+    /** Opens a directory in the filesystem and returns a DirHandle
+     *   representing the directory stream.
+     *
+     *  @param name The name of the directory to open.
+     *
+     *  @returns
+     *    A DirHandle representing the directory stream, or
+     *   NULL on failure.
+     */
+    virtual DirHandle *opendir(const char *name) { return NULL; };
+
+    /** Creates a directory in the filesystem.
+     *
+     *  @param name The name of the directory to create.
+     *  @param mode The permissions to create the directory with.
+     *
+     *  @returns
+     *    0 on success,
+     *   -1 on failure.
+     */
+    virtual int mkdir(const char *name, mode_t mode) { return -1; }
+
+    // TODO other filesystem functions (mkdir, rm, rn, ls etc)
+};
+
+} // namespace mbed
+
+#endif
--- a/FunctionPointer.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/FunctionPointer.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,12 +1,24 @@
-/* mbed Microcontroller Library - FunctionPointer
- * Copyright (c) 2007-2009 ARM Limited. All rights reserved.
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 #ifndef MBED_FUNCTIONPOINTER_H
 #define MBED_FUNCTIONPOINTER_H
 
 #include <string.h>
 
-namespace mbed { 
+namespace mbed {
 
 /** A class for storing and calling a pointer to a static or member void function
  */
@@ -14,31 +26,31 @@
 public:
 
     /** Create a FunctionPointer, attaching a static function
-     * 
+     *
      *  @param function The void static function to attach (default is none)
      */
     FunctionPointer(void (*function)(void) = 0);
 
     /** Create a FunctionPointer, attaching a member function
-     * 
+     *
      *  @param object The object pointer to invoke the member function on (i.e. the this pointer)
-     *  @param function The address of the void member function to attach 
+     *  @param function The address of the void member function to attach
      */
     template<typename T>
     FunctionPointer(T *object, void (T::*member)(void)) {
         attach(object, member);
     }
-    
+
     /** Attach a static function
-     * 
+     *
      *  @param function The void static function to attach (default is none)
      */
     void attach(void (*function)(void) = 0);
-    
+
     /** Attach a member function
-     * 
+     *
      *  @param object The object pointer to invoke the member function on (i.e. the this pointer)
-     *  @param function The address of the void member function to attach 
+     *  @param function The address of the void member function to attach
      */
     template<typename T>
     void attach(T *object, void (T::*member)(void)) {
@@ -47,7 +59,7 @@
         _membercaller = &FunctionPointer::membercaller<T>;
         _function = 0;
     }
-    
+
     /** Call the attached static or member function
      */
     void call();
@@ -60,7 +72,7 @@
         memcpy((char*)&m, member, sizeof(m));
         (o->*m)();
     }
-    
+
     void (*_function)(void);                // static function pointer - 0 if none attached
     void *_object;                            // object this pointer - 0 if none attached
     char _member[16];                        // raw member function pointer storage - converted back by registered _membercaller
--- a/I2C.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/I2C.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,5 +1,17 @@
-/* mbed Microcontroller Library - I2C
- * Copyright (c) 2007-2011 ARM Limited. All rights reserved.
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 #ifndef MBED_I2C_H
 #define MBED_I2C_H
@@ -8,6 +20,8 @@
 
 #if DEVICE_I2C
 
+#include "i2c_api.h"
+
 namespace mbed {
 
 /** An I2C Master, used for communicating with I2C slave devices
@@ -61,14 +75,14 @@
      * the address is forced to 1 to indicate a read.
      *
      *  @param address 8-bit I2C slave address [ addr | 1 ]
-     *  @param data Pointer to the byte-array to read data in to 
+     *  @param data Pointer to the byte-array to read data in to
      *  @param length Number of bytes to read
      *  @param repeated Repeated start, true - don't send stop at end
      *
      *  @returns
      *       0 on success (ack),
      *   non-0 on failure (nack)
-     */ 
+     */
     int read(int address, char *data, int length, bool repeated = false);
 
     /** Read a single byte from the I2C bus
@@ -86,14 +100,14 @@
      * the address is forced to 0 to indicate a write.
      *
      *  @param address 8-bit I2C slave address [ addr | 0 ]
-     *  @param data Pointer to the byte-array data to send 
+     *  @param data Pointer to the byte-array data to send
      *  @param length Number of bytes to send
      *  @param repeated Repeated start, true - do not send stop at end
      *
      *  @returns
      *       0 on success (ack),
      *   non-0 on failure (nack)
-     */ 
+     */
     int write(int address, const char *data, int length, bool repeated = false);
 
     /** Write single byte out on the I2C bus
@@ -117,8 +131,8 @@
 
 protected:
     void aquire();
-    
-    I2CName     _i2c;
+
+    i2c_t _i2c;
     static I2C  *_owner;
     int         _hz;
 };
--- a/I2CSlave.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/I2CSlave.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,5 +1,17 @@
-/* mbed Microcontroller Library - I2CSlave
- * Copyright (c) 2007-2011 ARM Limited. All rights reserved.
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 #ifndef MBED_I2C_SLAVE_H
 #define MBED_I2C_SLAVE_H
@@ -8,6 +20,8 @@
 
 #if DEVICE_I2CSLAVE
 
+#include "i2c_api.h"
+
 namespace mbed {
 
 /** An I2C Slave, used for communicating with an I2C Master device
@@ -27,7 +41,7 @@
  *     while (1) {
  *         int i = slave.receive();
  *         switch (i) {
- *             case I2CSlave::ReadAddressed: 
+ *             case I2CSlave::ReadAddressed:
  *                 slave.write(msg, strlen(msg) + 1); // Includes null char
  *                 break;
  *             case I2CSlave::WriteGeneral:
@@ -42,7 +56,7 @@
  *         for(int i = 0; i < 10; i++) buf[i] = 0;    // Clear buffer
  *     }
  * }
- * @endcode                  
+ * @endcode
  */
 class I2CSlave {
 
@@ -74,7 +88,7 @@
      *  - NoData            - the slave has not been addressed
      *  - ReadAddressed     - the master has requested a read from this slave
      *  - WriteAddressed    - the master is writing to this slave
-     *  - WriteGeneral      - the master is writing to all slave 
+     *  - WriteGeneral      - the master is writing to all slave
      */
     int receive(void);
 
@@ -87,7 +101,7 @@
      *       0 on success,
      *   non-0 otherwise
      */
-    int read(char *data, int length); 
+    int read(char *data, int length);
 
     /** Read a single byte from an I2C master.
      *
@@ -130,7 +144,7 @@
     void stop(void);
 
 protected:
-    I2CName     _i2c;
+    i2c_t _i2c;
 };
 
 } // namespace mbed
--- a/InterruptIn.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/InterruptIn.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,5 +1,17 @@
-/* mbed Microcontroller Library - InterruptIn
- * Copyright (c) 2006-2011 ARM Limited. All rights reserved.
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 #ifndef MBED_INTERRUPTIN_H
 #define MBED_INTERRUPTIN_H
@@ -50,13 +62,13 @@
      */
     InterruptIn(PinName pin);
     virtual ~InterruptIn();
-    
+
      int read();
 #ifdef MBED_OPERATORS
     operator int();
 
 #endif
-     
+
     /** Attach a function to call when a rising edge occurs on the input
      *
      *  @param fptr A pointer to a void function, or 0 to set as none
@@ -64,7 +76,7 @@
     void rise(void (*fptr)(void));
 
     /** Attach a member function to call when a rising edge occurs on the input
-     *     
+     *
      *  @param tptr pointer to the object to call the member function on
      *  @param mptr pointer to the member function to be called
      */
@@ -81,7 +93,7 @@
     void fall(void (*fptr)(void));
 
     /** Attach a member function to call when a falling edge occurs on the input
-     *     
+     *
      *  @param tptr pointer to the object to call the member function on
      *  @param mptr pointer to the member function to be called
      */
@@ -96,13 +108,13 @@
      *  @param mode PullUp, PullDown, PullNone
      */
     void mode(PinMode pull);
-    
+
     static void _irq_handler(uint32_t id, gpio_irq_event event);
-    
+
 protected:
-    gpio_object gpio;
-    gpio_irq_object gpio_irq;
-    
+    gpio_t gpio;
+    gpio_irq_t gpio_irq;
+
     FunctionPointer _rise;
     FunctionPointer _fall;
 };
Binary file KL25Z/ARM/capi.ar has changed
Binary file KL25Z/ARM/cmsis_nvic.o has changed
Binary file KL25Z/ARM/core_cm0.o has changed
Binary file KL25Z/ARM/cpp.ar has changed
Binary file KL25Z/ARM/mbed.ar has changed
Binary file KL25Z/ARM/startup_MKL25Z4.o has changed
Binary file KL25Z/ARM/sys.o has changed
Binary file KL25Z/ARM/system_MKL25Z4.o has changed
--- a/KL25Z/PeripheralNames.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/KL25Z/PeripheralNames.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,7 +1,17 @@
-/* mbed Microcontroller Library - PeripheralNames
- * Copyright (C) 2008-2011 ARM Limited. All rights reserved.
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * Provides the mappings for peripherals
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 #ifndef MBED_PERIPHERALNAMES_H
 #define MBED_PERIPHERALNAMES_H
@@ -19,11 +29,11 @@
 } UARTName;
 #define STDIO_UART_TX     USBTX
 #define STDIO_UART_RX     USBRX
-#define STDIO_UART        UART_0
-
-typedef enum {
-    I2C_0 = (int)I2C0_BASE,
-    I2C_1 = (int)I2C1_BASE,
+#define STDIO_UART        UART_0
+
+typedef enum {
+    I2C_0 = (int)I2C0_BASE,
+    I2C_1 = (int)I2C1_BASE,
 } I2CName;
 
 #define TPM_SHIFT   8
@@ -34,10 +44,10 @@
     PWM_4  = (0 << TPM_SHIFT) | (3),  // TPM0 CH3
     PWM_5  = (0 << TPM_SHIFT) | (4),  // TPM0 CH4
     PWM_6  = (0 << TPM_SHIFT) | (5),  // TPM0 CH5
-    
+
     PWM_7  = (1 << TPM_SHIFT) | (0),  // TPM1 CH0
     PWM_8  = (1 << TPM_SHIFT) | (1),  // TPM1 CH1
-    
+
     PWM_9  = (2 << TPM_SHIFT) | (0),  // TPM2 CH0
     PWM_10 = (2 << TPM_SHIFT) | (1)   // TPM2 CH1
 } PWMName;
@@ -61,12 +71,12 @@
 
 typedef enum {
     DAC_0 = 0
-} DACName;
-
-
-typedef enum {
-    SPI_0 = (int)SPI0_BASE,
-    SPI_1 = (int)SPI1_BASE,
+} DACName;
+
+
+typedef enum {
+    SPI_0 = (int)SPI0_BASE,
+    SPI_1 = (int)SPI1_BASE,
 } SPIName;
 
 #ifdef __cplusplus
--- a/KL25Z/PinNames.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/KL25Z/PinNames.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,7 +1,17 @@
-/* mbed Microcontroller Library - PinNames
- * Copyright (C) 2008-2011 ARM Limited. All rights reserved.
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * Provides the mapping of mbed DIP and LPC Pin Names
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 #ifndef MBED_PINNAMES_H
 #define MBED_PINNAMES_H
@@ -180,21 +190,21 @@
     PTE29 = 0x4074,
     PTE30 = 0x4078,
     PTE31 = 0x407c,
-    
+
     LED_RED = PTB18,
     LED_GREEN = PTB19,
     LED_BLUE = PTD1,
-    
+
     // mbed original LED naming
     LED1 = LED_BLUE,
     LED2 = LED_GREEN,
     LED3 = LED_RED,
     LED4 = LED_RED,
-    
+
     // USB Pins
     USBTX = PTA2,
     USBRX = PTA1,
-    
+
     // Arduino Headers
     D0 = PTA1,
     D1 = PTA2,
@@ -212,14 +222,14 @@
     D13 = PTD1,
     D14 = PTE0,
     D15 = PTE1,
-    
+
     A0 = PTB0,
     A1 = PTB1,
     A2 = PTB2,
     A3 = PTB3,
     A4 = PTC2,
     A5 = PTC1,
-    
+
     // Not connected
     NC = (int)0xFFFFFFFF
 } PinName;
--- a/KL25Z/PortNames.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/KL25Z/PortNames.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,5 +1,17 @@
-/* mbed Microcontroller Library - PortName
- * Copyright (c) 2010-2011 ARM Limited. All rights reserved.
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 #ifndef MBED_PORTNAMES_H
 #define MBED_PORTNAMES_H
--- a/KL25Z/core_cm0plus.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/KL25Z/core_cm0plus.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,8 +1,8 @@
 /**************************************************************************//**
  * @file     core_cm0plus.h
  * @brief    CMSIS Cortex-M0+ Core Peripheral Access Layer Header File
- * @version  V3.01
- * @date     22. March 2012
+ * @version  V3.02
+ * @date     05. November 2012
  *
  * @note
  * Copyright (C) 2009-2012 ARM Limited. All rights reserved.
@@ -701,9 +701,9 @@
 {
 
   if(IRQn < 0) {
-    return((uint32_t)((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) >> (8 - __NVIC_PRIO_BITS)));  } /* get priority for Cortex-M0+ system interrupts */
+    return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & 0xFF) >> (8 - __NVIC_PRIO_BITS)));  } /* get priority for Cortex-M0 system interrupts */
   else {
-    return((uint32_t)((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) >> (8 - __NVIC_PRIO_BITS)));  } /* get priority for device specific interrupts   */
+    return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & 0xFF) >> (8 - __NVIC_PRIO_BITS)));  } /* get priority for device specific interrupts  */
 }
 
 
@@ -751,9 +751,9 @@
  */
 __STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
 {
-  if (ticks > SysTick_LOAD_RELOAD_Msk)  return (1);            /* Reload value impossible */
+  if ((ticks - 1) > SysTick_LOAD_RELOAD_Msk)  return (1);      /* Reload value impossible */
 
-  SysTick->LOAD  = (ticks & SysTick_LOAD_RELOAD_Msk) - 1;      /* set reload register */
+  SysTick->LOAD  = ticks - 1;                                  /* set reload register */
   NVIC_SetPriority (SysTick_IRQn, (1<<__NVIC_PRIO_BITS) - 1);  /* set Priority for Systick Interrupt */
   SysTick->VAL   = 0;                                          /* Load the SysTick Counter Value */
   SysTick->CTRL  = SysTick_CTRL_CLKSOURCE_Msk |
--- a/KL25Z/core_cmInstr.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/KL25Z/core_cmInstr.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,8 +1,8 @@
 /**************************************************************************//**
  * @file     core_cmInstr.h
  * @brief    CMSIS Cortex-M Core Instruction Access Header File
- * @version  V3.02
- * @date     08. May 2012
+ * @version  V3.03
+ * @date     29. August 2012
  *
  * @note
  * Copyright (C) 2009-2012 ARM Limited. All rights reserved.
@@ -146,6 +146,17 @@
 #define __ROR                             __ror
 
 
+/** \brief  Breakpoint
+
+    This function causes the processor to enter Debug state.
+    Debug tools can use this to investigate system state when the instruction at a particular address is reached.
+
+    \param [in]    value  is ignored by the processor.
+                   If required, a debugger can use it to store additional information about the breakpoint.
+ */
+#define __BKPT(value)                       __breakpoint(value)
+
+
 #if       (__CORTEX_M >= 0x03)
 
 /** \brief  Reverse bit order of value
@@ -422,6 +433,17 @@
 }
 
 
+/** \brief  Breakpoint
+
+    This function causes the processor to enter Debug state.
+    Debug tools can use this to investigate system state when the instruction at a particular address is reached.
+
+    \param [in]    value  is ignored by the processor.
+                   If required, a debugger can use it to store additional information about the breakpoint.
+ */
+#define __BKPT(value)                       __ASM volatile ("bkpt "#value)
+
+
 #if       (__CORTEX_M >= 0x03)
 
 /** \brief  Reverse bit order of value
--- a/KL25Z/device.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/KL25Z/device.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,5 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-20012 ARM Limited. All rights reserved.
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 #ifndef MBED_DEVICE_H
 #define MBED_DEVICE_H
@@ -23,18 +35,22 @@
 
 #define DEVICE_CAN              0
 
-#define DEVICE_RTC              0
+#define DEVICE_RTC              1
 
 #define DEVICE_ETHERNET         0
 
 #define DEVICE_PWMOUT           1
 
+#define DEVICE_SEMIHOST         1
 #define DEVICE_LOCALFILESYSTEM  0
+#define DEVICE_ID_LENGTH       24
 
 #define DEVICE_SLEEP            0
 
 #define DEVICE_DEBUG_AWARENESS  0
 
+#define DEVICE_STDIO_MESSAGES   1
+
 #include "objects.h"
 
 #endif
--- a/KL25Z/gpio_object.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/KL25Z/gpio_object.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,36 +1,48 @@
-/* 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
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#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_t;
+
+static inline void gpio_write(gpio_t *obj, int value) {
+    if (value)
+        *obj->reg_set = obj->mask;
+    else
+        *obj->reg_clr = obj->mask;
+}
+
+static inline int gpio_read(gpio_t *obj) {
+    return ((*obj->reg_in & obj->mask) ? 1 : 0);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- a/KL25Z/objects.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/KL25Z/objects.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,47 +1,75 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-20012 ARM Limited. All rights reserved.
- */
-#ifndef MBED_OBJECTS_H
-#define MBED_OBJECTS_H
-
-#include "cmsis.h"
-#include "PortNames.h"
-#include "PeripheralNames.h"
-#include "PinNames.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct gpio_irq_object_s {
-    uint32_t port;
-    uint32_t pin;
-    uint32_t ch;
-};
-
-struct port_object_s {
-    __IO uint32_t *reg_dir;
-    __IO uint32_t *reg_out;
-    __I  uint32_t *reg_in;
-    PortName port;
-    uint32_t mask;
-};
-
-struct pwmout_object_s {
-    __IO uint32_t *MOD;
-    __IO uint32_t *CNT;
-    __IO uint32_t *CnV;
-};
-
-struct serial_object_s {
-    UARTLP_Type *uart;
-    int index;
-};
-
-#include "gpio_object.h"
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef MBED_OBJECTS_H
+#define MBED_OBJECTS_H
+
+#include "cmsis.h"
+#include "PortNames.h"
+#include "PeripheralNames.h"
+#include "PinNames.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct gpio_irq_s {
+    uint32_t port;
+    uint32_t pin;
+    uint32_t ch;
+};
+
+struct port_s {
+    __IO uint32_t *reg_dir;
+    __IO uint32_t *reg_out;
+    __I  uint32_t *reg_in;
+    PortName port;
+    uint32_t mask;
+};
+
+struct pwmout_s {
+    __IO uint32_t *MOD;
+    __IO uint32_t *CNT;
+    __IO uint32_t *CnV;
+};
+
+struct serial_s {
+    UARTLP_Type *uart;
+    int index;
+};
+
+struct analogin_s {
+    ADCName adc;
+};
+
+struct dac_s {
+    DACName dac;
+};
+
+struct i2c_s {
+    I2C_Type *i2c;
+};
+
+struct spi_s {
+    SPI_Type *spi;
+};
+
+#include "gpio_object.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
Binary file KL25Z/uARM/capi.ar has changed
Binary file KL25Z/uARM/cmsis_nvic.o has changed
Binary file KL25Z/uARM/core_cm0.o has changed
Binary file KL25Z/uARM/cpp.ar has changed
Binary file KL25Z/uARM/mbed.ar has changed
Binary file KL25Z/uARM/startup_MKL25Z4.o has changed
Binary file KL25Z/uARM/sys.o has changed
Binary file KL25Z/uARM/system_MKL25Z4.o has changed
--- a/LocalFileSystem.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/LocalFileSystem.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,5 +1,17 @@
-/* mbed Microcontroller Library - LocalFileSystem
- * Copyright (c) 2008-2009 ARM Limited. All rights reserved.
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 #ifndef MBED_LOCALFILESYSTEM_H
 #define MBED_LOCALFILESYSTEM_H
@@ -18,19 +30,19 @@
 
 public:
     LocalFileHandle(FILEHANDLE fh);
-    
+
     virtual int close();
-    
+
     virtual ssize_t write(const void *buffer, size_t length);
-    
+
     virtual ssize_t read(void *buffer, size_t length);
-    
+
     virtual int isatty();
-    
+
     virtual off_t lseek(off_t position, int whence);
-    
+
     virtual int fsync();
-    
+
     virtual off_t flen();
 
 protected:
@@ -38,10 +50,10 @@
     int pos;
 };
 
-/** A filesystem for accessing the local mbed Microcontroller USB disk drive 
+/** A filesystem for accessing the local mbed Microcontroller USB disk drive
  *
- *  This allows programs to read and write files on the same disk drive that is used to program the 
- *  mbed Microcontroller. Once created, the standard C file access functions are used to open, 
+ *  This allows programs to read and write files on the same disk drive that is used to program the
+ *  mbed Microcontroller. Once created, the standard C file access functions are used to open,
  *  read and write files.
  *
  * Example:
@@ -52,8 +64,8 @@
  *
  * int main() {
  *     FILE *fp = fopen("/local/out.txt", "w");  // Open "out.txt" on the local file system for writing
- *     fprintf(fp, "Hello World!");              
- *     fclose(fp);                               
+ *     fprintf(fp, "Hello World!");
+ *     fclose(fp);
  *     remove("/local/out.txt");                 // Removes the file "out.txt" from the local file system
  *
  *     DIR *d = opendir("/local");               // Opens the root directory of the local file system
@@ -76,7 +88,7 @@
 
 public:
     LocalFileSystem(const char* n) : FileSystemLike(n) {
-        
+
     }
 
     virtual FileHandle *open(const char* name, int flags);
--- a/PortIn.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/PortIn.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,75 +1,93 @@
-/* mbed Microcontroller Library - PortInOut
- * Copyright (c) 2006-2011 ARM Limited. All rights reserved.
- */
-#ifndef MBED_PORTIN_H
-#define MBED_PORTIN_H
-
-#include "platform.h"
-
-#if DEVICE_PORTIN
-
-#include "port_api.h"
-
-namespace mbed {
-
-/** A multiple pin digital input
- *
- *  Example:
- * @code
- * // Switch on an LED if any of mbed pins 21-26 is high
- *
- * #include "mbed.h"
- *
- * PortIn     p(Port2, 0x0000003F);   // p21-p26
- * DigitalOut ind(LED4);
- *
- * int main() {
- *     while(1) {
- *         int pins = p.read();
- *         if(pins) {
- *             ind = 1;
- *         } else {
- *             ind = 0;
- *         }
- *     }
- * }
- * @endcode
- */
-class PortIn {
-public:
-
-    /** Create an PortIn, connected to the specified port
-     *
-     *  @param port Port to connect to (Port0-Port5)
-     *  @param mask A bitmask to identify which bits in the port should be included (0 - ignore)
-        */ 
-    PortIn(PortName port, int mask = 0xFFFFFFFF);
-    
-    /** Read the value currently output on the port
-     *
-     *  @returns
-     *    An integer with each bit corresponding to associated port pin setting
-     */
-    int read();
-    
-    /** Set the input pin mode
-     *
-     *  @param mode PullUp, PullDown, PullNone, OpenDrain
-     */
-    void mode(PinMode mode);
-    
-    /** A shorthand for read()
-     */
-    operator int() { 
-        return read();
-    }
-
-private:
-    port_object _port;
-};
-
-} // namespace mbed
-
-#endif
-
-#endif
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef MBED_PORTIN_H
+#define MBED_PORTIN_H
+
+#include "platform.h"
+
+#if DEVICE_PORTIN
+
+#include "port_api.h"
+
+namespace mbed {
+
+/** A multiple pin digital input
+ *
+ *  Example:
+ * @code
+ * // Switch on an LED if any of mbed pins 21-26 is high
+ *
+ * #include "mbed.h"
+ *
+ * PortIn     p(Port2, 0x0000003F);   // p21-p26
+ * DigitalOut ind(LED4);
+ *
+ * int main() {
+ *     while(1) {
+ *         int pins = p.read();
+ *         if(pins) {
+ *             ind = 1;
+ *         } else {
+ *             ind = 0;
+ *         }
+ *     }
+ * }
+ * @endcode
+ */
+class PortIn {
+public:
+
+    /** Create an PortIn, connected to the specified port
+     *
+     *  @param port Port to connect to (Port0-Port5)
+     *  @param mask A bitmask to identify which bits in the port should be included (0 - ignore)
+        */
+    PortIn(PortName port, int mask = 0xFFFFFFFF) {
+        port_init(&_port, port, mask, PIN_INPUT);
+    }
+
+    /** Read the value currently output on the port
+     *
+     *  @returns
+     *    An integer with each bit corresponding to associated port pin setting
+     */
+    int read() {
+        return port_read(&_port);
+    }
+
+    /** Set the input pin mode
+     *
+     *  @param mode PullUp, PullDown, PullNone, OpenDrain
+     */
+    void mode(PinMode mode) {
+        port_mode(&_port, mode);
+    }
+
+    /** A shorthand for read()
+     */
+    operator int() {
+        return read();
+    }
+
+private:
+    port_t _port;
+};
+
+} // namespace mbed
+
+#endif
+
+#endif
--- a/PortInOut.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/PortInOut.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,80 +1,104 @@
-/* mbed Microcontroller Library - PortInOut
- * Copyright (c) 2006-2011 ARM Limited. All rights reserved.
- */
-#ifndef MBED_PORTINOUT_H
-#define MBED_PORTINOUT_H
-
-#include "platform.h"
-
-#if DEVICE_PORTINOUT
-
-#include "port_api.h"
-
-namespace mbed {
-
-/** A multiple pin digital in/out used to set/read multiple bi-directional pins
- */
-class PortInOut {
-public:
-
-    /** Create an PortInOut, connected to the specified port
-     *
-     *  @param port Port to connect to (Port0-Port5)
-     *  @param mask A bitmask to identify which bits in the port should be included (0 - ignore)
-     */ 
-    PortInOut(PortName port, int mask = 0xFFFFFFFF);
-    
-    /** Write the value to the output port
-     *
-     *  @param value An integer specifying a bit to write for every corresponding port pin
-     */    
-    void write(int value);
-    
-    /** Read the value currently output on the port
-     *
-     *  @returns
-     *    An integer with each bit corresponding to associated port pin setting
-     */
-    int read();
-    
-    /** Set as an output
-     */
-    void output();
-    
-    /** Set as an input
-     */
-    void input();
-    
-    /** Set the input pin mode
-     *
-     *  @param mode PullUp, PullDown, PullNone, OpenDrain
-     */
-    void mode(PinMode mode);
-    
-    /** A shorthand for write()
-     */    
-    PortInOut& operator= (int value) {
-        write(value);
-        return *this;
-    }
-    
-    PortInOut& operator= (PortInOut& rhs) {
-        write(rhs.read());
-        return *this;
-    }
-    
-    /** A shorthand for read()
-     */
-    operator int() { 
-        return read();
-    }
-
-private:
-    port_object _port;
-};
-
-} // namespace mbed
-
-#endif
-
-#endif
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef MBED_PORTINOUT_H
+#define MBED_PORTINOUT_H
+
+#include "platform.h"
+
+#if DEVICE_PORTINOUT
+
+#include "port_api.h"
+
+namespace mbed {
+
+/** A multiple pin digital in/out used to set/read multiple bi-directional pins
+ */
+class PortInOut {
+public:
+
+    /** Create an PortInOut, connected to the specified port
+     *
+     *  @param port Port to connect to (Port0-Port5)
+     *  @param mask A bitmask to identify which bits in the port should be included (0 - ignore)
+     */
+    PortInOut(PortName port, int mask = 0xFFFFFFFF) {
+        port_init(&_port, port, mask, PIN_INPUT);
+    }
+
+    /** Write the value to the output port
+     *
+     *  @param value An integer specifying a bit to write for every corresponding port pin
+     */
+    void write(int value) {
+        port_write(&_port, value);
+    }
+
+    /** Read the value currently output on the port
+     *
+     *  @returns
+     *    An integer with each bit corresponding to associated port pin setting
+     */
+    int read() {
+        return port_read(&_port);
+    }
+
+    /** Set as an output
+     */
+    void output() {
+        port_dir(&_port, PIN_OUTPUT);
+    }
+
+    /** Set as an input
+     */
+    void input() {
+        port_dir(&_port, PIN_INPUT);
+    }
+
+    /** Set the input pin mode
+     *
+     *  @param mode PullUp, PullDown, PullNone, OpenDrain
+     */
+    void mode(PinMode mode) {
+        port_mode(&_port, mode);
+    }
+
+    /** A shorthand for write()
+     */
+    PortInOut& operator= (int value) {
+        write(value);
+        return *this;
+    }
+
+    PortInOut& operator= (PortInOut& rhs) {
+        write(rhs.read());
+        return *this;
+    }
+
+    /** A shorthand for read()
+     */
+    operator int() {
+        return read();
+    }
+
+private:
+    port_t _port;
+};
+
+} // namespace mbed
+
+#endif
+
+#endif
--- a/PortOut.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/PortOut.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,86 +1,104 @@
-/* mbed Microcontroller Library - PortOut
- * Copyright (c) 2006-2011 ARM Limited. All rights reserved.
- */
-#ifndef MBED_PORTOUT_H
-#define MBED_PORTOUT_H
-
-#include "platform.h"
-
-#if DEVICE_PORTOUT
-
-#include "port_api.h"
-
-namespace mbed {
-/** A multiple pin digital out
- *
- * Example:
- * @code
- * // Toggle all four LEDs
- * 
- * #include "mbed.h"
- *
- * // LED1 = P1.18  LED2 = P1.20  LED3 = P1.21  LED4 = P1.23
- * #define LED_MASK 0x00B40000
- *
- * PortOut ledport(Port1, LED_MASK);
- *
- * int main() {
- *     while(1) {
- *         ledport = LED_MASK;
- *         wait(1);
- *         ledport = 0;
- *         wait(1);
- *     }
- * }
- * @endcode
- */  
-class PortOut {
-public:
-
-    /** Create an PortOut, connected to the specified port
-     *
-     *  @param port Port to connect to (Port0-Port5)
-     *  @param mask A bitmask to identify which bits in the port should be included (0 - ignore)
-     */ 
-    PortOut(PortName port, int mask = 0xFFFFFFFF);
-    
-    /** Write the value to the output port
-     *
-     *  @param value An integer specifying a bit to write for every corresponding PortOut pin
-     */    
-    void write(int value);
-    
-    /** Read the value currently output on the port
-     *
-     *  @returns
-     *    An integer with each bit corresponding to associated PortOut pin setting
-     */
-    int read();
-
-    /** A shorthand for write()
-     */    
-    PortOut& operator= (int value) { 
-        write(value);
-        return *this;
-    }
-    
-    PortOut& operator= (PortOut& rhs) { 
-        write(rhs.read());
-        return *this;
-    }
-    
-    /** A shorthand for read()
-     */
-    operator int() { 
-        return read();
-    }
-
-private:
-    port_object _port;
-};
-
-} // namespace mbed
-
-#endif
-
-#endif
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef MBED_PORTOUT_H
+#define MBED_PORTOUT_H
+
+#include "platform.h"
+
+#if DEVICE_PORTOUT
+
+#include "port_api.h"
+
+namespace mbed {
+/** A multiple pin digital out
+ *
+ * Example:
+ * @code
+ * // Toggle all four LEDs
+ *
+ * #include "mbed.h"
+ *
+ * // LED1 = P1.18  LED2 = P1.20  LED3 = P1.21  LED4 = P1.23
+ * #define LED_MASK 0x00B40000
+ *
+ * PortOut ledport(Port1, LED_MASK);
+ *
+ * int main() {
+ *     while(1) {
+ *         ledport = LED_MASK;
+ *         wait(1);
+ *         ledport = 0;
+ *         wait(1);
+ *     }
+ * }
+ * @endcode
+ */
+class PortOut {
+public:
+
+    /** Create an PortOut, connected to the specified port
+     *
+     *  @param port Port to connect to (Port0-Port5)
+     *  @param mask A bitmask to identify which bits in the port should be included (0 - ignore)
+     */
+    PortOut(PortName port, int mask = 0xFFFFFFFF) {
+        port_init(&_port, port, mask, PIN_OUTPUT);
+    }
+
+    /** Write the value to the output port
+     *
+     *  @param value An integer specifying a bit to write for every corresponding PortOut pin
+     */
+    void write(int value) {
+        port_write(&_port, value);
+    }
+
+    /** Read the value currently output on the port
+     *
+     *  @returns
+     *    An integer with each bit corresponding to associated PortOut pin setting
+     */
+    int read() {
+        return port_read(&_port);
+    }
+
+    /** A shorthand for write()
+     */
+    PortOut& operator= (int value) {
+        write(value);
+        return *this;
+    }
+
+    PortOut& operator= (PortOut& rhs) {
+        write(rhs.read());
+        return *this;
+    }
+
+    /** A shorthand for read()
+     */
+    operator int() {
+        return read();
+    }
+
+private:
+    port_t _port;
+};
+
+} // namespace mbed
+
+#endif
+
+#endif
--- a/PwmOut.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/PwmOut.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,5 +1,17 @@
-/* mbed Microcontroller Library - PwmOut
- * Copyright (c) 2007-2011 ARM Limited. All rights reserved.
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 #ifndef MBED_PWMOUT_H
 #define MBED_PWMOUT_H
@@ -19,7 +31,7 @@
  * #include "mbed.h"
  *
  * PwmOut led(LED1);
- * 
+ *
  * int main() {
  *     while(1) {
  *         led = led + 0.01;
@@ -46,70 +58,97 @@
      *
      *  @param pin PwmOut pin to connect to
      */
-    PwmOut(PinName pin);
+    PwmOut(PinName pin) {
+        pwmout_init(&_pwm, pin);
+    }
 
     /** Set the ouput duty-cycle, specified as a percentage (float)
      *
-     *  @param value A floating-point value representing the output duty-cycle, 
+     *  @param value A floating-point value representing the output duty-cycle,
      *    specified as a percentage. The value should lie between
      *    0.0f (representing on 0%) and 1.0f (representing on 100%).
      *    Values outside this range will be saturated to 0.0f or 1.0f.
      */
-    void write(float value);
+    void write(float value) {
+        pwmout_write(&_pwm, value);
+    }
 
     /** Return the current output duty-cycle setting, measured as a percentage (float)
      *
      *  @returns
-     *    A floating-point value representing the current duty-cycle being output on the pin, 
+     *    A floating-point value representing the current duty-cycle being output on the pin,
      *    measured as a percentage. The returned value will lie between
      *    0.0f (representing on 0%) and 1.0f (representing on 100%).
      *
      *  @note
      *  This value may not match exactly the value set by a previous <write>.
      */
-    float read();
-    
+    float read() {
+        return pwmout_read(&_pwm);
+    }
+
     /** Set the PWM period, specified in seconds (float), keeping the duty cycle the same.
      *
      *  @note
      *   The resolution is currently in microseconds; periods smaller than this
      *   will be set to zero.
      */
-    void period(float seconds);
+    void period(float seconds) {
+        pwmout_period(&_pwm, seconds);
+    }
 
     /** Set the PWM period, specified in milli-seconds (int), keeping the duty cycle the same.
      */
-    void period_ms(int ms);
+    void period_ms(int ms) {
+        pwmout_period_ms(&_pwm, ms);
+    }
 
     /** Set the PWM period, specified in micro-seconds (int), keeping the duty cycle the same.
      */
-    void period_us(int us);
+    void period_us(int us) {
+        pwmout_period_us(&_pwm, us);
+    }
 
     /** Set the PWM pulsewidth, specified in seconds (float), keeping the period the same.
      */
-    void pulsewidth(float seconds);
+    void pulsewidth(float seconds) {
+        pwmout_pulsewidth(&_pwm, seconds);
+    }
 
     /** Set the PWM pulsewidth, specified in milli-seconds (int), keeping the period the same.
      */
-    void pulsewidth_ms(int ms);
+    void pulsewidth_ms(int ms) {
+        pwmout_pulsewidth_ms(&_pwm, ms);
+    }
 
     /** Set the PWM pulsewidth, specified in micro-seconds (int), keeping the period the same.
      */
-    void pulsewidth_us(int us);
+    void pulsewidth_us(int us) {
+        pwmout_pulsewidth_us(&_pwm, us);
+    }
 
 #ifdef MBED_OPERATORS
     /** A operator shorthand for write()
      */
-    PwmOut& operator= (float value);
-    PwmOut& operator= (PwmOut& rhs);
-    
+    PwmOut& operator= (float value) {
+        write(value);
+        return *this;
+    }
+
+    PwmOut& operator= (PwmOut& rhs) {
+        write(rhs.read());
+        return *this;
+    }
+
     /** An operator shorthand for read()
      */
-    operator float();
+    operator float() {
+        return read();
+    }
 #endif
 
 protected:
-    pwmout_object _pwm;
+    pwmout_t _pwm;
 };
 
 } // namespace mbed
--- a/SPI.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/SPI.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,95 +1,109 @@
-/* mbed Microcontroller Library - SPI
- * Copyright (c) 2010-2011 ARM Limited. All rights reserved.
- */
-#ifndef MBED_SPI_H
-#define MBED_SPI_H
-
-#include "platform.h"
-
-#if DEVICE_SPI
-
-namespace mbed {
-
-/** A SPI Master, used for communicating with SPI slave devices
- *
- * The default format is set to 8-bits, mode 0, and a clock frequency of 1MHz
- *
- * Most SPI devices will also require Chip Select and Reset signals. These
- * can be controlled using <DigitalOut> pins
- *
- * Example:
- * @code
- * // Send a byte to a SPI slave, and record the response
- *
- * #include "mbed.h"
- *
- * SPI device(p5, p6, p7); // mosi, miso, sclk
- *
- * int main() {
- *     int response = device.write(0xFF);
- * }
- * @endcode
- */ 
-class SPI {
-
-public:
-
-    /** Create a SPI master connected to the specified pins
-     *
-     * Pin Options:
-     *  (5, 6, 7) or (11, 12, 13)
-     *
-     *  mosi or miso can be specfied as NC if not used
-     *
-     *  @param mosi SPI Master Out, Slave In pin
-     *  @param miso SPI Master In, Slave Out pin
-     *  @param sclk SPI Clock pin
-     */
-    SPI(PinName mosi, PinName miso, PinName sclk);
-
-    /** Configure the data transmission format
-     *
-     *  @param bits Number of bits per SPI frame (4 - 16)
-     *  @param mode Clock polarity and phase mode (0 - 3)
-     *
-     * @code
-     * mode | POL PHA 
-     * -----+--------     
-     *   0  |  0   0 
-     *   1  |  0   1
-     *   2  |  1   0 
-     *   3  |  1   1
-     * @endcode
-     */
-    void format(int bits, int mode = 0);
-
-    /** Set the spi bus clock frequency
-     *
-     *  @param hz SCLK frequency in hz (default = 1MHz)
-     */
-    void frequency(int hz = 1000000);
-
-    /** Write to the SPI Slave and return the response
-     *
-     *  @param value Data to be sent to the SPI slave
-     *
-     *  @returns
-     *    Response from the SPI slave
-    */
-    virtual int write(int value);
-
-protected:
-    SPIName _spi;
-    
-    void aquire(void);
-    static SPI *_owner;
-    int _bits;
-    int _mode;
-    int _hz;
-};
-
-} // namespace mbed
-
-#endif
-
-#endif
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef MBED_SPI_H
+#define MBED_SPI_H
+
+#include "platform.h"
+
+#if DEVICE_SPI
+
+#include "spi_api.h"
+
+namespace mbed {
+
+/** A SPI Master, used for communicating with SPI slave devices
+ *
+ * The default format is set to 8-bits, mode 0, and a clock frequency of 1MHz
+ *
+ * Most SPI devices will also require Chip Select and Reset signals. These
+ * can be controlled using <DigitalOut> pins
+ *
+ * Example:
+ * @code
+ * // Send a byte to a SPI slave, and record the response
+ *
+ * #include "mbed.h"
+ *
+ * SPI device(p5, p6, p7); // mosi, miso, sclk
+ *
+ * int main() {
+ *     int response = device.write(0xFF);
+ * }
+ * @endcode
+ */
+class SPI {
+
+public:
+
+    /** Create a SPI master connected to the specified pins
+     *
+     * Pin Options:
+     *  (5, 6, 7) or (11, 12, 13)
+     *
+     *  mosi or miso can be specfied as NC if not used
+     *
+     *  @param mosi SPI Master Out, Slave In pin
+     *  @param miso SPI Master In, Slave Out pin
+     *  @param sclk SPI Clock pin
+     */
+    SPI(PinName mosi, PinName miso, PinName sclk);
+
+    /** Configure the data transmission format
+     *
+     *  @param bits Number of bits per SPI frame (4 - 16)
+     *  @param mode Clock polarity and phase mode (0 - 3)
+     *
+     * @code
+     * mode | POL PHA
+     * -----+--------
+     *   0  |  0   0
+     *   1  |  0   1
+     *   2  |  1   0
+     *   3  |  1   1
+     * @endcode
+     */
+    void format(int bits, int mode = 0);
+
+    /** Set the spi bus clock frequency
+     *
+     *  @param hz SCLK frequency in hz (default = 1MHz)
+     */
+    void frequency(int hz = 1000000);
+
+    /** Write to the SPI Slave and return the response
+     *
+     *  @param value Data to be sent to the SPI slave
+     *
+     *  @returns
+     *    Response from the SPI slave
+    */
+    virtual int write(int value);
+
+protected:
+    spi_t _spi;
+
+    void aquire(void);
+    static SPI *_owner;
+    int _bits;
+    int _mode;
+    int _hz;
+};
+
+} // namespace mbed
+
+#endif
+
+#endif
--- a/SPIHalfDuplex.h	Fri Nov 09 11:33:53 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-/* mbed Microcontroller Library - SPIHalfDuplex
- * Copyright (c) 2010-2011 ARM Limited. All rights reserved.
- */
-#ifndef MBED_SPIHALFDUPLEX_H
-#define MBED_SPIHALFDUPLEX_H
-
-#include "platform.h"
-
-#if DEVICE_SPI
-
-#include "SPI.h"
-
-namespace mbed {
-
-/** A SPI half-duplex master, used for communicating with SPI slave devices
- * over a shared data line.
- *
- * The default format is set to 8-bits for both master and slave, and a
- * clock frequency of 1MHz
- *
- * Most SPI devies will also require Chip Select and Reset signals. These
- * can be controlled using <DigitalOut> pins.
- *
- * Although this is for a shared data line, both MISO and MOSI are defined,
- * and should be tied together externally to the mbed. This class handles
- * the tri-stating of the MOSI pin.
- *
- * Example:
- * @code
- * // Send a byte to a SPI half-duplex slave, and record the response
- *
- * #include "mbed.h"
- * 
- * SPIHalfDuplex device(p5, p6, p7) // mosi, miso, sclk
- *
- * int main() {
- *     int respone = device.write(0xAA);
- * }
- * @endcode
- */
-
-class SPIHalfDuplex : public SPI {
-
-public:
-    
-    /** Create a SPI half-duplex master connected to the specified pins
-     *
-     * Pin Options:
-     *  (5, 6, 7) or (11, 12, 13)
-     *
-     *  mosi or miso can be specfied as NC if not used
-     *
-     *  @param mosi SPI Master Out, Slave In pin
-     *  @param miso SPI Master In, Slave Out pin
-     *  @param sclk SPI Clock pin
-     *  @param name (optional) A string to identify the object
-     */
-    SPIHalfDuplex(PinName mosi, PinName miso, PinName sclk);
-
-    /** Write to the SPI Slave and return the response
-     *
-     *  @param value Data to be sent to the SPI slave
-     *
-     *  @returns
-     *    Response from the SPI slave
-     */
-    virtual int write(int value);
-    
-    /** Set the number of databits expected from the slave, from 4-16
-     *
-     *  @param sbits Number of expected bits in the slave response
-     */
-    void slave_format(int sbits);
-
-protected:
-    PinName _mosi;
-    PinName _miso;
-    int     _sbits;
-}; // End of class
-
-} // End of namespace mbed
-
-#endif
-
-#endif
--- a/SPISlave.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/SPISlave.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,112 +1,126 @@
-/* mbed Microcontroller Library - SPISlave
- * Copyright (c) 2010-2011 ARM Limited. All rights reserved.
- */
-#ifndef MBED_SPISLAVE_H
-#define MBED_SPISLAVE_H
-
-#include "platform.h"
-
-#if DEVICE_SPISLAVE
-
-namespace mbed {
-
-/** A SPI slave, used for communicating with a SPI Master device
- *
- * The default format is set to 8-bits, mode 0, and a clock frequency of 1MHz
- *
- * Example:
- * @code
- * // Reply to a SPI master as slave
- *
- * #include "mbed.h"
- *
- * SPISlave device(p5, p6, p7, p8); // mosi, miso, sclk, ssel
- *
- * int main() {
- *     device.reply(0x00);              // Prime SPI with first reply
- *     while(1) {
- *         if(device.receive()) {
- *             int v = device.read();   // Read byte from master
- *             v = (v + 1) % 0x100;     // Add one to it, modulo 256
- *             device.reply(v);         // Make this the next reply
- *         }
- *     }
- * }
- * @endcode
- */ 
-class SPISlave {
-
-public:
-
-    /** Create a SPI slave connected to the specified pins
-     *
-     * Pin Options:
-     *  (5, 6, 7i, 8) or (11, 12, 13, 14)
-     *
-     *  mosi or miso can be specfied as NC if not used
-     *
-     *  @param mosi SPI Master Out, Slave In pin
-     *  @param miso SPI Master In, Slave Out pin
-     *  @param sclk SPI Clock pin
-     *  @param ssel SPI chip select pin
-     *  @param name (optional) A string to identify the object     
-     */
-    SPISlave(PinName mosi, PinName miso, PinName sclk, PinName ssel);
-
-    /** Configure the data transmission format
-     *
-     *  @param bits Number of bits per SPI frame (4 - 16)
-     *  @param mode Clock polarity and phase mode (0 - 3)
-     *
-     * @code
-     * mode | POL PHA 
-     * -----+--------     
-     *   0  |  0   0 
-     *   1  |  0   1
-     *   2  |  1   0 
-     *   3  |  1   1
-     * @endcode
-     */
-    void format(int bits, int mode = 0);
-
-    /** Set the spi bus clock frequency
-     *
-     *  @param hz SCLK frequency in hz (default = 1MHz)
-     */
-    void frequency(int hz = 1000000);
-
-    /** Polls the SPI to see if data has been received
-     *
-     *  @returns
-     *    0 if no data,
-     *    1 otherwise
-     */
-    int receive(void);
-
-    /** Retrieve  data from receive buffer as slave
-     *
-     *  @returns
-     *    the data in the receive buffer
-     */
-    int read(void);
-
-    /** Fill the transmission buffer with the value to be written out
-     *  as slave on the next received message from the master.
-     *
-     *  @param value the data to be transmitted next
-     */
-    void reply(int value);
-
-protected:
-    SPIName _spi;
-    
-    int _bits;
-    int _mode;
-    int _hz;
-};
-
-} // namespace mbed
-
-#endif
-
-#endif
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef MBED_SPISLAVE_H
+#define MBED_SPISLAVE_H
+
+#include "platform.h"
+
+#if DEVICE_SPISLAVE
+
+#include "spi_api.h"
+
+namespace mbed {
+
+/** A SPI slave, used for communicating with a SPI Master device
+ *
+ * The default format is set to 8-bits, mode 0, and a clock frequency of 1MHz
+ *
+ * Example:
+ * @code
+ * // Reply to a SPI master as slave
+ *
+ * #include "mbed.h"
+ *
+ * SPISlave device(p5, p6, p7, p8); // mosi, miso, sclk, ssel
+ *
+ * int main() {
+ *     device.reply(0x00);              // Prime SPI with first reply
+ *     while(1) {
+ *         if(device.receive()) {
+ *             int v = device.read();   // Read byte from master
+ *             v = (v + 1) % 0x100;     // Add one to it, modulo 256
+ *             device.reply(v);         // Make this the next reply
+ *         }
+ *     }
+ * }
+ * @endcode
+ */
+class SPISlave {
+
+public:
+
+    /** Create a SPI slave connected to the specified pins
+     *
+     * Pin Options:
+     *  (5, 6, 7i, 8) or (11, 12, 13, 14)
+     *
+     *  mosi or miso can be specfied as NC if not used
+     *
+     *  @param mosi SPI Master Out, Slave In pin
+     *  @param miso SPI Master In, Slave Out pin
+     *  @param sclk SPI Clock pin
+     *  @param ssel SPI chip select pin
+     *  @param name (optional) A string to identify the object
+     */
+    SPISlave(PinName mosi, PinName miso, PinName sclk, PinName ssel);
+
+    /** Configure the data transmission format
+     *
+     *  @param bits Number of bits per SPI frame (4 - 16)
+     *  @param mode Clock polarity and phase mode (0 - 3)
+     *
+     * @code
+     * mode | POL PHA
+     * -----+--------
+     *   0  |  0   0
+     *   1  |  0   1
+     *   2  |  1   0
+     *   3  |  1   1
+     * @endcode
+     */
+    void format(int bits, int mode = 0);
+
+    /** Set the spi bus clock frequency
+     *
+     *  @param hz SCLK frequency in hz (default = 1MHz)
+     */
+    void frequency(int hz = 1000000);
+
+    /** Polls the SPI to see if data has been received
+     *
+     *  @returns
+     *    0 if no data,
+     *    1 otherwise
+     */
+    int receive(void);
+
+    /** Retrieve  data from receive buffer as slave
+     *
+     *  @returns
+     *    the data in the receive buffer
+     */
+    int read(void);
+
+    /** Fill the transmission buffer with the value to be written out
+     *  as slave on the next received message from the master.
+     *
+     *  @param value the data to be transmitted next
+     */
+    void reply(int value);
+
+protected:
+    spi_t _spi;
+
+    int _bits;
+    int _mode;
+    int _hz;
+};
+
+} // namespace mbed
+
+#endif
+
+#endif
--- a/Serial.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/Serial.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,114 +1,138 @@
-/* mbed Microcontroller Library - Serial
- * Copyright (c) 2007-2011 ARM Limited. All rights reserved.
- */
-#ifndef MBED_SERIAL_H
-#define MBED_SERIAL_H
-
-#include "platform.h"
-
-#if DEVICE_SERIAL
-
-#include "Stream.h"
-#include "FunctionPointer.h"
-#include "serial_api.h"
-
-namespace mbed {
-
-/** A serial port (UART) for communication with other serial devices
- *
- * Can be used for Full Duplex communication, or Simplex by specifying 
- * one pin as NC (Not Connected)
- *
- * Example:
- * @code
- * // Print "Hello World" to the PC
- *
- * #include "mbed.h"
- *
- * Serial pc(USBTX, USBRX);
- *
- * int main() {
- *     pc.printf("Hello World\n");
- * }
- * @endcode
- */
-class Serial : public Stream {
-
-public:
-
-    /** Create a Serial port, connected to the specified transmit and receive pins
-     *
-     *  @param tx Transmit pin 
-     *  @param rx Receive pin
-     *
-     *  @note
-     *    Either tx or rx may be specified as NC if unused
-     */
-    Serial(PinName tx, PinName rx);
-
-    /** Set the baud rate of the serial port
-     *  
-     *  @param baudrate The baudrate of the serial port (default = 9600).
-     */
-    void baud(int baudrate);
-
-    /** Set the transmission format used by the Serial port
-     *
-     *  @param bits The number of bits in a word (5-8; default = 8)
-     *  @param parity The parity used (Serial::None, Serial::Odd, Serial::Even, Serial::Forced1, Serial::Forced0; default = Serial::None)
-     *  @param stop The number of stop bits (1 or 2; default = 1)
-     */
-    void format(int bits = 8, SerialParity parity=ParityNone, int stop_bits=1);
-
-    /** Determine if there is a character available to read
-     *
-     *  @returns
-     *    1 if there is a character available to read,
-     *    0 otherwise
-     */
-    int readable();
-
-    /** Determine if there is space available to write a character
-     * 
-     *  @returns
-     *    1 if there is space to write a character,
-     *    0 otherwise
-     */
-    int writeable();
-
-    /** Attach a function to call whenever a serial interrupt is generated
-     *
-     *  @param fptr A pointer to a void function, or 0 to set as none
-     *  @param type Which serial interrupt to attach the member function to (Seriall::RxIrq for receive, TxIrq for transmit buffer empty)
-     */
-    void attach(void (*fptr)(void), SerialIrq type=RxIrq);
-
-    /** Attach a member function to call whenever a serial interrupt is generated
-     *     
-     *  @param tptr pointer to the object to call the member function on
-     *  @param mptr pointer to the member function to be called
-     *  @param type Which serial interrupt to attach the member function to (Seriall::RxIrq for receive, TxIrq for transmit buffer empty)
-     */
-    template<typename T>
-    void attach(T* tptr, void (T::*mptr)(void), SerialIrq type=RxIrq) {
-        if((mptr != NULL) && (tptr != NULL)) {
-            _irq[type].attach(tptr, mptr);
-            serial_irq_set(&_serial, type, 1);
-        }
-    }
-    
-    static void _irq_handler(uint32_t id, SerialIrq irq_type);
-
-protected:
-    virtual int _getc();
-    virtual int _putc(int c);
-    
-    serial_object   _serial;
-    FunctionPointer _irq[2];
-};
-
-} // namespace mbed
-
-#endif
-
-#endif
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef MBED_SERIAL_H
+#define MBED_SERIAL_H
+
+#include "platform.h"
+
+#if DEVICE_SERIAL
+
+#include "Stream.h"
+#include "FunctionPointer.h"
+#include "serial_api.h"
+
+namespace mbed {
+
+/** A serial port (UART) for communication with other serial devices
+ *
+ * Can be used for Full Duplex communication, or Simplex by specifying
+ * one pin as NC (Not Connected)
+ *
+ * Example:
+ * @code
+ * // Print "Hello World" to the PC
+ *
+ * #include "mbed.h"
+ *
+ * Serial pc(USBTX, USBRX);
+ *
+ * int main() {
+ *     pc.printf("Hello World\n");
+ * }
+ * @endcode
+ */
+class Serial : public Stream {
+
+public:
+    /** Create a Serial port, connected to the specified transmit and receive pins
+     *
+     *  @param tx Transmit pin
+     *  @param rx Receive pin
+     *
+     *  @note
+     *    Either tx or rx may be specified as NC if unused
+     */
+    Serial(PinName tx, PinName rx, const char *name=NULL);
+
+    /** Set the baud rate of the serial port
+     *
+     *  @param baudrate The baudrate of the serial port (default = 9600).
+     */
+    void baud(int baudrate);
+
+    enum Parity {
+        None = 0,
+        Odd,
+        Even,
+        Forced1,
+        Forced0
+    };
+
+    enum IrqType {
+        RxIrq = 0,
+        TxIrq
+    };
+
+    /** Set the transmission format used by the Serial port
+     *
+     *  @param bits The number of bits in a word (5-8; default = 8)
+     *  @param parity The parity used (Serial::None, Serial::Odd, Serial::Even, Serial::Forced1, Serial::Forced0; default = Serial::None)
+     *  @param stop The number of stop bits (1 or 2; default = 1)
+     */
+    void format(int bits = 8, Parity parity=Serial::None, int stop_bits=1);
+
+    /** Determine if there is a character available to read
+     *
+     *  @returns
+     *    1 if there is a character available to read,
+     *    0 otherwise
+     */
+    int readable();
+
+    /** Determine if there is space available to write a character
+     *
+     *  @returns
+     *    1 if there is space to write a character,
+     *    0 otherwise
+     */
+    int writeable();
+
+    /** Attach a function to call whenever a serial interrupt is generated
+     *
+     *  @param fptr A pointer to a void function, or 0 to set as none
+     *  @param type Which serial interrupt to attach the member function to (Seriall::RxIrq for receive, TxIrq for transmit buffer empty)
+     */
+    void attach(void (*fptr)(void), IrqType type=RxIrq);
+
+    /** Attach a member function to call whenever a serial interrupt is generated
+     *
+     *  @param tptr pointer to the object to call the member function on
+     *  @param mptr pointer to the member function to be called
+     *  @param type Which serial interrupt to attach the member function to (Seriall::RxIrq for receive, TxIrq for transmit buffer empty)
+     */
+    template<typename T>
+    void attach(T* tptr, void (T::*mptr)(void), IrqType type=RxIrq) {
+        if((mptr != NULL) && (tptr != NULL)) {
+            _irq[type].attach(tptr, mptr);
+            serial_irq_set(&_serial, (SerialIrq)type, 1);
+        }
+    }
+
+    static void _irq_handler(uint32_t id, SerialIrq irq_type);
+
+protected:
+    virtual int _getc();
+    virtual int _putc(int c);
+
+    serial_t        _serial;
+    FunctionPointer _irq[2];
+};
+
+} // namespace mbed
+
+#endif
+
+#endif
--- a/SerialHalfDuplex.h	Fri Nov 09 11:33:53 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/* mbed Microcontroller Library - SerialHalfDuplex
- * Copyright (c) 2010-2011 ARM Limited. All rights reserved.
- */
-#ifndef MBED_SERIALHALFDUPLEX_H
-#define MBED_SERIALHALFDUPLEX_H
-
-#include "platform.h"
-
-#if DEVICE_SERIAL
-
-#include "Serial.h"
-#include "gpio_api.h"
-
-namespace mbed {
-
-/** A serial port (UART) for communication with other devices using  
- * Half-Duplex, allowing transmit and receive on a single
- * shared transmit and receive line. Only one end should be transmitting 
- * at a time.
- * 
- * Both the tx and rx pin should be defined, and wired together. 
- * This is in addition to them being wired to the other serial 
- * device to allow both read and write functions to operate.
- *
- *  For Simplex and Full-Duplex Serial communication, see Serial()
- *
- *  Example:
- * @code
- * // Send a byte to a second HalfDuplex device, and read the response
- * 
- * #include "mbed.h"
- * 
- * // p9 and p10 should be wired together to form "a"
- * // p28 and p27 should be wired together to form "b"
- * // p9/p10 should be wired to p28/p27 as the Half Duplex connection
- *
- * SerialHalfDuplex a(p9, p10);
- * SerialHalfDuplex b(p28, p27);
- *
- * void b_rx() { // second device response
- *     b.putc(b.getc() + 4);
- * }
- *   
- * int main() {
- *     b.attach(&b_rx);
- *     for (int c = 'A'; c < 'Z'; c++) {
- *         a.putc(c);
- *         printf("sent [%c]\n", c);
- *         wait(0.5);   // b should respond
- *         if (a.readable()) {
- *             printf("received [%c]\n", a.getc());
- *         }
- *     }
- * }
- * @endcode
- */
-class SerialHalfDuplex : public Serial {
-
-public:
-    /** Create a half-duplex serial port, connected to the specified transmit
-     * and receive pins.
-     *
-     * These pins should be wired together, as well as to the target device
-     *
-     *  @param tx Transmit pin
-     *  @param rx Receive pin
-     */
-    SerialHalfDuplex(PinName tx, PinName rx);
-
-protected:
-    gpio_object gpio;
-
-    virtual int _putc(int c);
-    virtual int _getc(void);
-
-}; // End class SerialHalfDuplex
-
-} // End namespace
-
-#endif
-
-#endif
--- a/Stream.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/Stream.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,18 +1,30 @@
-/* mbed Microcontroller Library - Stream
- * Copyright (c) 2007-2009 ARM Limited. All rights reserved.
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 #ifndef MBED_STREAM_H
 #define MBED_STREAM_H
 
 #include "platform.h"
-#include "FileHandle.h"
+#include "FileLike.h"
 
 namespace mbed {
 
-class Stream : public FileHandle {
+class Stream : public FileLike {
 
 public:
-    Stream(void);
+    Stream(const char *name=NULL);
     virtual ~Stream();
 
     int putc(int c);
@@ -21,7 +33,7 @@
     char *gets(char *s, int size);
     int printf(const char* format, ...);
     int scanf(const char* format, ...);
-    
+
     operator std::FILE*() {return _file;}
 
 protected:
@@ -35,7 +47,7 @@
 
     virtual int _putc(int c) = 0;
     virtual int _getc() = 0;
-    
+
     std::FILE *_file;
 };
 
--- a/Ticker.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/Ticker.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,5 +1,17 @@
-/* mbed Microcontroller Library - Ticker
- * Copyright (c) 2007-2009 ARM Limited. All rights reserved.
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 #ifndef MBED_TICKER_H
 #define MBED_TICKER_H
@@ -11,7 +23,7 @@
 
 /** A Ticker is used to call a function at a recurring interval
  *
- *  You can use as many seperate Ticker objects as you require. 
+ *  You can use as many seperate Ticker objects as you require.
  *
  * Example:
  * @code
@@ -22,9 +34,9 @@
  * Ticker timer;
  * DigitalOut led1(LED1);
  * DigitalOut led2(LED2);
- * 
+ *
  * int flip = 0;
- * 
+ *
  * void attime() {
  *     flip = !flip;
  * }
@@ -54,7 +66,7 @@
     void attach(void (*fptr)(void), float t) {
         attach_us(fptr, t * 1000000.0f);
     }
-    
+
     /** Attach a member function to be called by the Ticker, specifiying the interval in seconds
      *
      *  @param tptr pointer to the object to call the member function on
@@ -65,7 +77,7 @@
     void attach(T* tptr, void (T::*mptr)(void), float t) {
         attach_us(tptr, mptr, t * 1000000.0f);
     }
-    
+
     /** Attach a function to be called by the Ticker, specifiying the interval in micro-seconds
      *
      *  @param fptr pointer to the function to be called
@@ -81,13 +93,13 @@
      *  @param tptr pointer to the object to call the member function on
      *  @param mptr pointer to the member function to be called
      *  @param t the time between calls in micro-seconds
-     */    
+     */
     template<typename T>
     void attach_us(T* tptr, void (T::*mptr)(void), unsigned int t) {
         _function.attach(tptr, mptr);
         setup(t);
     }
-    
+
     /** Detach the function
      */
     void detach();
@@ -95,7 +107,7 @@
 protected:
     void setup(unsigned int t);
     virtual void handler();
-    
+
     unsigned int _delay;
     FunctionPointer _function;
 };
--- a/Timeout.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/Timeout.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,5 +1,17 @@
-/* mbed Microcontroller Library - Timeout
- * Copyright (c) 2007-2009 ARM Limited. All rights reserved.
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 #ifndef MBED_TIMEOUT_H
 #define MBED_TIMEOUT_H
@@ -10,23 +22,23 @@
 
 /** A Timeout is used to call a function at a point in the future
  *
- * You can use as many seperate Timeout objects as you require. 
+ * You can use as many seperate Timeout objects as you require.
  *
  * Example:
  * @code
  * // Blink until timeout.
  *
  * #include "mbed.h"
- * 
+ *
  * Timeout timeout;
  * DigitalOut led(LED1);
- * 
+ *
  * int on = 1;
- * 
+ *
  * void attimeout() {
  *     on = 0;
  * }
- * 
+ *
  * int main() {
  *     timeout.attach(&attimeout, 5);
  *     while(on) {
--- a/Timer.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/Timer.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,76 +1,88 @@
-/* mbed Microcontroller Library - Timer
- * Copyright (c) 2007-2009 ARM Limited. All rights reserved.
- */
-#ifndef MBED_TIMER_H
-#define MBED_TIMER_H
-
-#include "platform.h"
-
-namespace mbed {
-
-/** A general purpose timer 
- *
- * Example:
- * @code
- * // Count the time to toggle a LED
- *
- * #include "mbed.h"
- * 
- * Timer timer;
- * DigitalOut led(LED1);
- * int begin, end;
- * 
- * int main() {
- *     timer.start();
- *     begin = timer.read_us();
- *     led = !led;
- *     end = timer.read_us();
- *     printf("Toggle the led takes %d us", end - begin);
- * }
- * @endcode
- */
-class Timer {
-
-public:
-    Timer();
-    
-    /** Start the timer
-     */
-    void start(); 
-
-    /** Stop the timer
-     */
-    void stop(); 
-
-    /** Reset the timer to 0. 
-     *
-     * If it was already counting, it will continue
-     */
-    void reset();
-
-    /** Get the time passed in seconds
-     */
-    float read();
-
-    /** Get the time passed in mili-seconds
-     */
-    int read_ms();
-
-    /** Get the time passed in micro-seconds
-     */
-    int read_us();
-
-#ifdef MBED_OPERATORS 
-    operator float();
-#endif
-
-protected:
-    int slicetime();
-    int _running;          // whether the timer is running
-    unsigned int _start;   // the start time of the latest slice
-    int _time;             // any accumulated time from previous slices
-};
-
-} // namespace mbed
-
-#endif
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef MBED_TIMER_H
+#define MBED_TIMER_H
+
+#include "platform.h"
+
+namespace mbed {
+
+/** A general purpose timer
+ *
+ * Example:
+ * @code
+ * // Count the time to toggle a LED
+ *
+ * #include "mbed.h"
+ *
+ * Timer timer;
+ * DigitalOut led(LED1);
+ * int begin, end;
+ *
+ * int main() {
+ *     timer.start();
+ *     begin = timer.read_us();
+ *     led = !led;
+ *     end = timer.read_us();
+ *     printf("Toggle the led takes %d us", end - begin);
+ * }
+ * @endcode
+ */
+class Timer {
+
+public:
+    Timer();
+
+    /** Start the timer
+     */
+    void start();
+
+    /** Stop the timer
+     */
+    void stop();
+
+    /** Reset the timer to 0.
+     *
+     * If it was already counting, it will continue
+     */
+    void reset();
+
+    /** Get the time passed in seconds
+     */
+    float read();
+
+    /** Get the time passed in mili-seconds
+     */
+    int read_ms();
+
+    /** Get the time passed in micro-seconds
+     */
+    int read_us();
+
+#ifdef MBED_OPERATORS
+    operator float();
+#endif
+
+protected:
+    int slicetime();
+    int _running;          // whether the timer is running
+    unsigned int _start;   // the start time of the latest slice
+    int _time;             // any accumulated time from previous slices
+};
+
+} // namespace mbed
+
+#endif
--- a/TimerEvent.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/TimerEvent.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,40 +1,52 @@
-/* mbed Microcontroller Library - TimerEvent
- * Copyright (c) 2007-2009 ARM Limited. All rights reserved.
- */
-#ifndef MBED_TIMEREVENT_H
-#define MBED_TIMEREVENT_H
-
-#include "us_ticker_api.h"
-
-namespace mbed {
-
-/** Base abstraction for timer interrupts
-*/
-class TimerEvent {
-public:
-    TimerEvent();
-    
-    /** The handler registered with the underlying timer interrupt
-     */
-    static void irq(uint32_t id);
-    
-    /** Destruction removes it...
-     */
-    virtual ~TimerEvent();
-
-protected:
-    // The handler called to service the timer event of the derived class
-    virtual void handler() = 0;
-    
-    // insert in to linked list
-    void insert(unsigned int timestamp);
-    
-    // remove from linked list, if in it
-    void remove();
-    
-    ticker_event event;
-};
-
-} // namespace mbed
-
-#endif
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef MBED_TIMEREVENT_H
+#define MBED_TIMEREVENT_H
+
+#include "us_ticker_api.h"
+
+namespace mbed {
+
+/** Base abstraction for timer interrupts
+*/
+class TimerEvent {
+public:
+    TimerEvent();
+
+    /** The handler registered with the underlying timer interrupt
+     */
+    static void irq(uint32_t id);
+
+    /** Destruction removes it...
+     */
+    virtual ~TimerEvent();
+
+protected:
+    // The handler called to service the timer event of the derived class
+    virtual void handler() = 0;
+
+    // insert in to linked list
+    void insert(unsigned int timestamp);
+
+    // remove from linked list, if in it
+    void remove();
+
+    ticker_event_t event;
+};
+
+} // namespace mbed
+
+#endif
--- a/analogin_api.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/analogin_api.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,26 +1,39 @@
-/* mbed Microcontroller Library - analogin_api
- * Copyright (c) 2009-2011 ARM Limited. All rights reserved.
- */
-#ifndef MBED_ANALOGIN_API_H
-#define MBED_ANALOGIN_API_H
-
-#include "device.h"
-
-#if DEVICE_ANALOGIN
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-ADCName analogin_init(PinName pin);
-
-float analogin_read(ADCName adc);
-uint16_t analogin_read_u16(ADCName adc);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-#endif
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef MBED_ANALOGIN_API_H
+#define MBED_ANALOGIN_API_H
+
+#include "device.h"
+
+#if DEVICE_ANALOGIN
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct analogin_s analogin_t;
+
+void     analogin_init    (analogin_t *obj, PinName pin);
+float    analogin_read    (analogin_t *obj);
+uint16_t analogin_read_u16(analogin_t *obj);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+#endif
--- a/analogout_api.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/analogout_api.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,29 +1,42 @@
-/* mbed Microcontroller Library - analogout_api
- * Copyright (c) 2009-2011 ARM Limited. All rights reserved.
- */
-#ifndef MBED_ANALOGOUT_API_H
-#define MBED_ANALOGOUT_API_H
-
-#include "device.h"
-
-#if DEVICE_ANALOGOUT
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-DACName analogout_init(PinName pin);
-void analogout_free(DACName dac);
-
-void analogout_write(DACName dac, float value);
-void analogout_write_u16(DACName dac, uint16_t value);
-float analogout_read(DACName dac);
-uint16_t analogout_read_u16(DACName dac);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-#endif
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef MBED_ANALOGOUT_API_H
+#define MBED_ANALOGOUT_API_H
+
+#include "device.h"
+
+#if DEVICE_ANALOGOUT
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct dac_s dac_t;
+
+void     analogout_init     (dac_t *obj, PinName pin);
+void     analogout_free     (dac_t *obj);
+void     analogout_write    (dac_t *obj, float value);
+void     analogout_write_u16(dac_t *obj, uint16_t value);
+float    analogout_read     (dac_t *obj);
+uint16_t analogout_read_u16 (dac_t *obj);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+#endif
--- a/can_api.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/can_api.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,5 +1,17 @@
-/* mbed Microcontroller Library - can_api
- * Copyright (c) 2009-2011 ARM Limited. All rights reserved.
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 #ifndef MBED_CAN_API_H
 #define MBED_CAN_API_H
@@ -8,7 +20,7 @@
 
 #if DEVICE_CAN
 
-#include "PinNames.h" 
+#include "PinNames.h"
 #include "PeripheralNames.h"
 #include "can_helper.h"
 
@@ -16,19 +28,17 @@
 extern "C" {
 #endif
 
-CANName can_init(PinName rd, PinName td);
-void can_free(CANName id);
-
-int can_frequency(CANName id, int hz);
+typedef struct can_s can_t;
 
-int can_write(CANName id, CAN_Message, int cc);
-int can_read(CANName id, CAN_Message *msg);
-
-void can_reset(CANName id);
-unsigned char can_rderror(CANName id);
-unsigned char can_tderror(CANName id);
-
-void can_monitor(CANName id, int silent);
+void          can_init     (can_t *obj, PinName rd, PinName td);
+void          can_free     (can_t *obj);
+int           can_frequency(can_t *obj, int hz);
+int           can_write    (can_t *obj, CAN_Message, int cc);
+int           can_read     (can_t *obj, CAN_Message *msg);
+void          can_reset    (can_t *obj);
+unsigned char can_rderror  (can_t *obj);
+unsigned char can_tderror  (can_t *obj);
+void          can_monitor  (can_t *obj, int silent);
 
 #ifdef __cplusplus
 };
--- a/can_helper.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/can_helper.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,15 +1,27 @@
-/* mbed Microcontroller Library - can_helper
- * Copyright (c) 2009 ARM Limited. All rights reserved.
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 #ifndef MBED_CAN_HELPER_H
 #define MBED_CAN_HELPER_H
 
+#if DEVICE_CAN
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-#if DEVICE_CAN
-
 enum CANFormat {
     CANStandard = 0,
     CANExtended = 1
@@ -31,10 +43,10 @@
 };
 typedef struct CAN_Message CAN_Message;
 
-#endif
-
 #ifdef __cplusplus
 };
 #endif
 
+#endif
+
 #endif // MBED_CAN_HELPER_H
--- a/error.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/error.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,5 +1,17 @@
-/* mbed Microcontroller Library - error
- * Copyright (c) 2006-2009 ARM Limited. All rights reserved.
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 #ifndef MBED_ERROR_H
 #define MBED_ERROR_H
@@ -28,12 +40,12 @@
  * error("That shouldn't have happened!");
  * @endcode
  *
- * If the mbed running the program executes this function, it will print the 
+ * If the mbed running the program executes this function, it will print the
  * message via the USB serial port, and then die with the blue lights of death!
  *
- * The message can use printf-style formatting, so you can report variables in the 
+ * The message can use printf-style formatting, so you can report variables in the
  * message too. For example, you could use this to check a run-time condition:
- * 
+ *
  * @code
  * if(x >= 5) {
  *     error("expected x to be less than 5, but got %d", x);
@@ -42,12 +54,13 @@
  */
 
 #include <stdlib.h>
+#include "device.h"
 
-#ifdef NDEBUG
-    #define error(...) (exit(1))
-#else
+#ifdef DEVICE_STDIO_MESSAGES
     #include <stdio.h>
     #define error(...) (fprintf(stderr, __VA_ARGS__), exit(1))
+#else
+    #define error(...) (exit(1))
 #endif
 
 #endif
--- a/ethernet_api.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/ethernet_api.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,5 +1,17 @@
-/* mbed Microcontroller Library - ethernet_api
- * Copyright (c) 2009-2011 ARM Limited. All rights reserved.
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 #ifndef MBED_ETHERNET_API_H
 #define MBED_ETHERNET_API_H
--- a/gpio_api.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/gpio_api.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,28 +1,40 @@
-/* mbed Microcontroller Library - gpio_api
- * Copyright (c) 2009-2011 ARM Limited. All rights reserved.
- */
-#ifndef MBED_GPIO_API_H
-#define MBED_GPIO_API_H
-
-#include "device.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Set the given pin as GPIO
- * @param pin The pin to be set as GPIO
- * @return The GPIO port mask for this pin
- **/
-uint32_t gpio_set(PinName pin);
-
-/* GPIO object */
-void gpio_init(gpio_object *obj, PinName pin, PinDirection direction);
-void gpio_mode(gpio_object *obj, PinMode mode);
-void gpio_dir (gpio_object *obj, PinDirection direction);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef MBED_GPIO_API_H
+#define MBED_GPIO_API_H
+
+#include "device.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Set the given pin as GPIO
+ * @param pin The pin to be set as GPIO
+ * @return The GPIO port mask for this pin
+ **/
+uint32_t gpio_set(PinName pin);
+
+/* GPIO object */
+void gpio_init(gpio_t *obj, PinName pin, PinDirection direction);
+void gpio_mode(gpio_t *obj, PinMode mode);
+void gpio_dir (gpio_t *obj, PinDirection direction);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- a/gpio_irq_api.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/gpio_irq_api.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,35 +1,47 @@
-/* mbed Microcontroller Library - gpio_irq_api
- * Copyright (c) 2009-2011 ARM Limited. All rights reserved.
- */
-#ifndef MBED_GPIO_IRQ_API_H
-#define MBED_GPIO_IRQ_API_H
-
-#include "device.h"
-
-#if DEVICE_INTERRUPTIN
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-    IRQ_NONE,
-    IRQ_RISE,
-    IRQ_FALL
-} gpio_irq_event;
-
-typedef struct gpio_irq_object_s gpio_irq_object;
-
-typedef void (*gpio_irq_handler)(uint32_t id, gpio_irq_event event);
-
-int  gpio_irq_init(gpio_irq_object *obj, PinName pin, gpio_irq_handler handler, uint32_t id);
-void gpio_irq_free(gpio_irq_object *obj);
-void gpio_irq_set (gpio_irq_object *obj, gpio_irq_event event, uint32_t enable);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-#endif
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef MBED_GPIO_IRQ_API_H
+#define MBED_GPIO_IRQ_API_H
+
+#include "device.h"
+
+#if DEVICE_INTERRUPTIN
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum {
+    IRQ_NONE,
+    IRQ_RISE,
+    IRQ_FALL
+} gpio_irq_event;
+
+typedef struct gpio_irq_s gpio_irq_t;
+
+typedef void (*gpio_irq_handler)(uint32_t id, gpio_irq_event event);
+
+int  gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32_t id);
+void gpio_irq_free(gpio_irq_t *obj);
+void gpio_irq_set (gpio_irq_t *obj, gpio_irq_event event, uint32_t enable);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+#endif
--- a/i2c_api.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/i2c_api.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,40 +1,53 @@
-/* mbed Microcontroller Library - i2c_api
- * Copyright (c) 2009-2011 ARM Limited. All rights reserved.
- */
-#ifndef MBED_I2C_API_H
-#define MBED_I2C_API_H
-
-#include "device.h"
-
-#if DEVICE_I2C
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-I2CName i2c_init(PinName sda, PinName scl);
-
-void i2c_frequency (I2CName i2c, int hz);
-int  i2c_start     (I2CName i2c);
-void i2c_stop      (I2CName i2c);
-int  i2c_read      (I2CName i2c, int address, char *data, int length, int stop); 
-int  i2c_write     (I2CName i2c, int address, const char *data, int length, int stop);
-void i2c_reset     (I2CName i2c);
-int  i2c_byte_read (I2CName i2c, int last);
-int  i2c_byte_write(I2CName i2c, int data);
-
-#if DEVICE_I2CSLAVE
-void i2c_slave_mode   (I2CName i2c, int enable_slave);
-int  i2c_slave_receive(I2CName i2c);
-int  i2c_slave_read   (I2CName i2c, char *data, int length);
-int  i2c_slave_write  (I2CName i2c, const char *data, int length);
-void i2c_slave_address(I2CName i2c, int idx, uint32_t address, uint32_t mask);
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-#endif
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef MBED_I2C_API_H
+#define MBED_I2C_API_H
+
+#include "device.h"
+
+#if DEVICE_I2C
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct i2c_s i2c_t;
+
+void i2c_init         (i2c_t *obj, PinName sda, PinName scl);
+void i2c_frequency    (i2c_t *obj, int hz);
+int  i2c_start        (i2c_t *obj);
+void i2c_stop         (i2c_t *obj);
+int  i2c_read         (i2c_t *obj, int address, char *data, int length, int stop);
+int  i2c_write        (i2c_t *obj, int address, const char *data, int length, int stop);
+void i2c_reset        (i2c_t *obj);
+int  i2c_byte_read    (i2c_t *obj, int last);
+int  i2c_byte_write   (i2c_t *obj, int data);
+
+#if DEVICE_I2CSLAVE
+void i2c_slave_mode   (i2c_t *obj, int enable_slave);
+int  i2c_slave_receive(i2c_t *obj);
+int  i2c_slave_read   (i2c_t *obj, char *data, int length);
+int  i2c_slave_write  (i2c_t *obj, const char *data, int length);
+void i2c_slave_address(i2c_t *obj, int idx, uint32_t address, uint32_t mask);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+#endif
--- a/mbed.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/mbed.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,15 +1,26 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2011 ARM Limited. All rights reserved.
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 #ifndef MBED_H
 #define MBED_H
 
-#define MBED_LIBRARY_VERSION 29
- 
+#define MBED_LIBRARY_VERSION 30
+
+#include "platform.h"
+
 // Useful C libraries
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
 #include <math.h>
 #include <time.h>
 
@@ -31,10 +42,8 @@
 #include "AnalogOut.h"
 #include "PwmOut.h"
 #include "Serial.h"
-#include "SerialHalfDuplex.h"
 #include "SPI.h"
 #include "SPISlave.h"
-#include "SPIHalfDuplex.h"
 #include "I2C.h"
 #include "I2CSlave.h"
 #include "Ethernet.h"
@@ -47,6 +56,7 @@
 #include "LocalFileSystem.h"
 #include "InterruptIn.h"
 #include "wait_api.h"
+#include "sleep_api.h"
 #include "rtc_time.h"
 
 using namespace mbed;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed_debug.h	Mon Feb 18 09:41:56 2013 +0000
@@ -0,0 +1,66 @@
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef MBED_DEBUG_H
+#define MBED_DEBUG_H
+#include "device.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef DEVICE_STDIO_MESSAGES
+#include <stdio.h>
+#include <stdarg.h>
+
+/** Output a debug message
+ *
+ * @param format printf-style format string, followed by variables
+ */
+static inline void debug(const char *format, ...) {
+    va_list args;
+    va_start(args, format);
+    vfprintf(stderr, format, args);
+    va_end(args);
+}
+
+/** Conditionally output a debug message
+ *
+ * NOTE: If the condition is constant false (!= 1) and the compiler optimization
+ * level is greater than 0, then the whole function will be compiled away.
+ *
+ * @param condition output only if condition is true (== 1)
+ * @param format printf-style format string, followed by variables
+ */
+static inline void debug_if(int condition, const char *format, ...) {
+    if (condition == 1) {
+        va_list args;
+        va_start(args, format);
+        vfprintf(stderr, format, args);
+        va_end(args);
+    }
+}
+
+#else
+static inline void debug(const char *format, ...) {}
+static inline void debug_if(int condition, const char *format, ...) {}
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- a/mbed_interface.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/mbed_interface.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,23 +1,39 @@
-/** Functions to control the mbed interface
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
- * mbed Microcontrollers have a built-in interface to provide functionality such as 
- * drag-n-drop download, reset, serial-over-usb, and access to the mbed local file 
- * system. These functions provide means to control the interface suing semihost
- * calls it supports.
- */
- 
-/* mbed Microcontroller Library - mbed_interface
- * Copyright (c) 2009-2011 ARM Limited. All rights reserved.
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 #ifndef MBED_INTERFACE_H
 #define MBED_INTERFACE_H
 
+#include "device.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+#if DEVICE_SEMIHOST
+
+/** Functions to control the mbed interface
+ *
+ * mbed Microcontrollers have a built-in interface to provide functionality such as
+ * drag-n-drop download, reset, serial-over-usb, and access to the mbed local file
+ * system. These functions provide means to control the interface suing semihost
+ * calls it supports.
+ */
+
 /** Determine whether the mbed interface is connected, based on whether debug is enabled
- * 
+ *
  *  @returns
  *    1 if interface is connected,
  *    0 otherwise
@@ -41,9 +57,9 @@
  */
 int mbed_interface_disconnect(void);
 
-/** This will disconnect the debug aspect of the interface, and if the USB cable is not 
+/** This will disconnect the debug aspect of the interface, and if the USB cable is not
  * connected, also power down the interface. If the USB cable is connected, the interface
- * will remain powered up and visible to the host 
+ * will remain powered up and visible to the host
  *
  *  @returns
  *    0 if successful,
@@ -62,6 +78,8 @@
  */
 int mbed_interface_uid(char *uid);
 
+#endif
+
 /** This returns a unique 6-byte MAC address, based on the interface UID
  * If the interface is not present, it returns a default fixed MAC address (00:02:F7:F0:00:00)
  *
@@ -72,7 +90,7 @@
  */
 void mbed_mac_address(char *mac);
 
-/** Cause the mbed to flash the BLOD LED sequence
+/** Cause the mbed to flash the BLOD (Blue LEDs Of Death) sequence
  */
 void mbed_die(void);
 
--- a/pinmap.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/pinmap.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,32 +1,44 @@
-/* mbed Microcontroller Library - pinmap
- * Copyright (c) 2009 ARM Limited. All rights reserved.
- */
-#ifndef MBED_PINMAP_H
-#define MBED_PINMAP_H
-
-#include "PinNames.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-PinName parse_pins(const char *str);
-
-typedef struct {
-    PinName pin;
-    int peripheral;
-    int function;
-} PinMap;
-
-void pin_function(PinName pin, int function);
-void pin_mode    (PinName pin, PinMode mode);
-
-uint32_t pinmap_peripheral(PinName pin, const PinMap* map);
-uint32_t pinmap_merge     (uint32_t a, uint32_t b);
-void     pinmap_pinout    (PinName pin, const PinMap *map);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef MBED_PINMAP_H
+#define MBED_PINMAP_H
+
+#include "PinNames.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+PinName parse_pins(const char *str);
+
+typedef struct {
+    PinName pin;
+    int peripheral;
+    int function;
+} PinMap;
+
+void pin_function(PinName pin, int function);
+void pin_mode    (PinName pin, PinMode mode);
+
+uint32_t pinmap_peripheral(PinName pin, const PinMap* map);
+uint32_t pinmap_merge     (uint32_t a, uint32_t b);
+void     pinmap_pinout    (PinName pin, const PinMap *map);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- a/platform.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/platform.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,18 +1,30 @@
-/* mbed Microcontroller Library - platform
- * Copyright (c) 2009 ARM Limited. All rights reserved.
- */
-#ifndef MBED_PLATFORM_H
-#define MBED_PLATFORM_H
-
-#define MBED_OPERATORS    1
-
-#include "device.h"
-#include "PinNames.h"
-#include "PeripheralNames.h"
-
-#include <cstddef>
-#include <cstdlib>
-#include <cstdio>
-#include <cstring>
-
-#endif
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef MBED_PLATFORM_H
+#define MBED_PLATFORM_H
+
+#define MBED_OPERATORS    1
+
+#include "device.h"
+#include "PinNames.h"
+#include "PeripheralNames.h"
+
+#include <cstddef>
+#include <cstdlib>
+#include <cstdio>
+#include <cstring>
+
+#endif
--- a/port_api.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/port_api.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,5 +1,17 @@
-/* mbed Microcontroller Library - portmap
- * Copyright (c) 2010-2011 ARM Limited. All rights reserved.
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 #ifndef MBED_PORTMAP_H
 #define MBED_PORTMAP_H
@@ -12,15 +24,15 @@
 extern "C" {
 #endif
 
-typedef struct port_object_s port_object;
+typedef struct port_s port_t;
 
 PinName port_pin(PortName port, int pin_n);
 
-void port_init (port_object *obj, PortName port, int mask, PinDirection dir);
-void port_mode (port_object *obj, PinMode mode);
-void port_dir  (port_object *obj, PinDirection dir);
-void port_write(port_object *obj, int value);
-int  port_read (port_object *obj);
+void port_init (port_t *obj, PortName port, int mask, PinDirection dir);
+void port_mode (port_t *obj, PinMode mode);
+void port_dir  (port_t *obj, PinDirection dir);
+void port_write(port_t *obj, int value);
+int  port_read (port_t *obj);
 
 #ifdef __cplusplus
 }
--- a/pwmout_api.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/pwmout_api.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,37 +1,49 @@
-/* mbed Microcontroller Library - pwmout_api
- * Copyright (c) 2009-2011 ARM Limited. All rights reserved.
- */
-#ifndef MBED_PWMOUT_API_H
-#define MBED_PWMOUT_API_H
-
-#include "device.h"
-
-#if DEVICE_PWMOUT
-
-#ifdef __cplusplus
-extern "C" {
-#endif 
-
-typedef struct pwmout_object_s pwmout_object;
-
-void pwmout_init         (pwmout_object* obj, PinName pin);
-void pwmout_free         (pwmout_object* obj);
-
-void  pwmout_write       (pwmout_object* obj, float percent);
-float pwmout_read        (pwmout_object* obj);
-
-void pwmout_period       (pwmout_object* obj, float seconds);
-void pwmout_period_ms    (pwmout_object* obj, int ms);
-void pwmout_period_us    (pwmout_object* obj, int us);
-
-void pwmout_pulsewidth   (pwmout_object* obj, float seconds);
-void pwmout_pulsewidth_ms(pwmout_object* obj, int ms);
-void pwmout_pulsewidth_us(pwmout_object* obj, int us);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-#endif
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef MBED_PWMOUT_API_H
+#define MBED_PWMOUT_API_H
+
+#include "device.h"
+
+#if DEVICE_PWMOUT
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct pwmout_s pwmout_t;
+
+void pwmout_init         (pwmout_t* obj, PinName pin);
+void pwmout_free         (pwmout_t* obj);
+
+void  pwmout_write       (pwmout_t* obj, float percent);
+float pwmout_read        (pwmout_t* obj);
+
+void pwmout_period       (pwmout_t* obj, float seconds);
+void pwmout_period_ms    (pwmout_t* obj, int ms);
+void pwmout_period_us    (pwmout_t* obj, int us);
+
+void pwmout_pulsewidth   (pwmout_t* obj, float seconds);
+void pwmout_pulsewidth_ms(pwmout_t* obj, int ms);
+void pwmout_pulsewidth_us(pwmout_t* obj, int us);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+#endif
--- a/rtc_api.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/rtc_api.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,30 +1,42 @@
-/* mbed Microcontroller Library - rtc_api
- * Copyright (c) 2009-2011 ARM Limited. All rights reserved.
- */
-#ifndef MBED_RTC_API_H
-#define MBED_RTC_API_H
-
-#include "device.h"
-
-#if DEVICE_RTC
-
-#include <time.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif 
-
-void rtc_init(void);
-void rtc_free(void);
-int rtc_isenabled(void);
-
-time_t rtc_read(void);
-void rtc_write(time_t t);
-
-#ifdef __cplusplus
-}
-#endif 
-
-#endif
-
-#endif
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef MBED_RTC_API_H
+#define MBED_RTC_API_H
+
+#include "device.h"
+
+#if DEVICE_RTC
+
+#include <time.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void rtc_init(void);
+void rtc_free(void);
+int rtc_isenabled(void);
+
+time_t rtc_read(void);
+void rtc_write(time_t t);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+#endif
--- a/rtc_time.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/rtc_time.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,62 +1,74 @@
-/** Implementation of the C time.h functions
- *
- * Provides mechanisms to set and read the current time, based
- * on the microcontroller Real-Time Clock (RTC), plus some 
- * standard C manipulation and formating functions. 
- *
- * Example:
- * @code
- * #include "mbed.h"
- *
- * int main() {
- *     set_time(1256729737);  // Set RTC time to Wed, 28 Oct 2009 11:35:37
- *      
- *     while(1) {    
- *         time_t seconds = time(NULL);
- *         
- *         printf("Time as seconds since January 1, 1970 = %d\n", seconds);
- *  
- *         printf("Time as a basic string = %s", ctime(&seconds));
- *
- *         char buffer[32];
- *         strftime(buffer, 32, "%I:%M %p\n", localtime(&seconds));
- *         printf("Time as a custom formatted string = %s", buffer);
- *    
- *         wait(1);
- *     }
- * }
- * @endcode
- */
- 
-/* mbed Microcontroller Library - rtc_time
- * Copyright (c) 2009 ARM Limited. All rights reserved.
- */
-
-#include <time.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** Set the current time
- *
- * Initialises and sets the time of the microcontroller Real-Time Clock (RTC)
- * to the time represented by the number of seconds since January 1, 1970 
- * (the UNIX timestamp). 
- * 
- * @param t Number of seconds since January 1, 1970 (the UNIX timestamp) 
- *
- * Example:
- * @code
- * #include "mbed.h"
- *
- * int main() {
- *     set_time(1256729737); // Set time to Wed, 28 Oct 2009 11:35:37
- * }
- * @endcode
- */ 
-void set_time(time_t t);
-
-#ifdef __cplusplus
-}
-#endif 
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <time.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Implementation of the C time.h functions
+ *
+ * Provides mechanisms to set and read the current time, based
+ * on the microcontroller Real-Time Clock (RTC), plus some
+ * standard C manipulation and formating functions.
+ *
+ * Example:
+ * @code
+ * #include "mbed.h"
+ *
+ * int main() {
+ *     set_time(1256729737);  // Set RTC time to Wed, 28 Oct 2009 11:35:37
+ *
+ *     while(1) {
+ *         time_t seconds = time(NULL);
+ *
+ *         printf("Time as seconds since January 1, 1970 = %d\n", seconds);
+ *
+ *         printf("Time as a basic string = %s", ctime(&seconds));
+ *
+ *         char buffer[32];
+ *         strftime(buffer, 32, "%I:%M %p\n", localtime(&seconds));
+ *         printf("Time as a custom formatted string = %s", buffer);
+ *
+ *         wait(1);
+ *     }
+ * }
+ * @endcode
+ */
+
+/** Set the current time
+ *
+ * Initialises and sets the time of the microcontroller Real-Time Clock (RTC)
+ * to the time represented by the number of seconds since January 1, 1970
+ * (the UNIX timestamp).
+ *
+ * @param t Number of seconds since January 1, 1970 (the UNIX timestamp)
+ *
+ * Example:
+ * @code
+ * #include "mbed.h"
+ *
+ * int main() {
+ *     set_time(1256729737); // Set time to Wed, 28 Oct 2009 11:35:37
+ * }
+ * @endcode
+ */
+void set_time(time_t t);
+
+#ifdef __cplusplus
+}
+#endif
--- a/semihost_api.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/semihost_api.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,84 +1,93 @@
-/* mbed Microcontroller Library - semihost_api
- * Copyright (c) 2006-2009 ARM Limited. All rights reserved.
- */
-#ifndef MBED_SEMIHOST_H
-#define MBED_SEMIHOST_H
-
-#include "device.h"
-#include "toolchain.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* __semihost intrinsic
- This intrinsic inserts an SVC or BKPT instruction into the instruction stream
- generated by the compiler. It enables you to make semihosting calls from C or
- C++ that are independent of the target architecture.
- */
-#ifndef __CC_ARM
-/* Semihost implementation taken from:
- *    git://github.com/elua/elua.git/src/semifs.c
- */
-
-/* SWI numbers for RDI (Angel) monitors */
-#ifdef __thumb__
-#define AngelSWI            0xAB
-#else
-#define AngelSWI            0x123456
-#endif
-/* For Thumb-2 code use the BKPT instruction instead of SWI */
-#ifdef __thumb2__
-#define AngelSWIInsn        "bkpt"
-#define AngelSWIAsm          bkpt
-#else
-#define AngelSWIInsn        "swi"
-#define AngelSWIAsm          swi
-#endif
-
-inline int __semihost(int reason, const void *arg) {
-  int value;
-  asm volatile ("mov r0, %1; mov r1, %2; " AngelSWIInsn " %a3; mov %0, r0"
-       : "=r" (value) /* Outputs */
-       : "r" (reason), "r" (arg), "i" (AngelSWI) /* Inputs */
-       : "r0", "r1", "r2", "r3", "ip", "lr", "memory", "cc"
-                /* Clobbers r0 and r1, and lr if in supervisor mode */);
-                /* Accordingly to page 13-77 of ARM DUI 0040D other registers
-                   can also be clobbered.  Some memory positions may also be
-                   changed by a system call, so they should not be kept in
-                   registers. Note: we are assuming the manual is right and
-                   Angel is respecting the APCS.  */
-  
-  return value;
-}
-
-#endif
-
-#if DEVICE_LOCALFILESYSTEM
-FILEHANDLE semihost_open(const char* name, int openmode);
-int semihost_close(FILEHANDLE fh);
-int semihost_read(FILEHANDLE fh, unsigned char* buffer, unsigned int length, int mode);
-int semihost_write(FILEHANDLE fh, const unsigned char* buffer, unsigned int length, int mode);
-int semihost_ensure(FILEHANDLE fh);
-long semihost_flen(FILEHANDLE fh);
-int semihost_seek(FILEHANDLE fh, long position);
-int semihost_istty(FILEHANDLE fh);
-
-int semihost_remove(const char *name);
-int semihost_rename(const char *old_name, const char *new_name);
-#endif
-
-int semihost_uid(char *uid);
-int semihost_reset(void);
-int semihost_vbus(void);
-int semihost_powerdown(void);
-int semihost_exit(void);
-
-int semihost_connected(void);
-int semihost_disabledebug(void);
-
-#ifdef __cplusplus
-}
-#endif 
-
-#endif
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef MBED_SEMIHOST_H
+#define MBED_SEMIHOST_H
+
+#include "device.h"
+#include "toolchain.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if DEVICE_SEMIHOST
+
+#ifndef __CC_ARM
+
+#if defined(__ICCARM__)
+inline int __semihost(int reason, const void *arg) {
+    return __semihosting(reason, (void*)arg);
+}
+#else
+
+#ifdef __thumb__
+#   define AngelSWI            0xAB
+#   define AngelSWIInsn        "bkpt"
+#   define AngelSWIAsm          bkpt
+#else
+#   define AngelSWI            0x123456
+#   define AngelSWIInsn        "swi"
+#   define AngelSWIAsm          swi
+#endif
+
+inline int __semihost(int reason, const void *arg) {
+    int value;
+
+    asm volatile (
+       "mov r0, %1"          "\n\t"
+       "mov r1, %2"          "\n\t"
+       AngelSWIInsn " %a3"   "\n\t"
+       "mov %0, r0"
+       : "=r" (value)                                         /* output operands             */
+       : "r" (reason), "r" (arg), "i" (AngelSWI)              /* input operands              */
+       : "r0", "r1", "r2", "r3", "ip", "lr", "memory", "cc"   /* list of clobbered registers */
+    );
+
+    return value;
+}
+#endif
+#endif
+
+#if DEVICE_LOCALFILESYSTEM
+FILEHANDLE semihost_open(const char* name, int openmode);
+int semihost_close (FILEHANDLE fh);
+int semihost_read  (FILEHANDLE fh, unsigned char* buffer, unsigned int length, int mode);
+int semihost_write (FILEHANDLE fh, const unsigned char* buffer, unsigned int length, int mode);
+int semihost_ensure(FILEHANDLE fh);
+long semihost_flen (FILEHANDLE fh);
+int semihost_seek  (FILEHANDLE fh, long position);
+int semihost_istty (FILEHANDLE fh);
+
+int semihost_remove(const char *name);
+int semihost_rename(const char *old_name, const char *new_name);
+#endif
+
+int semihost_uid(char *uid);
+int semihost_reset(void);
+int semihost_vbus(void);
+int semihost_powerdown(void);
+int semihost_exit(void);
+
+int semihost_connected(void);
+int semihost_disabledebug(void);
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- a/serial_api.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/serial_api.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,57 +1,66 @@
-/* mbed Microcontroller Library - serial_api
- * Copyright (c) 2009-2011 ARM Limited. All rights reserved.
- */
-#ifndef MBED_SERIAL_API_H
-#define MBED_SERIAL_API_H
-
-#include "device.h"
-
-#if DEVICE_SERIAL
-
-#include "PinNames.h"
-#include "PeripheralNames.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-    ParityNone = 0,
-    ParityOdd = 1,
-    ParityEven = 2,
-    ParityForced1 = 3,
-    ParityForced0 = 4
-} SerialParity;
-
-typedef enum {
-    TxIrq,
-    RxIrq
-} SerialIrq;
-
-typedef void (*uart_irq_handler)(uint32_t id, SerialIrq event);
-
-typedef struct serial_object_s serial_object;
-
-void serial_init       (serial_object *obj, PinName tx, PinName rx);
-void serial_free       (serial_object *obj);
-void serial_baud       (serial_object *obj, int baudrate);
-void serial_format     (serial_object *obj, int data_bits, SerialParity parity, int stop_bits);
-
-void serial_irq_handler(serial_object *obj, uart_irq_handler handler, uint32_t id);
-void serial_irq_set    (serial_object *obj, SerialIrq irq, uint32_t enable);
-
-int  serial_getc       (serial_object *obj);
-void serial_putc       (serial_object *obj, int c);
-int  serial_readable   (serial_object *obj);
-int  serial_writable   (serial_object *obj);
-void serial_clear      (serial_object *obj);
-
-void serial_pinout_tx(PinName tx);
-
-#ifdef __cplusplus
-}
-#endif 
-
-#endif
-
-#endif
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef MBED_SERIAL_API_H
+#define MBED_SERIAL_API_H
+
+#include "device.h"
+
+#if DEVICE_SERIAL
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum {
+    ParityNone = 0,
+    ParityOdd = 1,
+    ParityEven = 2,
+    ParityForced1 = 3,
+    ParityForced0 = 4
+} SerialParity;
+
+typedef enum {
+    RxIrq,
+    TxIrq
+} SerialIrq;
+
+typedef void (*uart_irq_handler)(uint32_t id, SerialIrq event);
+
+typedef struct serial_s serial_t;
+
+void serial_init       (serial_t *obj, PinName tx, PinName rx);
+void serial_free       (serial_t *obj);
+void serial_baud       (serial_t *obj, int baudrate);
+void serial_format     (serial_t *obj, int data_bits, SerialParity parity, int stop_bits);
+
+void serial_irq_handler(serial_t *obj, uart_irq_handler handler, uint32_t id);
+void serial_irq_set    (serial_t *obj, SerialIrq irq, uint32_t enable);
+
+int  serial_getc       (serial_t *obj);
+void serial_putc       (serial_t *obj, int c);
+int  serial_readable   (serial_t *obj);
+int  serial_writable   (serial_t *obj);
+void serial_clear      (serial_t *obj);
+
+void serial_pinout_tx(PinName tx);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+#endif
--- a/sleep_api.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/sleep_api.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,52 +1,64 @@
-/* mbed Microcontroller Library - sleep_api
- * Copyright (c) 2009-2011 ARM Limited. All rights reserved.
- */
-#ifndef MBED_SLEEP_API_H
-#define MBED_SLEEP_API_H
-
-#include "device.h"
-
-#if DEVICE_SLEEP
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** Send the microcontroller to sleep
- * 
- * The processor is setup ready for sleep, and sent to sleep using __WFI(). In this mode, the
- * system clock to the core is stopped until a reset or an interrupt occurs. This eliminates 
- * dynamic power used by the processor, memory systems and buses. The processor, peripheral and 
- * memory state are maintained, and the peripherals continue to work and can generate interrupts.
- * 
- * The processor can be woken up by any internal peripheral interrupt or external pin interrupt.
- * 
- * @note
- *  The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored. 
- * Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be
- * able to access the LocalFileSystem
- */
-void sleep(void);
-
-/** Send the microcontroller to deep sleep
- * 
- * This processor is setup ready for deep sleep, and sent to sleep using __WFI(). This mode
- * has the same sleep features as sleep plus it powers down peripherals and clocks. All state
- * is still maintained. 
- * 
- * The processor can only be woken up by an external interrupt on a pin or a watchdog timer.
- * 
- * @note
- *  The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored. 
- * Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be
- * able to access the LocalFileSystem
- */
-void deepsleep(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-#endif
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef MBED_SLEEP_API_H
+#define MBED_SLEEP_API_H
+
+#include "device.h"
+
+#if DEVICE_SLEEP
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Send the microcontroller to sleep
+ *
+ * The processor is setup ready for sleep, and sent to sleep using __WFI(). In this mode, the
+ * system clock to the core is stopped until a reset or an interrupt occurs. This eliminates
+ * dynamic power used by the processor, memory systems and buses. The processor, peripheral and
+ * memory state are maintained, and the peripherals continue to work and can generate interrupts.
+ *
+ * The processor can be woken up by any internal peripheral interrupt or external pin interrupt.
+ *
+ * @note
+ *  The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored.
+ * Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be
+ * able to access the LocalFileSystem
+ */
+void sleep(void);
+
+/** Send the microcontroller to deep sleep
+ *
+ * This processor is setup ready for deep sleep, and sent to sleep using __WFI(). This mode
+ * has the same sleep features as sleep plus it powers down peripherals and clocks. All state
+ * is still maintained.
+ *
+ * The processor can only be woken up by an external interrupt on a pin or a watchdog timer.
+ *
+ * @note
+ *  The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored.
+ * Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be
+ * able to access the LocalFileSystem
+ */
+void deepsleep(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+#endif
--- a/spi_api.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/spi_api.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,7 +1,18 @@
-/* mbed Microcontroller Library - spi_api
- * Copyright (c) 2009-2011 ARM Limited. All rights reserved.
- */ 
- 
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 #ifndef MBED_SPI_API_H
 #define MBED_SPI_API_H
 
@@ -11,22 +22,23 @@
 
 #ifdef __cplusplus
 extern "C" {
-#endif 
+#endif
 
-SPIName spi_init(PinName mosi, PinName miso, PinName sclk, PinName ssel);
-void spi_free(SPIName spi);
+typedef struct spi_s spi_t;
 
-void spi_format(SPIName spi, int bits, int mode, int slave);
-void spi_frequency(SPIName spi, int hz);
-int spi_master_write(SPIName spi, int value);
-int spi_slave_receive(SPIName spi);
-int spi_slave_read(SPIName spi);
-void spi_slave_write(SPIName spi, int value);
-int spi_busy(SPIName spi);
+void spi_init         (spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel);
+void spi_free         (spi_t *obj);
+void spi_format       (spi_t *obj, int bits, int mode, int slave);
+void spi_frequency    (spi_t *obj, int hz);
+int  spi_master_write (spi_t *obj, int value);
+int  spi_slave_receive(spi_t *obj);
+int  spi_slave_read   (spi_t *obj);
+void spi_slave_write  (spi_t *obj, int value);
+int  spi_busy         (spi_t *obj);
 
 #ifdef __cplusplus
 }
-#endif 
+#endif
 
 #endif
 
--- a/toolchain.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/toolchain.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,16 +1,35 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2009 ARM Limited. All rights reserved.
- */ 
-
-#ifndef MBED_TOOLCHAIN_H
-#define MBED_TOOLCHAIN_H
-
-#if defined(TOOLCHAIN_ARM) || defined(TOOLCHAIN_uARM)
-#include <rt_sys.h>
-#endif
-
-#ifndef FILEHANDLE
-typedef int FILEHANDLE;
-#endif
-
-#endif
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef MBED_TOOLCHAIN_H
+#define MBED_TOOLCHAIN_H
+
+#if defined(TOOLCHAIN_ARM) || defined(TOOLCHAIN_uARM)
+#include <rt_sys.h>
+#endif
+
+#ifndef FILEHANDLE
+typedef int FILEHANDLE;
+#endif
+
+#if defined (__ICCARM__)
+#   define WEAK     __weak
+#   define PACKED   __packed
+#else
+#   define WEAK     __attribute__((weak))
+#   define PACKED   __attribute__((packed))
+#endif
+
+#endif
--- a/us_ticker_api.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/us_ticker_api.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,5 +1,17 @@
-/* mbed Microcontroller Library - us_ticker_api
- * Copyright (c) 2009 ARM Limited. All rights reserved.
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 #ifndef MBED_US_TICKER_API_H
 #define MBED_US_TICKER_API_H
@@ -19,10 +31,10 @@
     uint32_t timestamp;
     uint32_t id;
     struct ticker_event_s *next;
-} ticker_event;
+} ticker_event_t;
 
-void us_ticker_insert_event(ticker_event *obj, unsigned int timestamp, uint32_t id);
-void us_ticker_remove_event(ticker_event *obj);
+void us_ticker_insert_event(ticker_event_t *obj, unsigned int timestamp, uint32_t id);
+void us_ticker_remove_event(ticker_event_t *obj);
 
 #ifdef __cplusplus
 }
--- a/wait_api.h	Fri Nov 09 11:33:53 2012 +0000
+++ b/wait_api.h	Mon Feb 18 09:41:56 2013 +0000
@@ -1,3 +1,25 @@
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef MBED_WAIT_API_H
+#define MBED_WAIT_API_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /** Generic wait functions.
  *
  * These provide simple NOP type wait capabilities.
@@ -18,17 +40,6 @@
  * }
  */
 
-/* mbed Microcontroller Library - wait_api
- * Copyright (c) 2009 ARM Limited. All rights reserved.
- */ 
- 
-#ifndef MBED_WAIT_API_H
-#define MBED_WAIT_API_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 /** Waits for a number of seconds, with microsecond resolution (within
  *  the accuracy of single precision floating point).
  *