From 96d6da4e252b06dcfdc041e7df23e86161c33007 Mon Sep 17 00:00:00 2001 From: rihab kouki Date: Tue, 28 Jul 2020 11:24:49 +0100 Subject: Official ARM version: v5.6.0 --- docs/RTOS2/html/group__CMSIS__RTOS__TimerMgmt.html | 122 ++++++++++----------- 1 file changed, 61 insertions(+), 61 deletions(-) (limited to 'docs/RTOS2/html/group__CMSIS__RTOS__TimerMgmt.html') diff --git a/docs/RTOS2/html/group__CMSIS__RTOS__TimerMgmt.html b/docs/RTOS2/html/group__CMSIS__RTOS__TimerMgmt.html index 4ef2b0b..a425ce2 100644 --- a/docs/RTOS2/html/group__CMSIS__RTOS__TimerMgmt.html +++ b/docs/RTOS2/html/group__CMSIS__RTOS__TimerMgmt.html @@ -183,12 +183,12 @@ Behavior of a Periodic Timer
  • Define the timers:
    osTimerId_t one_shot_id, periodic_id;
  • Define callback functions:
    static void one_shot_Callback (void *argument) {
    -
    int32_t arg = (int32_t)argument; // cast back argument '0'
    -
    // do something, i.e. set thread/event flags
    +
    int32_t arg = (int32_t)argument; // cast back argument '0'
    +
    // do something, i.e. set thread/event flags
    }
    static void periodic_Callback (void *argument) {
    -
    int32_t arg = (int32_t)argument; // cast back argument '5'
    -
    // do something, i.e. set thread/event flags
    +
    int32_t arg = (int32_t)argument; // cast back argument '5'
    +
    // do something, i.e. set thread/event flags
    }
  • Instantiate and start the timers:
    // creates a one-shot timer:
    @@ -197,11 +197,11 @@ Behavior of a Periodic Timer
    // creates a periodic timer:
    periodic_id = osTimerNew(periodic_Callback, osTimerPeriodic, (void *)5, NULL); // (void*)5 is passed as an argument
    // to the callback function
    -
    osTimerStart(one_shot_id, 500);
    -
    osTimerStart(periodic_id, 1500);
    +
    osTimerStart(one_shot_id, 500U);
    +
    osTimerStart(periodic_id, 1500U);
    // start the one-shot timer again after it has triggered the first time:
    -
    osTimerStart(one_shot_id, 500);
    +
    osTimerStart(one_shot_id, 500U);
    // when timers are not needed any longer free the resources:
    osTimerDelete(one_shot_id);
    @@ -371,27 +371,27 @@ Returned by:

    Code Example

    #include "cmsis_os2.h"
    -
    void Timer1_Callback (void *arg); // prototypes for timer callback function
    -
    void Timer2_Callback (void *arg);
    +
    void Timer1_Callback (void *arg); // prototypes for timer callback function
    +
    void Timer2_Callback (void *arg); // prototypes for timer callback function
    -
    uint32_t exec1; // argument for the timer call back function
    -
    uint32_t exec2; // argument for the timer call back function
    +
    uint32_t exec1; // argument for the timer call back function
    +
    uint32_t exec2; // argument for the timer call back function
    void TimerCreate_example (void) {
    -
    osTimerId_t id1; // timer id
    -
    osTimerId_t id2; // timer id
    +
    osTimerId_t id1; // timer id
    +
    osTimerId_t id2; // timer id
    // Create one-shoot timer
    -
    exec1 = 1;
    -
    id1 = osTimerNew (Timer1_Callback, osTimerOnce, &exec1, NULL);
    -
    if (id1 != NULL) {
    +
    exec1 = 1U;
    +
    id1 = osTimerNew(Timer1_Callback, osTimerOnce, &exec1, NULL);
    +
    if (id1 != NULL) {
    // One-shoot timer created
    }
    // Create periodic timer
    -
    exec2 = 2;
    -
    id2 = osTimerNew (Timer2_Callback, osTimerPeriodic, &exec2, NULL);
    -
    if (id2 != NULL) {
    +
    exec2 = 2U;
    +
    id2 = osTimerNew(Timer2_Callback, osTimerPeriodic, &exec2, NULL);
    +
    if (id2 != NULL) {
    // Periodic timer created
    }
    :
    @@ -461,33 +461,33 @@ Returned by:

  • osOK: the specified timer has been started or restarted.
  • osErrorISR: osTimerStart cannot be called from interrupt service routines.
  • osErrorParameter: parameter timer_id is either NULL or invalid or ticks is incorrect.
  • -
  • osErrorResource: the timer specified by parameter timer_id is in an invalid timer state.
  • +
  • osErrorResource: the timer is in an invalid state.
  • Note
    This function cannot be called from Interrupt Service Routines.

    Code Example

    #include "cmsis_os2.h"
    -
    -
    void Timer_Callback (void *arg) { // timer callback function
    -
    // arg contains &exec
    -
    // called every second after osTimerStart
    -
    }
    -
    uint32_t exec; // argument for the timer call back function
    +
    void Timer_Callback (void *arg) { // timer callback function
    +
    // arg contains &exec
    +
    // called every second after osTimerStart
    +
    }
    +
    +
    uint32_t exec; // argument for the timer call back function
    -
    void TimerStart_example (void) {
    -
    osTimerId_t id; // timer id
    -
    uint32_t timerDelay; // timer value
    -
    osStatus_t status; // function return status
    +
    void TimerStart_example (void) {
    +
    osTimerId_t id; // timer id
    +
    uint32_t timerDelay; // timer value
    +
    osStatus_t status; // function return status
    // Create periodic timer
    -
    exec = 1;
    -
    id = osTimerNew (Timer_Callback, osTimerPeriodic, &exec, NULL);
    -
    if (id) {
    -
    timerDelay = 1000;
    -
    status = osTimerStart (id, timerDelay); // start timer
    -
    if (status != osOK) {
    +
    exec = 1U;
    +
    id = osTimerNew(Timer_Callback, osTimerPeriodic, &exec, NULL);
    +
    if (id != NULL) {
    +
    timerDelay = 1000U;
    +
    status = osTimerStart(id, timerDelay); // start timer
    +
    if (status != osOK) {
    // Timer could not be started
    -
    }
    +
    }
    }
    ;
    }
    @@ -520,31 +520,31 @@ Returned by:

  • osOK: the specified timer has been stopped.
  • osErrorISR: osTimerStop cannot be called from interrupt service routines.
  • osErrorParameter: parameter timer_id is either NULL or invalid.
  • -
  • osErrorResource: the timer specified by parameter timer_id is not running (you can only stop a running timer).
  • +
  • osErrorResource: the timer is not running (you can only stop a running timer).
  • Note
    This function cannot be called from Interrupt Service Routines.

    Code Example

    #include "cmsis_os2.h"
    -
    void Timer_Callback (void *arg); // prototype for timer callback function
    +
    void Timer_Callback (void *arg); // prototype for timer callback function
    +
    +
    uint32_t exec; // argument for the timer call back function
    -
    uint32_t exec; // argument for the timer call back function
    -
    void TimerStop_example (void) {
    -
    osTimerId_t id; // timer id
    -
    osStatus_t status; // function return status
    +
    osTimerId_t id; // timer id
    +
    osStatus_t status; // function return status
    // Create periodic timer
    -
    exec = 1;
    -
    id = osTimerNew (Timer_Callback, osTimerPeriodic, &exec, NULL);
    -
    osTimerStart (id, 1000); // start timer
    +
    exec = 1U;
    +
    id = osTimerNew(Timer_Callback, osTimerPeriodic, &exec, NULL);
    +
    osTimerStart(id, 1000U); // start timer
    :
    -
    status = osTimerStop (id); // stop timer
    +
    status = osTimerStop(id); // stop timer
    if (status != osOK) {
    // Timer could not be stopped
    -
    }
    +
    }
    ;
    -
    osTimerStart (id, 1000); // start timer again
    +
    osTimerStart(id, 1000U); // start timer again
    ;
    }
    @@ -601,26 +601,26 @@ Returned by:

  • osOK: the specified timer has been deleted.
  • osErrorISR: osTimerDelete cannot be called from interrupt service routines.
  • osErrorParameter: parameter timer_id is either NULL or invalid.
  • -
  • osErrorResource: the timer specified by parameter timer_id is in an invalid timer state.
  • +
  • osErrorResource: the timer is in an invalid state.
  • Note
    This function cannot be called from Interrupt Service Routines.

    Code Example

    #include "cmsis_os2.h"
    -
    -
    void Timer_Callback (void *arg); // prototype for timer callback function
    -
    uint32_t exec; // argument for the timer call back function
    -
    +
    void Timer_Callback (void *arg); // prototype for timer callback function
    +
    +
    uint32_t exec; // argument for the timer call back function
    +
    void TimerDelete_example (void) {
    -
    osTimerId_t id; // timer id
    -
    osStatus_t status; // function return status
    +
    osTimerId_t id; // timer id
    +
    osStatus_t status; // function return status
    // Create periodic timer
    -
    exec = 1;
    -
    id = osTimerNew (Timer_Callback, osTimerPeriodic, &exec, NULL);
    -
    osTimerStart (id, 1000UL); // start timer
    +
    exec = 1U;
    +
    id = osTimerNew(Timer_Callback, osTimerPeriodic, &exec, NULL);
    +
    osTimerStart(id, 1000U); // start timer
    ;
    -
    status = osTimerDelete (id); // stop and delete timer
    +
    status = osTimerDelete(id); // stop and delete timer
    if (status != osOK) {
    // Timer could not be deleted
    }
    @@ -634,7 +634,7 @@ Returned by: