uMIDI
The swiss army knife for quick and easy developement of MIDI applications.
background_tasks.h
Go to the documentation of this file.
1 
4 /*
5  * Copyright 2014, 2015 Sebastian Neuser
6  *
7  * This file is part of the uMIDI firmware.
8  *
9  * The MIDI volume controller firmware is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * The MIDI volume controller firmware is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with the uMIDI firmware. If not, see <http://www.gnu.org/licenses/>.
21  */
22 
23 #ifndef _BACKGROUND_TASKS_H
24 #define _BACKGROUND_TASKS_H
25 
26 
27 //---------------- includes ----------------//
28 #include <stdint.h>
29 
30 
31 //---------------- constants ----------------//
32 
34 #define F_TIMER 20000
35 
37 #define F_TASK_FAST F_TIMER
38 
40 #define F_TASK_MID (F_TASK_FAST / 20)
41 
43 #define F_TASK_SLOW (F_TASK_MID / 10)
44 
45 
46 //---------------- data types ----------------//
47 
49 typedef void (*background_task_t)(void);
50 
51 
52 //---------------- functions and procedures ----------------//
53 
62 void process_background_tasks(void);
63 
84 void init_background_tasks(background_task_t high_freq_tasks[], uint8_t high_freq_tasks_size,
85  background_task_t mid_freq_tasks[], uint8_t mid_freq_tasks_size,
86  background_task_t low_freq_tasks[], uint8_t low_freq_tasks_size);
87 
88 
89 //---------------- EOF ----------------//
90 #endif // _BACKGROUND_TASKS_H
91 
void(* background_task_t)(void)
Data type for background task pointers.
Definition: background_tasks.h:49
void init_background_tasks(background_task_t high_freq_tasks[], uint8_t high_freq_tasks_size, background_task_t mid_freq_tasks[], uint8_t mid_freq_tasks_size, background_task_t low_freq_tasks[], uint8_t low_freq_tasks_size)
Initializes the background task scheduler.
void process_background_tasks(void)
Invokes registered background tasks if certain conditions are met.
Definition: background_tasks.c:56