14.2.4.1.5 System Environment APIs

API functions of the System Environment component.

Functions
void SYS_SubscribeToEvent (SYS_EventId_t id, SYS_EventReceiver_t *recv)

Subscribe a receiver to an event. The same receiver may be subscribed to multiple events by calling this function several times.

void SYS_UnsubscribeFromEvent (SYS_EventId_t id, SYS_EventReceiver_t *recv)

Unsubscribe a receiver from an event.

void SYS_PostEvent (SYS_EventId_t id, SYS_EventData_t data)

Post an event to be delivered to all subscribed receivers.

bool SYS_IsEventDeliverable (SYS_EventId_t id)

Check if event have at least one subscriber.

bool SYS_IsEventSubscriber (SYS_EventId_t id, SYS_EventReceiver_t *recv)

Check if the specified receiver is subscribed to an event.

void SYS_ClearEvents (void)

Clear the events.

bool SYS_MutexLock (SYS_Mutex_t *const mutex, SYS_MutexOwner_t *const owner)

Makes the asynchronous request to lock the mutex.

bool SYS_MutexUnlock (SYS_Mutex_t *const mutex, SYS_MutexOwner_t *const owner)

Unlocks a mutex using synchronous request.

bool SYS_IsMutexLocked (SYS_Mutex_t *const mutex, SYS_MutexOwner_t *const owner)

Checks whether mutex is locked.

INLINE void SYS_PostTask (SYS_TaskId_t taskId)

Posts a task to the task manager, which is later processed by the task handler of the corresponding stack layer.

bool SYS_RunTask (void)

This function is called by the stack or from the main() function to process tasks.

SYS_InitStatus_t SYS_SysInit (void)

Initializes the microcontroller and the radio chip.

static uint16_t SYS_GetRandomNumber (void)

Generates a random two-bytes number.

uint16_t SYS_GetNormalizedRandomNumber (uint16_t upperLimit)

Generates a random two-bytes number normalized by given upper limit.

int SYS_GetRandomSequence (uint8_t *buffer, unsigned long size)

Generates a sequence of random numbers and copies them into the buffer.

INLINE uint16_t SYS_Crc16Ccitt (uint16_t initValue, uint8_t byte)

Calculates CRC using CRC-16-CCITT algorithm.