|  | Dual Active Bridge Development Board (Part-No. ) |
Content |  |  |  |  |  |

Loading...
Searching...
No Matches
main_tasks.c
1
2//=======================================================================================================
3// @file main_tasks.c
4// @ingroup sched-layer
5// @brief Contains the application specific tasks that are called regularly by the os_scheduler
6// @details Contains the application specific tasks that are called regularly by the os_scheduler
7// two different timings priorities are available:
8// 1. 1ms Tasks called from the os_scheduler interrupt
9// the jitter that you will have in the 1ms realtime tasks called by the interrupt depends
10// on other interrupts that have a higher interrupt priority
11// 2. 1ms, 10ms, 100ms, 1s Tasks called from the main loop
12// these tasks are for soft realtime and not for hard realtime
13// so in average they are called with the required timing but the jitter can be very huge,
14// depending on the calls before.
15// use this for your non-timing critical application state machines
16//
17// @note you might consider to implement a watchdog and put the watchdog triggering into some Task
18//
19// @version v1.0
20// @date 2019-08-09
21// @author M52409
22//
23//=======================================================================================================
24
25#include <stdint.h>
26#include <stddef.h>
27#include <xc.h>
28
29#include "os/os_config.h"
30#include "os/os_sys_time.h"
31#include "os/os_scheduler.h"
32
33#include "comm/PBV_DAB_frame_map.h"
34#include "comm/PBV_interface.h"
35#include "device/dev_fan.h"
36#include "device/dev_led.h"
37#include "device/dev_temp.h"
38#include "device/dev_current_sensor.h"
39#include "pwrctrl/pwrctrl.h"
40#include "fault/fault.h"
41
42#include "system/pins.h"
43
44//=======================================================================================================
45//
46// put your application specific code in the following functions:
47// choose wisely between real-time and non-realtime!
48//
49// Interrupt Realtime Functions:
50// Tasks_Realtime_1ms : is called by the interrupt every ms - for time critical low jitter stuff
51//
52//
53// Mainloop Non-Realtime Functions:
54// Tasks_1ms : function is called by the main loop in average every 1ms
55// Tasks_10ms : function is called by the main loop in average every 10ms
56// Tasks_100ms : function is called by the main loop in average every 100ms
57// Tasks_1s : function is called by the main loop in average every second
58//
59// @note there could be some jitter here because it is not called directly by a timer interrupt
60// the timing in average is exact (keep in mind: in average), the jitter depends on the
61// called functions before
62//=======================================================================================================
63
64#if defined (OS_USE_SCHEDULER_100us) && (OS_USE_SCHEDULER_100us == true)
65//=======================================================================================================
70//=======================================================================================================
71/* The task functions would be written by the user who uses this scheduler in
72 the application. Hence 65 D is being excluded. */
73/* LDRA_EXCLUDE 65 D */
74void Tasks_Realtime_100us(void)
75{
76 // Execute the power control state machine
77 PwrCtrl_Execute();
78
79}
80#endif /* OS_USE_SCHEDULER_100us */
81//=======================================================================================================
86//=======================================================================================================
87/* The task functions would be written by the user who uses this scheduler in
88 the application. Hence 65 D is being excluded. */
89/* LDRA_EXCLUDE 65 D */
90 void Tasks_Realtime_1ms(void)
91{
92
93}
94
95#if defined (OS_USE_SCHEDULER_100us) && (OS_USE_SCHEDULER_100us == true)
96//=======================================================================================================
101//=======================================================================================================
102/* LDRA_EXCLUDE 65 D */
103void Tasks_100us(void)
104{
105 App_PBV_Task_100us();
106}
107#endif /* OS_USE_SCHEDULER_100us */
108//=======================================================================================================
113//=======================================================================================================
114/* LDRA_EXCLUDE 65 D */
115 void Tasks_1ms(void)
116{
117
118}
119
120//=======================================================================================================
125//=======================================================================================================
126/* LDRA_EXCLUDE 65 D */
127 void Tasks_10ms(void)
128{
129 App_PBV_Task_10ms();
130 App_PBV_DAB_Task_10ms();
131
132}
133
134extern uint16_t os_resetCause;
135//=======================================================================================================
140//=======================================================================================================
141 void Tasks_100ms(void)
142{
143 Dev_LED_Task_100ms();
144 Dev_Fan_Task_100ms();
145 Dev_Temp_Task_100ms();
146 Fault_Execute_100ms();
147}
148
149//=======================================================================================================
154//=======================================================================================================
155 void Tasks_1s(void)
156{
157 App_PBV_DAB_Task_1s();
158 Dev_Fan_Task_1s();
159}
160
161//=======================================================================================================
168//=======================================================================================================
169/* LDRA_EXCLUDE 65 D */
170 void Tasks_Background(void)
171{
172
173}
PBV_DAB_frame_map.h
app PBV DAB Frame map file Example
dev_current_sensor.h
Contains current sensor public functions.
dev_fan.h
fan device driver
dev_led.h
led device driver
dev_temp.h
Contains temperature initialization and execution functions.
fault.h
Contains public fault functions.
App_PBV_Task_100us
void App_PBV_Task_100us()
Task to be executed every 100 us.
Definition PBV_interface.c:244
App_PBV_Task_10ms
void App_PBV_Task_10ms()
task to be executed every 10ms
Definition PBV_interface.c:229
App_PBV_DAB_Task_10ms
void App_PBV_DAB_Task_10ms(void)
10ms PBV task to be execution
Definition PBV_dab_frame_map.c:121
App_PBV_DAB_Task_1s
void App_PBV_DAB_Task_1s(void)
1 second PBV task to be execution
Definition PBV_dab_frame_map.c:150
Dev_Fan_Task_100ms
void Dev_Fan_Task_100ms(void)
this function needs to be called every 100ms it contains the code to update the status of the fan
Definition dev_fan.c:76
Dev_Fan_Task_1s
void Dev_Fan_Task_1s(void)
This function needs to be called every 1s to keep the temperature of the board at a certain temperatu...
Definition dev_fan.c:110
Dev_LED_Task_100ms
void Dev_LED_Task_100ms()
This function needs to be called every 100ms and contains the code to update the status of the LEDs.
Definition dev_led.c:224
Dev_Temp_Task_100ms
void Dev_Temp_Task_100ms(void)
Executes the Temperature reading every 100ms.
Definition dev_temp.c:60
PwrCtrl_Execute
void PwrCtrl_Execute(void)
Executes the power control state machine.
Definition pwrctrl.c:88
Fault_Execute_100ms
void Fault_Execute_100ms(void)
Fault evaluation for Temperature and other slow fault detection executed every 100ms.
Definition fault.c:263
Tasks_10ms
void Tasks_10ms(void)
Tasks_10ms gets called every 10ms, put your things in it that need to be called regularly.
Definition main_tasks.c:127
Tasks_1ms
void Tasks_1ms(void)
Tasks_1ms gets called every millisecond, put your things in it that need to be called regularly.
Definition main_tasks.c:115
Tasks_Realtime_1ms
void Tasks_Realtime_1ms(void)
Tasks_Realtime_1ms gets called directly from the timer interrupt every millisecond.
Definition main_tasks.c:90
Tasks_100ms
void Tasks_100ms(void)
Tasks_100ms gets called every 100 ms, put your things in it that need to be called regularly.
Definition main_tasks.c:141
Tasks_Background
void Tasks_Background(void)
Tasks_Background gets called all the time when no other of the above tasks are being called.
Definition main_tasks.c:170
Tasks_1s
void Tasks_1s(void)
Tasks_1s gets called every second, put your things in it that need to be called regularly.
Definition main_tasks.c:155