Programmable Clock with RTOS 0.0.1
Implementaiton of a programmable clock using RTOS with STM32GO microcontroller.
Loading...
Searching...
No Matches
main.c File Reference

Enabling of queues and tasks with static memory. Develop the heart beat task. More...

#include "bsp.h"
#include "app_serial.h"
#include "app_clock.h"
#include "app_display.h"

Macros

#define TASK_STACK_SIZE   128u
 Save the buffer dimentions.
 
#define QUEUE_LENGTH_SERIAL   9
 
#define ITEM_SIZE_SERIAL   sizeof( NEW_MsgTypeDef )
 
#define QUEUE_LENGTH_CLOCK   45
 
#define ITEM_SIZE_CLOCK   sizeof( APP_MsgTypeDef )
 
#define QUEUE_LENGTH_DISPLAY   90
 
#define ITEM_SIZE_DISPLAY   sizeof( APP_MsgTypeDef )
 
#define HEARTBEAT_PERIODICITY   300u
 
#define TIMER_HEART_ID   (void *)(uint32_t)2
 
#define SERIAL_PERIODICITY   (void *)(uint32_t)10
 
#define CLOCK_PERIODICITY   (void *)(uint32_t)50
 
#define DISPLAY_PERIODICITY   (void *)(uint32_t)100
 
#define SERIAL_PRIORITY   3u
 
#define CLOCK_PRIORITY   2u
 
#define DISPLAY_PRIORITY   1u
 

Functions

static void Task_10ms (void *parameters)
 Task 10ms Developing serial event machine tasks every 10 ms.
 
static void Task_50ms (void *parameters)
 Task 50ms Developing clock event machine tasks every 50 ms.
 
static void Task_100ms (void *parameters)
 Task 100ms Developing display event machine tasks every 100 ms.
 
static void heart_Init (void)
 Init the port C(LEDS). Inicialization of leds, Led0.
 
static void heart_beat (void)
 Heart beat GPIO_PIN_0 ON, when the time is equal or greater that 300ms.
 
static void vTimerCallback (TimerHandle_t pxTimer)
 Call back timer.
 
int main (void)
 The initial function, code development. Initializing the task of each event machine (serial, clock and display) and initializing the queues with static memory.
 
void vApplicationGetIdleTaskMemory (StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize)
 configSUPPORT_STATIC_ALLOCATION Function to add necessary quantity of static memory for each task.
 
void vApplicationGetTimerTaskMemory (StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize)
 vApplicationGetTimerTaskMemory Provide the memory that is used by the Timer service task.
 

Variables

QueueHandle_t serialQueue
 Serial Queue identifier to use in the serial machine.
 
QueueHandle_t clockQueue
 Serial Queue identifier to use in the clock machine.
 
QueueHandle_t displayQueue
 Serial Queue identifier to use in the display machine.
 

Detailed Description

Enabling of queues and tasks with static memory. Develop the heart beat task.

Function Documentation

◆ main()

int main ( void )

The initial function, code development. Initializing the task of each event machine (serial, clock and display) and initializing the queues with static memory.

Return values
Returnsan integer

< Maximum number of items

< The size, in bytes, required to hold each item in the queue.

< Maximum number of items

< The size, in bytes, required to hold each item in the queue.

< Maximum number of items

< The size, in bytes, required to hold each item in the queue.

< Maximum number of items

< The size, in bytes, required to hold each item in the queue.

< Maximum number of items

< The size, in bytes, required to hold each item in the queue.

< Maximum number of items

< The size, in bytes, required to hold each item in the queue.

< Serial's task periodicity

< Serial's task priority

< Clock's task periodicity

< Clock's task priority

< Display's task periodicity

< Display's task priority

< Periodicity of heart beat task

< ID for timer used to HEART BEAT

◆ Task_100ms()

static void Task_100ms ( void * parameters)
static

Task 100ms Developing display event machine tasks every 100 ms.

Parameters
[in]parametersPeriodicity value.

◆ Task_10ms()

static void Task_10ms ( void * parameters)
static

Task 10ms Developing serial event machine tasks every 10 ms.

Parameters
[in]parametersPeriodicity value.

◆ Task_50ms()

static void Task_50ms ( void * parameters)
static

Task 50ms Developing clock event machine tasks every 50 ms.

Parameters
[in]parametersPeriodicity value.

◆ vApplicationGetIdleTaskMemory()

void vApplicationGetIdleTaskMemory ( StaticTask_t ** ppxIdleTaskTCBBuffer,
StackType_t ** ppxIdleTaskStackBuffer,
uint32_t * pulIdleTaskStackSize )

configSUPPORT_STATIC_ALLOCATION Function to add necessary quantity of static memory for each task.

Parameters
[in]ppxIdleTaskTCBBufferPass out a pointer to the StaticTask_t structure.
[in]ppxIdleTaskStackBufferPass out the array that will be used.
[in]pulIdleTaskStackSizePass out the size of the array.

◆ vApplicationGetTimerTaskMemory()

void vApplicationGetTimerTaskMemory ( StaticTask_t ** ppxTimerTaskTCBBuffer,
StackType_t ** ppxTimerTaskStackBuffer,
uint32_t * pulTimerTaskStackSize )

vApplicationGetTimerTaskMemory Provide the memory that is used by the Timer service task.

Parameters
[in]ppxTimerTaskTCBBufferPass out a pointer to the StaticTask_t structure.
[in]ppxTimerTaskStackBufferPass out the array that will be used.
[in]pulTimerTaskStackSizePass out the size of the array.

◆ vTimerCallback()

void vTimerCallback ( TimerHandle_t pxTimer)
static

Call back timer.

Parameters
[in]pxTimer