forked from Protonerd/FX-SaberOS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConfig_HW.h
237 lines (206 loc) · 7.71 KB
/
Config_HW.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
/*
* Config_HW.h
*
* Created on: 30 March 2017
* author: Andras Kun (kun.andras@yahoo.de)
* Source : https://github.com/Protonerd/FX-SaberOS
* This tab contains all settings necessary to define your saber board's electronic hardware configuration
*/
#if not defined CONFIG_HW_H_
#define CONFIG_HW_H_
/* Board definitions
* Define what kind of Arduino compatible board you have in your saber.
* DIYino Prime and Stardust are both dedicated, fully integrated
* saber boards manufactured by ProtoWerkstatt.
* For more information on DIYino products, see:
* https://github.com/Protonerd/DIYino
* https://www.facebook.com/ProtoWerkstatt-740015792832712/
* If you have a home-brew solution using the Arduino Nano, choose DIYINO_PRIME below
*/
#define DIYINO_PRIME // including home-brew
//#define DIYINO_STARDUST_V2
//#define DIYINO_STARDUST_V3
/***** BOARD PINOUT DEFINITIONS ******/
/*
* Definition of the MAIN and AUX buttons of your saber.
* These 2 buttons are used to interact with the saber electronics in the hilt
* With the SINGLEBUTTON compile directive you can configure your saber electronics
* to use only a single button to interact with your board.
*/
// If your saber has only a single button to interact with the electronics, uncomment the next line
// in case you have 2 buttons (referred to as main and aux buttons) leave this line commented out
//#define SINGLEBUTTON
#ifdef DIYINO_PRIME
#define MAIN_BUTTON 12
#ifndef SINGLEBUTTON
#define AUX_BUTTON 4
#endif
#else if defined DIYINO_STARDUST_V2 or defined DIYINO_STARDUST_V3
#define MAIN_BUTTON 12
#ifndef SINGLEBUTTON
#define AUX_BUTTON 11 // 2
#endif
#endif
/*
* BLADE TYPE
*
* RGB LED OR PIXELBLADE users:
* Comment the following line will
* disable and remove all LEDSTRINGS
* blocks from compile
*************************************/
//#define LEDSTRINGS
//#define STAR_LED
#define PIXELBLADE
//#define ADF_PIXIE_BLADE
/************************************/
/*
* SABER TYPE
* currently in v1.3 only the CROSSGUARDSABER
* will have any effect on the code
* due to the fire blade effect
*************************************/
#define SINGLEBLADE // i.e. Graflex
//#define SABERSTAFF // i.e. Darth Maul saber with dual blades
//#define CROSSGUARDSABER // i.e. Kylo Ren saber
/*
* POWER SAVING CIRCUITRY
* Definition of the power switches (DIYino Prime v1.5 or greater, STARDUST
* The MP3 power switch will cut power to the MP3 chipset as well as disable the audio amp
* The FTDI power switch will cut power to the Serial-to-UART FTDI chipset, saving power and
* allowing a PC to access the SD-card or SPI flash via the MP3 chipset over USB.
* Enable DEEP_SLEEP in software config to make use of the power saving options.
*/
#ifdef DIYINO_PRIME
#define MP3_PSWITCH 15 // A1
#define FTDI_PSWITCH 16 // A2
#else if defined DIYINO_STARDUST_V2 or defined DIYINO_STARDUST_V3
#define MP3_PSWITCH 17 // A3
#define FTDI_PSWITCH 16 // A2
#endif
/*
* General configuration for the main saber blade illumination types
* STAR_LED refers to an in-hilt high-power LED module, usually of type RGB for color mixing, but can be a single LED type or any combination
* of colors and LED dice up to 3 (more can be configured on demand, up to 6 with DIYino Prime
* PIXELBLADE defines a neopixel stripe running the length of the blade. For more information on neopixels, see: https://www.adafruit.com/category/168
* Currently supported chip set: WS2812B
* LEDSTRINGS are commonly known as segmented LED strings and represent a blade type where thru-hole LEDs of a single color are connected in parallel
* along the length of the blade. Currently supported number of segments: 6 (like Hasbro high-end and Plecter boards among others)
*/
#ifdef DIYINO_PRIME
#define LED_RED 3
#define LED_GREEN 5
#define LED_BLUE 6
#else if defined DIYINO_STARDUST_V2 or defined DIYINO_STARDUST_V3
#define LED_RED 5
#define LED_GREEN 6
#define LED_BLUE 9
#endif
#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
#include <Wire.h>
#endif
#if defined LEDSTRINGS or defined STAR_LED
#define NUMPIXELS 0
#endif
#ifdef PIXELBLADE
// How many leds in one strip?
#define NUMPIXELS 115 // can go up to 120, could lead to memory overflow if further increased, causing instability
// For led chips like NEOPIXELs, which have a data line, ground, and power, you just
// need to define DATA_PIN.
#define DATA_PIN 13 // D13
#endif
#ifdef ADF_PIXIE_BLADE
#define NUMPIXELS 1
#define PIXIEPIN 13 // Pin number for SoftwareSerial output
#endif
#ifdef CROSSGUARDSABER
// define how many pixels are used for the crossguard and how many for the main blade
#define CROSSGUARD_LENGTH 10 // cross guard stripe length
#define MAINBLADE_LENGTH 50 // main blade stripe length
#define CROSSGUARD_OFFSET 0
#define MAINBLADE_OFFSET 10
#define STAGGERED_IGNITION_DELAY 1000
#endif
#ifdef DIYINO_PRIME
#define LS1 3
#define LS2 5
#define LS3 6
#define LS4 9
#define LS5 10
#define LS6 11
#else if defined DIYINO_STARDUST_V2 or defined DIYINO_STARDUST_V3
#define LS1 5
#define LS2 6
#define LS3 9
#endif
/*
* FoCSTRING
* Enable/disable management of
* single Flash On Clash ledstring
*************************************/
//#define FoCSTRING 14
/*
* BUTTON ACCENT_LED
* Enable/disable management of
* a button accent led
*************************************/
#define HARD_ACCENT
#ifdef DIYINO_PRIME
#ifdef HARD_ACCENT
#define ACCENT_LED 14 //A0
#endif
#else if defined DIYINO_STARDUST_V2 or defined DIYINO_STARDUST_V3
#ifdef HARD_ACCENT
#define ACCENT_LED 14 //A0 is an auxiliary pin on Stardust v2
#endif
#endif
/*
* MP3 chips YX5200 or YX6300 Tx and Rx ins, as well as the ADC pins connected to the SPK terminals for AudioTracker
*/
#define DFPLAYER_RX 8
#define DFPLAYER_TX 7
#define SPK1 20 //A6
#define SPK2 21 //A7
/*
* Uncomment to correct sound issues (e.g. incorrectly looping sounds) when using a DFPlayer clone chip such as the MH2024K-24SS
*/
#define DFPLAYER_CLONE
/*
* Some DFPlayer versions cannot handle commands sent at high frequency, so ensure a minimum delay between commands.
* Increase if you notice certain sounds not being played, but don't set too high or sounds and effects will become less responsive.
*/
#ifdef DFPLAYER_CLONE
#define DFPLAYER_OPERATING_DELAY 125 //125 (ms)
#endif
#define BATTERY_CHECK // comment to disable
#ifdef BATTERY_CHECK
#ifdef DIYINO_PRIME
#define BATTERY_READPIN 17 //A3 - read battery level
#endif
#if defined DIYINO_STARDUST_V2 or defined DIYINO_STARDUST_V3
#define BATTERY_READPIN 15
#endif
#endif
/*!!!!!IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT!!!
*
* MPU6050 device ORIENTATION
* Choose which MPU's axis is parallel
* to your blade axis
*************************************/
//#define BLADE_X
#define BLADE_Y
//#define BLADE_Z
/************************************/
/*
* MPU6050 calibrated offset values
* If defined, calibration values will be retrieved from EEPROM
* use this option if the MPU6050_calibration sketch wrote the calibrated offsets
* into the EEPROM (default address is 96)
* If not defined, you have to note down the calibrated offset values
* and assign them to the respective variables in the code.
*************************************/
#define MPUCALOFFSETEEPROM
#ifdef MPUCALOFFSETEEPROM
#define MEMORYBASEMPUCALIBOFFSET 200 // 96 -> increased to 200 due to storing RGB PWM values in EEPROM takes a lot of space (3 x 1byte x 3 color types x nr of sound fonts i.e. for 5 sound fonts 45 bytes
#endif
#endif /* CONFIG_HW_H_ */