[FreeRTOS] Summary of common functions

  1. xTaskCreate()

    • usage:
    xTaskCreate(taskFunction, taskName, stackSize, parameters, priority, taskHandle)
    
    • parameter:
      • taskFunction: Task function, that is, the entry function of the task.
      • taskName: The name of the task.
      • stackSize: The size of the task stack.
      • parameters: The parameter passed to the task function.
      • priority: The priority of the task.
      • taskHandle: Task handle, used to refer to the created task.
    • Return value: Return if the task is created successfully, pdPASSotherwise return errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY.
  2. vTaskDelay()

    • usage:
vTaskDelay(delay)
  • parameter:
    • delay: Delay time, in ticks of the system clock.
  • Return value: None.
  1. xQueueCreate():

    • Usage: xQueueCreate(queueLength, itemSize)
    • parameter:
      • queueLength: The length of the queue, that is, the number of elements that can be stored.
      • itemSize: The size of each queue element.
    • Return value: If the queue is successfully created, a handle to the queue is returned, otherwise NULL is returned.
  2. xQueueSend()

    • usage:
xQueueSend(queueHandle, item, waitTime)
  • parameter:
    • queueHandle: The handle to the queue.
    • item: The data to send.
    • waitTime: The time to wait for the queue to be available, in ticks of the system clock.
  • Return value: Return if the data was successfully sent to the queue, pdPASSotherwise return errQUEUE_FULL.
  1. xQueueReceive()
    • usage:
xQueueReceive(queueHandle, buffer, waitTime)
  • parameter:
    • queueHandle: The handle to the queue.
    • buffer: Buffer for receiving data.
    • waitTime: The time to wait for the queue to be available, in ticks of the system clock.
  • Return value: Return if the data is successfully received, pdPASSotherwise return errQUEUE_EMPTY.
  1. xSemaphoreCreateBinary()
    • usage:
xSemaphoreCreateBinary()
  • Parameters: none
  • Return value: If the binary semaphore is created successfully, it returns a handle pointing to the semaphore, otherwise it returns NULL.
  1. xSemaphoreTake()
    • usage:
xSemaphoreTake(semaphoreHandle, waitTime)
  • parameter:
    • semaphoreHandle: Handle to the semaphore.
    • waitTime: The time to wait for the semaphore to be available, in ticks of the system clock.
  • Return value: Return if the semaphore is successfully obtained, otherwise pdPASSreturn errQUEUE_EMPTY.
  1. xSemaphoreGive()
    • usage:
xSemaphoreGive(semaphoreHandle)
  • parameter:
    • semaphoreHandle: Handle to the semaphore.
  • Return value: Return if the semaphore is successfully released, pdPASSotherwise return errQUEUE_FULL.
  1. xEventGroupCreate()
    • usage:
xEventGroupCreate()
  • Parameters: none
  • Return value: If the event group is created successfully, it returns a handle pointing to the event group, otherwise it returns NULL.
  1. xEventGroupSetBits()
    • usage:
xEventGroupSetBits(eventGroupHandle, eventBits)
  • parameter:
    • eventGroupHandle: Handle to the event group.
    • eventBits: The event bit to set.
  • Return value: The event bit that was set.
  1. xEventGroupWaitBits()
    • usage:
    xEventGroupWaitBits(eventGroupHandle, bitsToWaitFor, clearOnExit, waitForAllBits, waitTime)
    
    • parameter:
      • eventGroupHandle: Handle to the event group.
      • bitsToWaitFor: Waiting event bit.
      • clearOnExit: Whether to clear the event bit when exiting the wait.
      • waitForAllBits: Whether to wait for all event bits to be set.
      • waitTime: The time to wait for the event bit to be set, in ticks of the system clock.
    • Return value: The event bit that was set.

Guess you like

Origin blog.csdn.net/Goforyouqp/article/details/132548389