License#

Copyright 2018 Silicon Laboratories Inc. www.silabs.com

SPDX-License-Identifier: Zlib

The licensor of this software is Silicon Laboratories Inc.

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.

  2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

  3. This notice may not be removed or altered from any source distribution.

/***************************************************************************/
#if defined(EZSP_HOST)
  #define EMBER_NO_IDLE_SUPPORT
#endif

/*
 *
 * This was originally part of the group documentation, but it was removed,
 * since it's not important for Connect platforms. It is kept as it might become
 * important later when support for new platforms is added.
 *
 * The base time units for events are ticks.  Each tick is approximately equal
 * to a millisecond, but the true duration depends on the platform.  The
 * duration of a tick is 1000 / ::MILLISECOND_TICKS_PER_SECOND, where 1000 is
 * the number of milliseconds per second and ::MILLISECOND_TICKS_PER_SECOND is
 * the platform-specific number of ticks per second.  For example,
 * ::MILLISECOND_TICKS_PER_SECOND on the EM357 SoC is 1024, so each tick is
 * 1000 / 1024 = ~0.98 milliseconds.  Calling
 * ::emberEventControlSetDelayMS(someEvent, 100) on the EM357 SoC will schedule
 * the event for 100 ticks * (1000 milliseconds / 1024 ticks) =
 * ~97.7 milliseconds.  Note, however, that the accuracy of the base tick
 * depends on the timer source.  Furthermore, the scheduled delay is the minimum
 * delay. If ::emberRunEvents or ::emberRunTask are not called frequently
 * enough, the actual delay may be longer than the scheduled delay.
 *
 * Additionally, the APIs for quarter second and minute delays
 * (::emberEventControlSetDelayQS and ::emberEventControlSetDelayMinutes) use
 * "binary" units.  One quarter second is 256 ticks and one minute is 65536
 * ticks.  Calling ::emberEventControlSetDelayMinutes(someEvent, 3) on the
 * EM357 SoC will schedule the event for 3 minutes * (65536 ticks / minute) *
 * (1000 milliseconds / 1024 ticks) = ~3.2 minutes.  It is possible to avoid
 * these binary units by using ::emberEventControlSetDelayMS and the various
 * MILLISECOND_TICKS_PER_XXX multipliers.  For example, calling
 * ::emberEventControlSetDelayMS(someEvent, 3 * MILLISECOND_TICKS_PER_MINUTE)
 * will delay for 3 minutes on any platform.  Be aware of
 * ::EMBER_MAX_EVENT_CONTROL_DELAY_MS when using this approach.
 */

// Controlling events

// Possible event status values.  Having zero as the 'inactive' value
// causes events to initially be inactive.
//
#ifndef __EVENT_H__
#define __EVENT_H__


#define elapsedTimeInt8u(oldTime, newTime) \
  ((uint8_t) ((uint8_t)(newTime) - (uint8_t)(oldTime)))

#define elapsedTimeInt16u(oldTime, newTime) \
  ((uint16_t) ((uint16_t)(newTime) - (uint16_t)(oldTime)))

#define elapsedTimeInt32u(oldTime, newTime) \
  ((uint32_t) ((uint32_t)(newTime) - (uint32_t)(oldTime)))

#define MAX_INT8U_VALUE       (0xFF)
#define HALF_MAX_INT8U_VALUE  (0x80)
#define timeGTorEqualInt8u(t1, t2) \
  (elapsedTimeInt8u(t2, t1) <= (HALF_MAX_INT8U_VALUE))

#define MAX_INT16U_VALUE      (0xFFFF)
#define HALF_MAX_INT16U_VALUE (0x8000)
#define timeGTorEqualInt16u(t1, t2) \
  (elapsedTimeInt16u(t2, t1) <= (HALF_MAX_INT16U_VALUE))

#define MAX_INT32U_VALUE      (0xFFFFFFFFUL)
#define HALF_MAX_INT32U_VALUE (0x80000000UL)
#define timeGTorEqualInt32u(t1, t2) \
  (elapsedTimeInt32u(t2, t1) <= (HALF_MAX_INT32U_VALUE))

#define MILLISECOND_TICKS_PER_SECOND 1000UL

#ifndef MILLISECOND_TICKS_PER_DECISECOND
  #define MILLISECOND_TICKS_PER_DECISECOND (MILLISECOND_TICKS_PER_SECOND / 10)
#endif

#ifndef MILLISECOND_TICKS_PER_QUARTERSECOND
  #define MILLISECOND_TICKS_PER_QUARTERSECOND (MILLISECOND_TICKS_PER_SECOND >> 2)
#endif

#ifndef MILLISECOND_TICKS_PER_MINUTE
  #define MILLISECOND_TICKS_PER_MINUTE (60UL * MILLISECOND_TICKS_PER_SECOND)
#endif

#ifndef MILLISECOND_TICKS_PER_HOUR
  #define MILLISECOND_TICKS_PER_HOUR (60UL * MILLISECOND_TICKS_PER_MINUTE)
#endif

#ifndef MILLISECOND_TICKS_PER_DAY
  #define MILLISECOND_TICKS_PER_DAY (24UL * MILLISECOND_TICKS_PER_HOUR)
#endif

#define EMBER_TASK_COUNT (3)

#define emberEventControlSetInactive(control) \
  do { (control).status = EMBER_EVENT_INACTIVE; } while (0)

#define emberEventControlGetActive(control) \
  ((control).status != EMBER_EVENT_INACTIVE)

#define emberEventControlSetActive(control) \
  do { sli_event_control_set_active(&(control)); } while (0)

void sli_event_control_set_active(EmberEventControl *event);

#define EMBER_MAX_EVENT_CONTROL_DELAY_MS (HALF_MAX_INT32U_VALUE - 1)

#define emberEventControlSetDelayMS(control, delay) \
  do { emEventControlSetDelayMS(&(control), (delay)); } while (0)

void emEventControlSetDelayMS(EmberEventControl*event, uint32_t delay);

#define EMBER_MAX_EVENT_CONTROL_DELAY_QS (EMBER_MAX_EVENT_CONTROL_DELAY_MS >> 8)

#define emberEventControlSetDelayQS(control, delay) \
  do { emEventControlSetDelayMS(&(control), (delay) << 8); } while (0)

#define EMBER_MAX_EVENT_CONTROL_DELAY_MINUTES (EMBER_MAX_EVENT_CONTROL_DELAY_MS >> 16)

#define emberEventControlSetDelayMinutes(control, delay) \
  do { emEventControlSetDelayMS(&(control), (delay) << 16); } while (0)

#define emberEventControlGetRemainingMS(control) \
  (emEventControlGetRemainingMS(&(control)))

uint32_t emEventControlGetRemainingMS(EmberEventControl *event);

// Running events

void emberRunEvents(EmberEventData *events);

void emberRunTask(EmberTaskId taskid);

uint32_t emberMsToNextEvent(EmberEventData *events, uint32_t maxMs);

uint32_t emberMsToNextEventExtended(EmberEventData *events, uint32_t maxMs, uint8_t* returnIndex);

uint32_t emberMsToNextStackEvent(void);

EmberTaskId emberTaskInit(EmberEventData *events);

bool emberMarkTaskIdle(EmberTaskId taskid);

#ifndef EMBER_NO_IDLE_SUPPORT
#define emberTaskEnableIdling(allow) \
  do { emTaskEnableIdling((allow)); } while (0)

void emTaskEnableIdling(bool allow);

#define emberMarkTaskActive(taskid) \
  do { emMarkTaskActive((taskid)); } while (0)

void emMarkTaskActive(EmberTaskId taskid);
#else
  #define emberTaskEnableIdling(allow)  do {} while (0)
  #define emberMarkTaskActive(taskid)   do {} while (0)
#endif // EMBER_NO_IDLE_SUPPORT

#endif // __EVENT_H__

Time Manipulation Macros#

#define
elapsedTimeInt8u (oldTime, newTime)

Returns the elapsed time between two 8 bit values. Result may not be valid if the time samples differ by more than 127.

#define
elapsedTimeInt16u (oldTime, newTime)

Returns the elapsed time between two 16 bit values. Result may not be valid if the time samples differ by more than 32767.

#define
elapsedTimeInt32u (oldTime, newTime)

Returns the elapsed time between two 32 bit values. Result may not be valid if the time samples differ by more than 2147483647.

#define

Returns true if t1 is greater than t2. Can only account for 1 wrap around of the variable before it is wrong.

#define

Returns the elapsed time between two 8 bit values. Result may not be valid if the time samples differ by more than 127.

#define

Returns the elapsed time between two 8 bit values. Result may not be valid if the time samples differ by more than 127.

#define

Returns true if t1 is greater than t2. Can only account for 1 wrap around of the variable before it is wrong.

#define

Returns the elapsed time between two 8 bit values. Result may not be valid if the time samples differ by more than 127.

#define

Returns the elapsed time between two 8 bit values. Result may not be valid if the time samples differ by more than 127.

#define
MAX_INT32U_VALUE (0xFFFFFFFFUL)

Returns true if t1 is greater than t2. Can only account for 1 wrap around of the variable before it is wrong.

#define
HALF_MAX_INT32U_VALUE (0x80000000UL)

Returns the elapsed time between two 8 bit values. Result may not be valid if the time samples differ by more than 127.

#define

Returns the elapsed time between two 8 bit values. Result may not be valid if the time samples differ by more than 127.

#define

Returns the elapsed time between two 8 bit values. Result may not be valid if the time samples differ by more than 127.

#define
MILLISECOND_TICKS_PER_DECISECOND (MILLISECOND_TICKS_PER_SECOND / 10)

Returns the elapsed time between two 8 bit values. Result may not be valid if the time samples differ by more than 127.

#define
MILLISECOND_TICKS_PER_QUARTERSECOND (MILLISECOND_TICKS_PER_SECOND >> 2)

Returns the elapsed time between two 8 bit values. Result may not be valid if the time samples differ by more than 127.

#define
MILLISECOND_TICKS_PER_MINUTE (60UL * MILLISECOND_TICKS_PER_SECOND)

Returns the elapsed time between two 8 bit values. Result may not be valid if the time samples differ by more than 127.

#define
MILLISECOND_TICKS_PER_HOUR (60UL * MILLISECOND_TICKS_PER_MINUTE)

Returns the elapsed time between two 8 bit values. Result may not be valid if the time samples differ by more than 127.

#define
MILLISECOND_TICKS_PER_DAY (24UL * MILLISECOND_TICKS_PER_HOUR)

Returns the elapsed time between two 8 bit values. Result may not be valid if the time samples differ by more than 127.

#define

The number of event tasks that can be used to schedule and run events. Connect stack requires one, while another is used for Application Framework events.

#define

Set EmberEventControl as inactive (no pending event).

#define

Check whether EmberEventControl is currently active. An event is considered active if it is set to run some time in the future (activated by emberEventControlSetActive(), emberEventControlSetDelayMS() or any other emberEventControlSetDelay* functions)

#define

Set EmberEventControl to run at the next available opportunity.

#define
EMBER_MAX_EVENT_CONTROL_DELAY_MS (HALF_MAX_INT32U_VALUE - 1)

The maximum delay that may be passed to emberEventControlSetDelayMS().

#define

Set EmberEventControl to run some milliseconds in the future.

#define
EMBER_MAX_EVENT_CONTROL_DELAY_QS (EMBER_MAX_EVENT_CONTROL_DELAY_MS >> 8)

The maximum delay that may be passed to emberEventControlSetDelayQS().

#define

Set EmberEventControl to run some quarter seconds in the future.

#define
EMBER_MAX_EVENT_CONTROL_DELAY_MINUTES (EMBER_MAX_EVENT_CONTROL_DELAY_MS >> 16)

The maximum delay that may be passed to emberEventControlSetDelayMinutes().

#define

Set EmberEventControl to run some minutes in the future.

#define

Check when the event is scheduled to run.

#define

Enable or disable idling.

#define

Calling it indicates that a task has something to do, so it should prevent the CPU from idling until emberMarkTaskIdle is next called on this task.

void
sli_event_control_set_active(EmberEventControl *event)

Set EmberEventControl to run at the next available opportunity.

void
emEventControlSetDelayMS(EmberEventControl *event, uint32_t delay)

Set EmberEventControl to run some milliseconds in the future.

uint32_t
emEventControlGetRemainingMS(EmberEventControl *event)

Check when the event is scheduled to run.

void
emberRunEvents(EmberEventData *events)

Start an event handler if anything is scheduled when this function is called.

void
emberRunTask(EmberTaskId taskid)

Start an event handler if there is anything scheduled at the moment this function is called.

uint32_t
emberMsToNextEvent(EmberEventData *events, uint32_t maxMs)

Check when the next event is scheduled to run.

uint32_t
emberMsToNextEventExtended(EmberEventData *events, uint32_t maxMs, uint8_t *returnIndex)

Check when the next event is scheduled to run.

uint32_t

Check when the next stack event is scheduled to run.

emberTaskInit(EmberEventData *events)

Initialize a task for managing events and processor idling state.

bool
emberMarkTaskIdle(EmberTaskId taskid)

Try to idle the CPU, unless any events in any tasks are pending.

void
emTaskEnableIdling(bool allow)

Enable or disable idling.

void
emMarkTaskActive(EmberTaskId taskid)

Calling it indicates that a task has something to do, so it should prevent the CPU from idling until emberMarkTaskIdle is next called on this task.

Macros#

#define

Time Manipulation Macros Documentation#

elapsedTimeInt8u#

#define elapsedTimeInt8u
Value:
(oldTime, newTime)

Returns the elapsed time between two 8 bit values. Result may not be valid if the time samples differ by more than 127.


Definition at line 190 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

elapsedTimeInt16u#

#define elapsedTimeInt16u
Value:
(oldTime, newTime)

Returns the elapsed time between two 16 bit values. Result may not be valid if the time samples differ by more than 32767.


Definition at line 197 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

elapsedTimeInt32u#

#define elapsedTimeInt32u
Value:
(oldTime, newTime)

Returns the elapsed time between two 32 bit values. Result may not be valid if the time samples differ by more than 2147483647.


Definition at line 204 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

MAX_INT8U_VALUE#

#define MAX_INT8U_VALUE
Value:
(0xFF)

Returns true if t1 is greater than t2. Can only account for 1 wrap around of the variable before it is wrong.


Definition at line 211 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

HALF_MAX_INT8U_VALUE#

#define HALF_MAX_INT8U_VALUE
Value:
(0x80)

Returns the elapsed time between two 8 bit values. Result may not be valid if the time samples differ by more than 127.


Definition at line 212 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

timeGTorEqualInt8u#

#define timeGTorEqualInt8u
Value:
(t1, t2)

Returns the elapsed time between two 8 bit values. Result may not be valid if the time samples differ by more than 127.


Definition at line 213 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

MAX_INT16U_VALUE#

#define MAX_INT16U_VALUE
Value:
(0xFFFF)

Returns true if t1 is greater than t2. Can only account for 1 wrap around of the variable before it is wrong.


Definition at line 220 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

HALF_MAX_INT16U_VALUE#

#define HALF_MAX_INT16U_VALUE
Value:
(0x8000)

Returns the elapsed time between two 8 bit values. Result may not be valid if the time samples differ by more than 127.


Definition at line 221 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

timeGTorEqualInt16u#

#define timeGTorEqualInt16u
Value:
(t1, t2)

Returns the elapsed time between two 8 bit values. Result may not be valid if the time samples differ by more than 127.


Definition at line 222 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

MAX_INT32U_VALUE#

#define MAX_INT32U_VALUE
Value:
(0xFFFFFFFFUL)

Returns true if t1 is greater than t2. Can only account for 1 wrap around of the variable before it is wrong.


Definition at line 229 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

HALF_MAX_INT32U_VALUE#

#define HALF_MAX_INT32U_VALUE
Value:
(0x80000000UL)

Returns the elapsed time between two 8 bit values. Result may not be valid if the time samples differ by more than 127.


Definition at line 230 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

timeGTorEqualInt32u#

#define timeGTorEqualInt32u
Value:
(t1, t2)

Returns the elapsed time between two 8 bit values. Result may not be valid if the time samples differ by more than 127.


Definition at line 231 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

MILLISECOND_TICKS_PER_SECOND#

#define MILLISECOND_TICKS_PER_SECOND
Value:
1000UL

Returns the elapsed time between two 8 bit values. Result may not be valid if the time samples differ by more than 127.


Definition at line 234 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

MILLISECOND_TICKS_PER_DECISECOND#

#define MILLISECOND_TICKS_PER_DECISECOND
Value:
(MILLISECOND_TICKS_PER_SECOND / 10)

Returns the elapsed time between two 8 bit values. Result may not be valid if the time samples differ by more than 127.


Definition at line 237 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

MILLISECOND_TICKS_PER_QUARTERSECOND#

#define MILLISECOND_TICKS_PER_QUARTERSECOND
Value:
(MILLISECOND_TICKS_PER_SECOND >> 2)

Returns the elapsed time between two 8 bit values. Result may not be valid if the time samples differ by more than 127.


Definition at line 241 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

MILLISECOND_TICKS_PER_MINUTE#

#define MILLISECOND_TICKS_PER_MINUTE
Value:
(60UL * MILLISECOND_TICKS_PER_SECOND)

Returns the elapsed time between two 8 bit values. Result may not be valid if the time samples differ by more than 127.


Definition at line 245 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

MILLISECOND_TICKS_PER_HOUR#

#define MILLISECOND_TICKS_PER_HOUR
Value:
(60UL * MILLISECOND_TICKS_PER_MINUTE)

Returns the elapsed time between two 8 bit values. Result may not be valid if the time samples differ by more than 127.


Definition at line 249 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

MILLISECOND_TICKS_PER_DAY#

#define MILLISECOND_TICKS_PER_DAY
Value:
(24UL * MILLISECOND_TICKS_PER_HOUR)

Returns the elapsed time between two 8 bit values. Result may not be valid if the time samples differ by more than 127.


Definition at line 253 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

EMBER_TASK_COUNT#

#define EMBER_TASK_COUNT
Value:
(3)

The number of event tasks that can be used to schedule and run events. Connect stack requires one, while another is used for Application Framework events.


Definition at line 261 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

emberEventControlSetInactive#

#define emberEventControlSetInactive
Value:
(control)

Set EmberEventControl as inactive (no pending event).


Definition at line 268 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

emberEventControlGetActive#

#define emberEventControlGetActive
Value:
(control)

Check whether EmberEventControl is currently active. An event is considered active if it is set to run some time in the future (activated by emberEventControlSetActive(), emberEventControlSetDelayMS() or any other emberEventControlSetDelay* functions)

Returns

  • Returns true if the event is active false otherwise


Definition at line 282 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

emberEventControlSetActive#

#define emberEventControlSetActive
Value:
(control)

Set EmberEventControl to run at the next available opportunity.


Definition at line 291 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

EMBER_MAX_EVENT_CONTROL_DELAY_MS#

#define EMBER_MAX_EVENT_CONTROL_DELAY_MS
Value:
(HALF_MAX_INT32U_VALUE - 1)

The maximum delay that may be passed to emberEventControlSetDelayMS().


Definition at line 305 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

emberEventControlSetDelayMS#

#define emberEventControlSetDelayMS
Value:
(control, delay)

Set EmberEventControl to run some milliseconds in the future.


Definition at line 314 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

EMBER_MAX_EVENT_CONTROL_DELAY_QS#

#define EMBER_MAX_EVENT_CONTROL_DELAY_QS
Value:
(EMBER_MAX_EVENT_CONTROL_DELAY_MS >> 8)

The maximum delay that may be passed to emberEventControlSetDelayQS().


Definition at line 330 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

emberEventControlSetDelayQS#

#define emberEventControlSetDelayQS
Value:
(control, delay)

Set EmberEventControl to run some quarter seconds in the future.

Warnings


Definition at line 341 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

EMBER_MAX_EVENT_CONTROL_DELAY_MINUTES#

#define EMBER_MAX_EVENT_CONTROL_DELAY_MINUTES
Value:
(EMBER_MAX_EVENT_CONTROL_DELAY_MS >> 16)

The maximum delay that may be passed to emberEventControlSetDelayMinutes().


Definition at line 347 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

emberEventControlSetDelayMinutes#

#define emberEventControlSetDelayMinutes
Value:
(control, delay)

Set EmberEventControl to run some minutes in the future.


Definition at line 356 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

emberEventControlGetRemainingMS#

#define emberEventControlGetRemainingMS
Value:
(control)

Check when the event is scheduled to run.

Returns

  • Returns the amount of milliseconds remaining before the event is scheduled to run. If the event is inactive, MAX_INT32U_VALUE is returned.


Definition at line 366 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

emberTaskEnableIdling#

#define emberTaskEnableIdling
Value:
(allow)

Enable or disable idling.


Definition at line 477 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

emberMarkTaskActive#

#define emberMarkTaskActive
Value:
(taskid)

Calling it indicates that a task has something to do, so it should prevent the CPU from idling until emberMarkTaskIdle is next called on this task.


Definition at line 492 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

sli_event_control_set_active#

void sli_event_control_set_active (EmberEventControl * event)

Set EmberEventControl to run at the next available opportunity.

Parameters
[in]event

Pointer to the control of the event to set active

Warnings


Definition at line 299 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

emEventControlSetDelayMS#

void emEventControlSetDelayMS (EmberEventControl * event, uint32_t delay)

Set EmberEventControl to run some milliseconds in the future.

Parameters
[in]event

Pointer to the control of the event to run.

[in]delay

The delay in milliseconds. Must be less than EMBER_MAX_EVENT_CONTROL_DELAY_MS

Warnings


Definition at line 325 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

emEventControlGetRemainingMS#

uint32_t emEventControlGetRemainingMS (EmberEventControl * event)

Check when the event is scheduled to run.

Parameters
[in]event

Pointer to the control of the event in question.

Returns

  • Return the amount of milliseconds remaining before the event is scheduled to run. If the event is inactive, MAX_INT32U_VALUE is returned.

Warnings


Definition at line 378 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

emberRunEvents#

void emberRunEvents (EmberEventData * events)

Start an event handler if anything is scheduled when this function is called.

Parameters
[in]events

Pointer to the array of events.

An application typically creates an array of events along with their handlers. This function should be called in the main loop to run those events. Warnings


Definition at line 392 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

emberRunTask#

void emberRunTask (EmberTaskId taskid)

Start an event handler if there is anything scheduled at the moment this function is called.

Parameters
N/Ataskid

If an application has initialized a task via emberTaskInit(), to run the events associated with that task, it should call emberRunTask() instead of emberRunEvents().

Warnings

  • This is normally handled by the main plugin.


Definition at line 405 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

emberMsToNextEvent#

uint32_t emberMsToNextEvent (EmberEventData * events, uint32_t maxMs)

Check when the next event is scheduled to run.

Parameters
[in]events

An array of events to check.

[in]maxMs

If no event is scheduled before maxMs, maxMs will be returned

Returns

  • Returns the number of milliseconds before the next event is scheduled to expire, or maxMs if no event is scheduled to expire within that time.

Note

  • If any events are modified within an interrupt, to guarantee the accuracy of this API, it must be called with interrupts disabled.

See Also


Definition at line 420 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

emberMsToNextEventExtended#

uint32_t emberMsToNextEventExtended (EmberEventData * events, uint32_t maxMs, uint8_t * returnIndex)

Check when the next event is scheduled to run.

Parameters
[in]events

An array of events to check.

[in]maxMs

If no event is scheduled before maxMs, maxMs will be returned

[out]returnIndex

If not NULL pointer was passed, the index of the next event will be returned here, or 0xFF if no event is scheduled before maxMs.

Returns

  • Returns the number of milliseconds before the next event is scheduled to expire, or maxMs if no event is scheduled to expire within that time.

Note

  • If any events are modified within an interrupt, to guarantee the accuracy of this API, it must be called with interrupts disabled.

See Also


Definition at line 438 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

emberMsToNextStackEvent#

uint32_t emberMsToNextStackEvent (void )

Check when the next stack event is scheduled to run.

Parameters
N/A

Returns

  • Returns the number of milliseconds before the next stack event is scheduled to run.


Definition at line 446 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

emberTaskInit#

EmberTaskId emberTaskInit (EmberEventData * events)

Initialize a task for managing events and processor idling state.

Parameters
[in]events

Pointer to the array of events to manage

Returns

  • Returns the EmberTaskId which represents the newly created task.

Note

  • After the task is created emberRunTask() should be called periodically.


Definition at line 456 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

emberMarkTaskIdle#

bool emberMarkTaskIdle (EmberTaskId taskid)

Try to idle the CPU, unless any events in any tasks are pending.

Parameters
[in]taskid

the task which should handle the idling.

Returns

  • Returns true if the processor was idled false if idling wasn't permitted because a task has something to do.

Note

  • This API should always be called with interrupts disabled. It will forcibly re-enable interrupts before returning.


Definition at line 468 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

emTaskEnableIdling#

void emTaskEnableIdling (bool allow)

Enable or disable idling.

Parameters
[in]allow

Setting it to true will enable, while setting it to false will disable idling.

Warnings


Definition at line 484 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

emMarkTaskActive#

void emMarkTaskActive (EmberTaskId taskid)

Calling it indicates that a task has something to do, so it should prevent the CPU from idling until emberMarkTaskIdle is next called on this task.

Parameters
[in]taskid

The task to mark active.

Warnings


Definition at line 499 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h

Macro Definition Documentation#

__EVENT_H__#

#define __EVENT_H__

Definition at line 179 of file /mnt/raid/workspaces/ws.tfWcRzYcf/overlay/gsdk/protocol/flex/stack/include/event.h