From a61f1ec25c2357d44208f577e12911fac4e3a7bc Mon Sep 17 00:00:00 2001 From: Galen Nickel Date: Mon, 17 Jul 2017 23:48:13 -0700 Subject: [PATCH] Add cards to 'Control' page to match editor. (#454) --- docs/reference/control.md | 6 +++++- libs/core/control.cpp | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/reference/control.md b/docs/reference/control.md index f546edc8..dc762e40 100644 --- a/docs/reference/control.md +++ b/docs/reference/control.md @@ -8,8 +8,12 @@ control.inBackground(() => { }); control.reset(); control.waitMicros(4); +control.onEvent(0, 0, () => { }); +control.raiseEvent(0, 0); +control.eventTimestamp(); +control.eventValue(); ``` ### See Also -[inBackground](/reference/control/in-background), [reset](/reference/control/reset), [wait-micros](/reference/control/wait-micros) +[inBackground](/reference/control/in-background), [reset](/reference/control/reset), [waitMicros](/reference/control/wait-micros), [onEvent](/reference/control/on-event), [raiseEvent](/reference/control/raise-event), [eventTimestamp](/reference/control/event-timestamp), [eventValue](/reference/control/event-value) diff --git a/libs/core/control.cpp b/libs/core/control.cpp index d7bc1939..87498723 100644 --- a/libs/core/control.cpp +++ b/libs/core/control.cpp @@ -245,6 +245,7 @@ namespace control { * @param mode optional definition of how the event should be processed after construction (default is CREATE_AND_FIRE). */ //% weight=21 blockGap=12 blockId="control_raise_event" block="raise event|from source %src=control_event_source_id|with value %value=control_event_value_id" blockExternalInputs=1 + //% help=control/raise-event //% mode.defl=CREATE_AND_FIRE void raiseEvent(int src, int value, EventCreationMode mode) { MicroBitEvent evt(src, value, (MicroBitEventLaunchMode)mode); @@ -254,6 +255,7 @@ namespace control { * Raises an event in the event bus. */ //% weight=20 blockGap=8 blockId="control_on_event" block="on event|from %src=control_event_source_id|with value %value=control_event_value_id" + //% help=control/on-event //% blockExternalInputs=1 void onEvent(int src, int value, Action handler) { registerWithDal(src, value, handler); @@ -263,6 +265,7 @@ namespace control { * Gets the value of the last event executed on the bus */ //% blockId=control_event_value" block="event value" + //% help=control/event-value //% weight=18 int eventValue() { return pxt::lastEvent.value; @@ -272,6 +275,7 @@ namespace control { * Gets the timestamp of the last event executed on the bus */ //% blockId=control_event_timestamp" block="event timestamp" + //% help=control/event-timestamp //% weight=19 blockGap=8 int eventTimestamp() { return pxt::lastEvent.timestamp;