diff options
author | Nao Pross <naopross@thearcway.org> | 2018-02-02 12:12:18 +0100 |
---|---|---|
committer | Nao Pross <naopross@thearcway.org> | 2018-02-02 12:12:18 +0100 |
commit | 18abece8f8a8af17a3b5e80dc1baf61457409600 (patch) | |
tree | 66f64fb9ea91d8a26c56af95c66e5bb7b8f8b5c3 /src/main.c | |
parent | Move to version control (diff) | |
download | Xilofono-18abece8f8a8af17a3b5e80dc1baf61457409600.tar.gz Xilofono-18abece8f8a8af17a3b5e80dc1baf61457409600.zip |
2 February 2018
Documentation:
- new API documentation
- datasheets for new components
- update BOM
- update documentation data
Hardware:
- update schematic for MIDI connector
Software:
- new MIDI API
- update prject target to PIC18F45K22
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 30 |
1 files changed, 28 insertions, 2 deletions
@@ -1,6 +1,6 @@ /* * File: main.c - * Author: _prossn + * Author: Naoki Pross 4E * Date: 08.01.2018 * Target: PIC18F44K22 * Version 1.0 @@ -71,21 +71,47 @@ // Use project enums instead of #define for ON and OFF. #include "rs232.h" +#include "midi.h" #include <xc.h> #include <stdio.h> #include <stdlib.h> #include <string.h> +int eusart_write_midi(midi_message_t *pkt) +{ + if (pkt == NULL) { + return -1; + } + + if (pkt->data == NULL) { + return -2; + } + + size_t length = pkt->data_size; + uint8_t *data = pkt->data; + + putch((char)((pkt->status << 4) | pkt->channel)); + + while (length--) { + putch((char) *(data++)); + } + + return 0; +} + /* main program */ void main(void) { + midi_message_t sample_message; + midi_note_on(&sample_message, 0x0, 0x3C, 0x7F); + eusart_init(); /* main loop */ while (1) { - + eusart_write_midi(&sample_message); } } |