mbed-src updated for BMD-200 evaluation board. Just pin numbers are updated.

Dependents:   mbed_blinky-bmd-200 bmd-200_accel_demo firstRig

Fork of mbed-src by mbed official

Replacement for the "mbed" or "mbed-src" library when using the BMD-200 Evaluation kit. This library only remaps the pin names (i.e. LED1 points to p0.01 instead of p0.18, etc) as used by the BMD-200 Evaluation board (select the nRF51822_mkit platform). All other code is untouched.

Revision:
15:4892fe388435
Parent:
13:0645d8841f51
Child:
36:ab3ee77451e7
--- a/common/Serial.cpp	Mon Aug 05 14:54:27 2013 +0000
+++ b/common/Serial.cpp	Wed Aug 07 16:43:59 2013 +0300
@@ -44,15 +44,32 @@
     return serial_writable(&_serial);
 }
 
-void Serial::attach(void (*fptr)(void), IrqType type) {
+pFunctionPointer_t Serial::attach(void (*fptr)(void), IrqType type) {
+    pFunctionPointer_t pf = NULL;
+    _irq[type].clear();
     if (fptr) {
-        _irq[type].attach(fptr);
+        pf = _irq[type].add(fptr);
         serial_irq_set(&_serial, (SerialIrq)type, 1);
     } else {
         serial_irq_set(&_serial, (SerialIrq)type, 0);
     }
+    return pf;
 }
 
+pFunctionPointer_t Serial::add_handler_helper(void (*fptr)(void), IrqType type, bool front) {
+    if (NULL == fptr)
+        return NULL;
+    pFunctionPointer_t pf = front ? _irq[type].add_front(fptr) : _irq[type].add(fptr);
+    serial_irq_set(&_serial, (SerialIrq)type, 1);
+    return pf;
+}
+
+bool Serial::remove_handler(pFunctionPointer_t pf, IrqType type) {
+    bool res = _irq[type].remove(pf);
+    if (res && _irq[type].size() == 0)
+        serial_irq_set(&_serial, (SerialIrq)type, 0);
+    return res;
+}
 
 void Serial::_irq_handler(uint32_t id, SerialIrq irq_type) {
     Serial *handler = (Serial*)id;