uMIDI
The swiss army knife for quick and easy developement of MIDI applications.
|
Serial communication module. More...
#include <stdbool.h>
#include <stdint.h>
#include <avr/pgmspace.h>
Go to the source code of this file.
Data Structures | |
struct | serial_command |
Command specification. More... | |
Macros | |
#define | CMD_BUFFER_SIZE 100 |
Size of the command buffer of the shell. More... | |
#define | CMD_HISTORY_SIZE 4 |
Number of recent commands in the history. More... | |
#define | ESCAPE_CHAR_CODE 27 |
ASCII escape character. More... | |
#define | MAX_PAGE_NUM ((PROGMEM_SIZE - BOOT_SECTION_SIZE) / SPM_PAGESIZE / 2 - 1) |
Maximum program size in number of pages. More... | |
#define | RESET_TIMEOUT 2 |
Device reset timout in [s]. More... | |
Typedefs | |
typedef bool(* | cmd_handler_t) (const char *cmd) |
Type for command handlers. More... | |
Functions | |
void | init_serial_communication (const struct serial_command commands[], uint8_t commands_size) |
Initializes the USB communication module. More... | |
void | serial_communication_task (void) |
Main task for USB communication. More... | |
Serial communication module.
This module contains a firmware update procedure and a command interpreter that can be extended by custom commands.
#define CMD_BUFFER_SIZE 100 |
Size of the command buffer of the shell.
Must be int the range of uint8_t
.
#define CMD_HISTORY_SIZE 4 |
Number of recent commands in the history.
Must be int the range of uint8_t
.
#define ESCAPE_CHAR_CODE 27 |
ASCII escape character.
#define MAX_PAGE_NUM ((PROGMEM_SIZE - BOOT_SECTION_SIZE) / SPM_PAGESIZE / 2 - 1) |
Maximum program size in number of pages.
#define RESET_TIMEOUT 2 |
Device reset timout in [s].
typedef bool(* cmd_handler_t) (const char *cmd) |
Type for command handlers.
void init_serial_communication | ( | const struct serial_command | commands[], |
uint8_t | commands_size | ||
) |
Initializes the USB communication module.
Registers the specified commands.
commands | an array of command specifications |
commands_size | the number of command specifications in commands |
void serial_communication_task | ( | void | ) |
Main task for USB communication.
This task must be run as a slow or medium speed task in order to enable USB communication and firmware updates. It processes commands arriving on the bus and takes required actions by calling registered handler functions.