uMIDI
The swiss army knife for quick and easy developement of MIDI applications.
program.h
Go to the documentation of this file.
1 
24 /*
25  * Copyright 2015, 2016 Sebastian Neuser
26  *
27  * This file is part of the uMIDI firmware.
28  *
29  * the uMIDI firmware is free software: you can redistribute it and/or modify
30  * it under the terms of the GNU General Public License as published by
31  * the Free Software Foundation, either version 3 of the License, or
32  * (at your option) any later version.
33  *
34  * the uMIDI firmware is distributed in the hope that it will be useful,
35  * but WITHOUT ANY WARRANTY; without even the implied warranty of
36  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
37  * GNU General Public License for more details.
38  *
39  * You should have received a copy of the GNU General Public License
40  * along with the uMIDI firmware. If not, see <http://www.gnu.org/licenses/>.
41  */
42 
43 #ifndef _PROGRAM_H
44 #define _PROGRAM_H
45 
46 
47 //---------------- includes ----------------//
48 #include <stdint.h>
49 
50 
51 //---------------- constants ----------------//
53 #define PROGRAM_BANK_COUNT 12
54 
56 #define PROGRAM_COUNT 120
57 
59 #define PROGRAMS_PER_BANK (PROGRAM_COUNT / PROGRAM_BANK_COUNT)
60 
61 
62 //---------------- data types ----------------//
64 struct program
65 {
66  uint8_t number;
67  uint32_t data;
68 };
69 
70 
71 //---------------- functions and procedures ----------------//
72 
77 void copy_current_bank_to(uint8_t target_bank);
78 
83 void copy_current_program_to(uint8_t target_program);
84 
90 char* export_bank(const uint8_t number);
91 
100 void enter_program(uint8_t number);
101 
109 bool import_bank(const uint8_t number, const char* data);
110 
122 void init_program_module(uint32_t program_initializer, void (*execute_program_callback)(uint32_t program_data));
123 
127 uint32_t read_program_data(uint8_t number);
128 
132 void update_current_program(uint32_t program_data);
133 
136 void wipe_current_bank(void);
137 
141 void wipe_current_program(void);
142 
148 void write_program(uint8_t number, uint32_t data);
149 
150 
151 //---------------- EOF ----------------//
152 #endif // _PROGRAM_H
bool import_bank(const uint8_t number, const char *data)
Imports and stores a program bank given as a hex-string.
Definition: program.c:125
uint8_t number
Program number [0..PROGRAM_COUNT-1].
Definition: program.h:66
Data structure for program information.
Definition: program.h:64
void enter_program(uint8_t number)
Loads and executes the specified program.
Definition: program.c:112
static uint32_t program_initializer
Initialization value for empty programs.
Definition: program.c:47
char * export_bank(const uint8_t number)
Exports a program bank.
Definition: program.c:96
uint32_t read_program_data(uint8_t number)
Reads a program data word from the specified position in memory.
Definition: program.c:160
void write_program(uint8_t number, uint32_t data)
Stores a given program data word in the specified position in memory.
Definition: program.c:190
void wipe_current_program(void)
Reinitializes the currently loaded program.
Definition: program.c:184
void wipe_current_bank(void)
Reinitializes all programs in the current bank.
Definition: program.c:171
uint32_t data
The application specific program data as a 32-bit word.
Definition: program.h:67
void copy_current_bank_to(uint8_t target_bank)
Copies all programs in the current bank to another bank.
Definition: program.c:61
void update_current_program(uint32_t program_data)
Updates and stores the current program.
Definition: program.c:165
void copy_current_program_to(uint8_t target_program)
Copies the current program to the specified position in memory.
Definition: program.c:90
void init_program_module(uint32_t program_initializer, void(*execute_program_callback)(uint32_t program_data))
Initializes the program storage module.
Definition: program.c:151
Definition: switcher.c:45