diff options
author | Nao Pross <naopross@thearcway.org> | 2018-02-22 22:32:14 +0100 |
---|---|---|
committer | Nao Pross <naopross@thearcway.org> | 2018-02-22 22:32:14 +0100 |
commit | 46a617a1b68b8b21eda9e590915dd813ea44e7cb (patch) | |
tree | c3618230647561db0373fb69f67cfb7b75631086 /src | |
parent | Update doc (diff) | |
download | Xilofono-46a617a1b68b8b21eda9e590915dd813ea44e7cb.tar.gz Xilofono-46a617a1b68b8b21eda9e590915dd813ea44e7cb.zip |
Add const to MIDI pkt pointer arguments
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 2 | ||||
-rw-r--r-- | src/midi.c | 4 | ||||
-rw-r--r-- | src/midi.h | 6 | ||||
-rw-r--r-- | src/rs232.c | 3 |
4 files changed, 4 insertions, 11 deletions
@@ -78,7 +78,7 @@ #include <stdlib.h> #include <string.h> -int eusart_write_midi(midi_message_t *pkt) +int eusart_write_midi(const midi_message_t *pkt) { size_t length; uint8_t *data; @@ -14,17 +14,15 @@ midi_message_t *midi_alloc_message(size_t data_size) void midi_free_message(midi_message_t *pkt) { -#ifndef MIDI_UNSAFE if (pkt == NULL) { return; } -#endif free(pkt); pkt = NULL; } -size_t midi_message_size(midi_message_t *pkt) +size_t midi_message_size(const midi_message_t *pkt) { if (pkt == NULL) { return 0; @@ -59,14 +59,13 @@ typedef struct { // allocation / dellocation extern midi_message_t *midi_alloc_message(size_t data_size); -extern void midi_free_message(midi_message_t *pkt); -extern size_t midi_message_size(midi_message_t *pkt); +extern void midi_free_message(const midi_message_t *pkt); +extern size_t midi_message_size(const midi_message_t *pkt); #endif // helper functions - extern int midi_set_status(midi_message_t *pkt, midi_status_t status); extern int midi_set_channel(midi_message_t *pkt, unsigned channel); @@ -77,6 +76,5 @@ extern int midi_note_off(midi_message_t *pkt, unsigned channel, midi_note_t note // optimization // extern int midi_thin_data(void *buffer, midi_message_t pkt[]); - #endif /* MIDI_H */ diff --git a/src/rs232.c b/src/rs232.c index 05d8b22..e87e49b 100644 --- a/src/rs232.c +++ b/src/rs232.c @@ -3,7 +3,6 @@ void eusart_init(void) { - // set Async and 8 bits frame TXSTAbits.SYNC = 0; TXSTAbits.TX9 = 0; @@ -23,14 +22,12 @@ void eusart_init(void) void putch(char c) { - while (!TXIF); TXREG = c; } char getch(void) { - while (!RCIF); return RCREG; } |