monoZ docs
MZ_timer_example.c File Reference

This is an example of how to use a timer and print in CLI using Application thread. More...

#include "MZ_sys_cmsis_os2.h"
#include "MZ_timer_example.h"
#include "MZ_timer.h"
#include "MZ_print.h"
#include "MZ_error_handler.h"

Go to the source code of this file.

Macros

#define START_AT_INIT   (0)
 Defines the AT Initialization. More...
 
#define START_AT_THREAD   (1)
 Defines the start AT thread. More...
 
#define TIMER_EXAMPLE   START_AT_THREAD
 
#define TIMER_APP_STACK_SIZE   (128)
 Defines the App stack size. More...
 

Functions

static void timer_cb (TimerHandle_t xTimer)
 timer callback function Unlock the lock when timer expires More...
 
static void timer_app (void *arg)
 create the timer and start when the starts if main RTOS scheduler started More...
 
mz_error_t timer_app_init (void)
 Initiate the Timer App and creates the thread for timer application. More...
 

Variables

static mz_thread_t timer_thread_id = NULL
 
static StaticTask_t timer_cb_mem
 
static StackType_t timer_stack [TIMER_APP_STACK_SIZE]
 
static mz_semaphore_t timer_sema_id = NULL
 

Detailed Description

This is an example of how to use a timer and print in CLI using Application thread.

Date
Apr 28, 2021
Author
MZ_click

Definition in file MZ_timer_example.c.

Macro Definition Documentation

◆ START_AT_INIT

#define START_AT_INIT   (0)

Defines the AT Initialization.

Definition at line 14 of file MZ_timer_example.c.

◆ START_AT_THREAD

#define START_AT_THREAD   (1)

Defines the start AT thread.

Definition at line 15 of file MZ_timer_example.c.

◆ TIMER_EXAMPLE

#define TIMER_EXAMPLE   START_AT_THREAD

Definition at line 17 of file MZ_timer_example.c.

◆ TIMER_APP_STACK_SIZE

#define TIMER_APP_STACK_SIZE   (128)

Defines the App stack size.

Definition at line 19 of file MZ_timer_example.c.

Function Documentation

◆ timer_cb()

void timer_cb ( TimerHandle_t  xTimer)
static

timer callback function Unlock the lock when timer expires

Parameters
xTimerTimerHandle_t

Definition at line 31 of file MZ_timer_example.c.

◆ timer_app()

void timer_app ( void *  arg)
static

create the timer and start when the starts if main RTOS scheduler started

Parameters
argvoid

Definition at line 43 of file MZ_timer_example.c.

◆ timer_app_init()

mz_error_t timer_app_init ( void  )

Initiate the Timer App and creates the thread for timer application.

Returns
_ret returns the status of app thread creation(MZ_OK/MZ_FAIL)
Note
semaphore is created for lock the process when multiple processes are in run status

Definition at line 79 of file MZ_timer_example.c.

Variable Documentation

◆ timer_thread_id

mz_thread_t timer_thread_id = NULL
static

Holds the thread id

Definition at line 21 of file MZ_timer_example.c.

◆ timer_cb_mem

StaticTask_t timer_cb_mem
static

Holds the callback memory

Definition at line 22 of file MZ_timer_example.c.

◆ timer_stack

StackType_t timer_stack[TIMER_APP_STACK_SIZE]
static

Definition at line 23 of file MZ_timer_example.c.

◆ timer_sema_id

mz_semaphore_t timer_sema_id = NULL
static

Holds the semaphore id

Definition at line 24 of file MZ_timer_example.c.