mbed.org local branch of microbit-dal. The real version lives in git at https://github.com/lancaster-university/microbit-dal

Dependencies:   BLE_API nRF51822 mbed-dev-bin

Dependents:   microbit Microbit IoTChallenge1 microbit ... more

Revision:
37:b624ae5e94a5
Parent:
36:6837feb07da4
Child:
45:23b71960fe6c
--- a/inc/drivers/MicroBitPin.h	Wed Jul 13 12:18:15 2016 +0100
+++ b/inc/drivers/MicroBitPin.h	Wed Jul 13 12:18:16 2016 +0100
@@ -35,8 +35,7 @@
 #define IO_STATUS_ANALOG_IN                 0x04        // Pin is Analog in
 #define IO_STATUS_ANALOG_OUT                0x08        // Pin is Analog out
 #define IO_STATUS_TOUCH_IN                  0x10        // Pin is a makey-makey style touch sensor
-#define IO_STATUS_EVENT_ON_EDGE             0x20        // Pin will generate events on pin change
-#define IO_STATUS_EVENT_PULSE_ON_EDGE       0x40        // Pin will generate events on pin change
+#define IO_STATUS_EVENTBUS_ENABLED          0x80        // Pin is will generate events on change
 
 //#defines for each edge connector pin
 #define MICROBIT_PIN_P0                     P0_3        //P0 is the left most pad (ANALOG/DIGITAL) used to be P0_3 on green board
@@ -65,15 +64,6 @@
 #define MICROBIT_PIN_DEFAULT_SERVO_RANGE    2000
 #define MICROBIT_PIN_DEFAULT_SERVO_CENTER   1500
 
-#define MICROBIT_PIN_EVENT_NONE             0
-#define MICROBIT_PIN_EVENT_ON_EDGE          1
-#define MICROBIT_PIN_EVENT_ON_PULSE         2
-#define MICROBIT_PIN_EVENT_ON_TOUCH         3
-
-#define MICROBIT_PIN_EVT_RISE               2
-#define MICROBIT_PIN_EVT_FALL               3
-#define MICROBIT_PIN_EVT_PULSE_HI           4
-#define MICROBIT_PIN_EVT_PULSE_LO           5
 
 /**
   * Pin capabilities enum.
@@ -113,43 +103,6 @@
       */
     int obtainAnalogChannel();
 
-    /**
-      * Interrupt handler for when an rise interrupt is triggered.
-      */
-    void onRise();
-
-    /**
-      * Interrupt handler for when an fall interrupt is triggered.
-      */
-    void onFall();
-
-    /**
-      * This member function manages the calculation of the timestamp of a pulse detected
-      * on a pin whilst in IO_STATUS_EVENT_PULSE_ON_EDGE or IO_STATUS_EVENT_ON_EDGE modes.
-      *
-      * @param eventValue the event value to distribute onto the message bus.
-      */
-    void pulseWidthEvent(int eventValue);
-
-    /**
-      * This member function will construct an TimedInterruptIn instance, and configure
-      * interrupts for rise and fall.
-      *
-      * @param eventType the specific mode used in interrupt context to determine how an
-      *                  edge/rise is processed.
-      *
-      * @return MICROBIT_OK on success
-      */
-    int enableRiseFallEvents(int eventType);
-
-    /**
-      * If this pin is in a mode where the pin is generating events, it will destruct
-      * the current instance attached to this MicroBitPin instance.
-      *
-      * @return MICROBIT_OK on success.
-      */
-    int disableEvents();
-
     public:
 
     // mbed PinName of this pin.
@@ -190,9 +143,8 @@
     /**
       * Configures this IO pin as a digital input (if necessary) and tests its current value.
       *
-      *
       * @return 1 if this input is high, 0 if input is LO, or MICROBIT_NOT_SUPPORTED
-      *         if the given pin does not have digital capability.
+      *         if the given pin does not have analog capability.
       *
       * @code
       * MicroBitPin P0(MICROBIT_ID_IO_P0, MICROBIT_PIN_P0, PIN_CAPABILITY_BOTH);
@@ -340,47 +292,6 @@
       *         given pin is not configured as an analog output.
       */
     int getAnalogPeriod();
-
-    /**
-      * Configures the pull of this pin.
-      *
-      * @param pull one of the mbed pull configurations: PullUp, PullDown, PullNone, OpenDrain
-      *
-      * @return MICROBIT_NOT_SUPPORTED if the current pin configuration is anything other
-      *         than a digital input, otherwise MICROBIT_OK.
-      */
-    int setPull(PinMode pull);
-
-    /**
-      * Configures the events generated by this MicroBitPin instance.
-      *
-      * MICROBIT_PIN_EVENT_ON_EDGE - Configures this pin to a digital input, and generates events whenever a rise/fall is detected on this pin. (MICROBIT_PIN_EVT_RISE, MICROBIT_PIN_EVT_FALL)
-      * MICROBIT_PIN_EVENT_ON_PULSE - Configures this pin to a digital input, and generates events where the timestamp is the duration that this pin was either HI or LO. (MICROBIT_PIN_EVT_PULSE_HI, MICROBIT_PIN_EVT_PULSE_LO)
-      * MICROBIT_PIN_EVENT_ON_TOUCH - Configures this pin as a makey makey style touch sensor, in the form of a MicroBitButton. Normal button events will be generated using the ID of this pin.
-      * MICROBIT_PIN_EVENT_NONE - Disables events for this pin.
-      *
-      * @param eventType One of: MICROBIT_PIN_EVENT_ON_EDGE, MICROBIT_PIN_EVENT_ON_PULSE, MICROBIT_PIN_EVENT_ON_TOUCH, MICROBIT_PIN_EVENT_NONE
-      *
-      * @code
-      * MicroBitMessageBus bus;
-      *
-      * MicroBitPin P0(MICROBIT_ID_IO_P0, MICROBIT_PIN_P0, PIN_CAPABILITY_BOTH);
-      * P0.eventOn(MICROBIT_PIN_EVENT_ON_PULSE);
-      *
-      * void onPulse(MicroBitEvent evt)
-      * {
-      *     int duration = evt.timestamp;
-      * }
-      *
-      * bus.listen(MICROBIT_ID_IO_P0, MICROBIT_PIN_EVT_PULSE_HI, onPulse, MESSAGE_BUS_LISTENER_IMMEDIATE)
-      * @endcode
-      *
-      * @return MICROBIT_OK on success, or MICROBIT_INVALID_PARAMETER if the given eventype does not match
-      *
-      * @note In the MICROBIT_PIN_EVENT_ON_PULSE mode, the smallest pulse that was reliably detected was 85us, around 5khz. If more precision is required,
-      *       please use the InterruptIn class supplied by ARM mbed.
-      */
-    int eventOn(int eventType);
 };
 
 #endif
\ No newline at end of file