MySensors Library & Examples  2.3.2
AltSoftSerial_Boards.h
1 /* An Alternative Software Serial Library
2  * http://www.pjrc.com/teensy/td_libs_AltSoftSerial.html
3  * Copyright (c) 2014 PJRC.COM, LLC, Paul Stoffregen, [email protected]
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy
6  * of this software and associated documentation files (the "Software"), to deal
7  * in the Software without restriction, including without limitation the rights
8  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9  * copies of the Software, and to permit persons to whom the Software is
10  * furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in
13  * all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21  * THE SOFTWARE.
22  */
23 
24 
25 // Teensy 2.0
26 //
27 #if defined(__AVR_ATmega32U4__) && defined(CORE_TEENSY)
28 
29 //#define ALTSS_USE_TIMER1
30 //#define INPUT_CAPTURE_PIN 22 // receive
31 //#define OUTPUT_COMPARE_A_PIN 14 // transmit
32 //#define OUTPUT_COMPARE_B_PIN 15 // unusable PWM
33 //#define OUTPUT_COMPARE_C_PIN 4 // unusable PWM
34 
35 #define ALTSS_USE_TIMER3
36 #define INPUT_CAPTURE_PIN 10 // receive
37 #define OUTPUT_COMPARE_A_PIN 9 // transmit
38 
39 
40 
41 // Teensy++ 2.0
42 //
43 #elif defined(__AVR_AT90USB1286__) && defined(CORE_TEENSY)
44 
45 #define ALTSS_USE_TIMER1
46 #define INPUT_CAPTURE_PIN 4 // receive
47 #define OUTPUT_COMPARE_A_PIN 25 // transmit
48 #define OUTPUT_COMPARE_B_PIN 26 // unusable PWM
49 #define OUTPUT_COMPARE_C_PIN 27 // unusable PWM
50 
51 //#define ALTSS_USE_TIMER3
52 //#define INPUT_CAPTURE_PIN 17 // receive
53 //#define OUTPUT_COMPARE_A_PIN 16 // transmit
54 //#define OUTPUT_COMPARE_B_PIN 15 // unusable PWM
55 //#define OUTPUT_COMPARE_C_PIN 14 // unusable PWM
56 
57 
58 // Teensy 3.x
59 //
60 #elif defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__)
61 #define ALTSS_USE_FTM0
62 #define INPUT_CAPTURE_PIN 20 // receive (FTM0_CH5)
63 #define OUTPUT_COMPARE_A_PIN 21 // transmit (FTM0_CH6)
64 #define OUTPUT_COMPARE_B_PIN 22 // unusable PWM (FTM0_CH0)
65 #define OUTPUT_COMPARE_C_PIN 23 // PWM usable fixed freq
66 #define OUTPUT_COMPARE_D_PIN 5 // PWM usable fixed freq
67 #define OUTPUT_COMPARE_E_PIN 6 // PWM usable fixed freq
68 #define OUTPUT_COMPARE_F_PIN 9 // PWM usable fixed freq
69 #define OUTPUT_COMPARE_G_PIN 10 // PWM usable fixed freq
70 
71 
72 // Wiring-S
73 //
74 #elif defined(__AVR_ATmega644P__) && defined(WIRING)
75 
76 #define ALTSS_USE_TIMER1
77 #define INPUT_CAPTURE_PIN 6 // receive
78 #define OUTPUT_COMPARE_A_PIN 5 // transmit
79 #define OUTPUT_COMPARE_B_PIN 4 // unusable PWM
80 
81 
82 
83 // Arduino Uno, Duemilanove, LilyPad, etc
84 //
85 #elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__)
86 
87 #define ALTSS_USE_TIMER1
88 #define INPUT_CAPTURE_PIN 8 // receive
89 #define OUTPUT_COMPARE_A_PIN 9 // transmit
90 #define OUTPUT_COMPARE_B_PIN 10 // unusable PWM
91 
92 
93 // Arduino Leonardo & Yun (from Cristian Maglie)
94 //
95 #elif defined(ARDUINO_AVR_YUN) || defined(ARDUINO_AVR_LEONARDO) || defined(__AVR_ATmega32U4__)
96 
97 //#define ALTSS_USE_TIMER1
98 //#define INPUT_CAPTURE_PIN 4 // receive
99 //#define OUTPUT_COMPARE_A_PIN 9 // transmit
100 //#define OUTPUT_COMPARE_B_PIN 10 // unusable PWM
101 //#define OUTPUT_COMPARE_C_PIN 11 // unusable PWM
102 
103 #define ALTSS_USE_TIMER3
104 #define INPUT_CAPTURE_PIN 13 // receive
105 #define OUTPUT_COMPARE_A_PIN 5 // transmit
106 
107 
108 // Arduino Mega
109 //
110 #elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
111 
112 //#define ALTSS_USE_TIMER4
113 //#define INPUT_CAPTURE_PIN 49 // receive
114 //#define OUTPUT_COMPARE_A_PIN 6 // transmit
115 //#define OUTPUT_COMPARE_B_PIN 7 // unusable PWM
116 //#define OUTPUT_COMPARE_C_PIN 8 // unusable PWM
117 
118 #define ALTSS_USE_TIMER5
119 #define INPUT_CAPTURE_PIN 48 // receive
120 #define OUTPUT_COMPARE_A_PIN 46 // transmit
121 #define OUTPUT_COMPARE_B_PIN 45 // unusable PWM
122 #define OUTPUT_COMPARE_C_PIN 44 // unusable PWM
123 
124 
125 
126 // EnviroDIY Mayfly, Sodaq Mbili
127 #elif defined ARDUINO_AVR_ENVIRODIY_MAYFLY || defined ARDUINO_AVR_SODAQ_MBILI
128 #define ALTSS_USE_TIMER1
129 #define INPUT_CAPTURE_PIN 6 // receive
130 #define OUTPUT_COMPARE_A_PIN 5 // transmit
131 #define OUTPUT_COMPARE_B_PIN 4 // unusable PWM
132 
133 
134 
135 // Sanguino, Mighty 1284
136 #elif defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644__) || defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega1284__)
137 #define ALTSS_USE_TIMER1
138 #define INPUT_CAPTURE_PIN 14 // receive
139 #define OUTPUT_COMPARE_A_PIN 13 // transmit
140 #define OUTPUT_COMPARE_B_PIN 12 // unusable PWM
141 
142 
143 
144 // Unknown board
145 #else
146 #error "Please define your board timer and pins"
147 #endif