forked from kalnajslab/MCB
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMCBBufferGuard.h
69 lines (57 loc) · 2.36 KB
/
MCBBufferGuard.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
* MCBBufferGuard.h
* Author: Alex St. Clair
* Created: July 2019
*
* Provides compiler checks that the software serial buffers are correctly sized.
*
* In order to do some of the asychronous communication at the data amounts
* and rates these payloads require, yet with the lack of direct UART interrupt
* access that Arduino gives, we need to modify the software Serial buffers in
* the Teensy 3.6 core.
*/
// To change a buffer, locate teensy/avr/cores/teensy3/HardwareSerial.h
// Add the following lines (uncommented) near the top (but after "#define
// HardwareSerial_h") and change any buffer sizes desired from the 64-byte
// default.
// -------------- Strateole 2 Buffer Changes --------------
// #define SERIAL1_RX_BUFFER_SIZE 64
// #define SERIAL2_RX_BUFFER_SIZE 64
// #define SERIAL3_RX_BUFFER_SIZE 64
// #define SERIAL4_RX_BUFFER_SIZE 64
// #define SERIAL5_RX_BUFFER_SIZE 64
// #define SERIAL6_RX_BUFFER_SIZE 64
// --------------------------------------------------------
// Each of the following checks to make sure the buffer has been redefined, and
// that the size is correct. If either is not true, a compiler error will be thrown.
#include "HardwareSerial.h" // not necessary, but makes it easy to find the file with a smart IDE
#ifndef SERIAL1_RX_BUFFER_SIZE
#error "Need to redefine the Serial1 buffer size to 128"
#elif SERIAL1_RX_BUFFER_SIZE <= 128
#error "Serial1 buffer should be 128 bytes"
#endif
#ifndef SERIAL2_RX_BUFFER_SIZE
#error "Need to redefine the Serial2 buffer size to 64"
#elif SERIAL2_RX_BUFFER_SIZE <= 64
#error "Serial2 buffer should be 64 bytes"
#endif
#ifndef SERIAL3_RX_BUFFER_SIZE
#error "Need to redefine the Serial3 buffer size to 64"
#elif SERIAL3_RX_BUFFER_SIZE <= 64
#error "Serial3 buffer should be 64 bytes"
#endif
#ifndef SERIAL4_RX_BUFFER_SIZE
#error "Need to redefine the Serial4 buffer size to 64"
#elif SERIAL4_RX_BUFFER_SIZE <= 32
#error "Serial4 buffer should be 64 bytes"
#endif
#ifndef SERIAL5_RX_BUFFER_SIZE
#error "Need to redefine the Serial5 buffer size to 64"
#elif SERIAL5_RX_BUFFER_SIZE <= 32
#error "Serial5 buffer should be 64 bytes"
#endif
#ifndef SERIAL6_RX_BUFFER_SIZE
#error "Need to redefine the Serial6 buffer size to 64"
#elif SERIAL6_RX_BUFFER_SIZE <= 32
#error "Serial6 buffer should be 64 bytes"
#endif