Skip to content

Commit 5c2f1c2

Browse files
authored
Merge pull request #1926 from TheKitty/license-changes
Fix CRLF
2 parents d670ab4 + bbd44bf commit 5c2f1c2

File tree

1 file changed

+123
-123
lines changed

1 file changed

+123
-123
lines changed
Lines changed: 123 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -1,123 +1,123 @@
1-
// SPDX-FileCopyrightText: 2018 Arduino SA
2-
//
3-
// SPDX-License-Identifier: GPL-2.1-or-later
4-
/*
5-
SerialNINAPassthrough - Use esptool to flash the ESP32 module
6-
For use with PyPortal, Metro M4 WiFi...
7-
8-
Copyright (c) 2018 Arduino SA. All rights reserved.
9-
10-
This library is free software; you can redistribute it and/or
11-
modify it under the terms of the GNU Lesser General Public
12-
License as published by the Free Software Foundation; either
13-
version 2.1 of the License, or (at your option) any later version.
14-
15-
This library is distributed in the hope that it will be useful,
16-
but WITHOUT ANY WARRANTY; without even the implied warranty of
17-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18-
Lesser General Public License for more details.
19-
20-
You should have received a copy of the GNU Lesser General Public
21-
License along with this library; if not, write to the Free Software
22-
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23-
*/
24-
25-
#include <Adafruit_NeoPixel.h>
26-
27-
unsigned long baud = 115200;
28-
29-
#if defined(ADAFRUIT_FEATHER_M4_EXPRESS) || \
30-
defined(ADAFRUIT_FEATHER_M0_EXPRESS) || \
31-
defined(ARDUINO_AVR_FEATHER32U4) || \
32-
defined(ARDUINO_NRF52840_FEATHER) || \
33-
defined(ADAFRUIT_ITSYBITSY_M0) || \
34-
defined(ADAFRUIT_ITSYBITSY_M4_EXPRESS) || \
35-
defined(ARDUINO_AVR_ITSYBITSY32U4_3V) || \
36-
defined(ARDUINO_NRF52_ITSYBITSY)
37-
// Configure the pins used for the ESP32 connection
38-
#define SerialESP32 Serial1
39-
#define SPIWIFI SPI // The SPI port
40-
#define SPIWIFI_SS 13 // Chip select pin
41-
#define ESP32_RESETN 12 // Reset pin
42-
#define SPIWIFI_ACK 11 // a.k.a BUSY or READY pin
43-
#define ESP32_GPIO0 10
44-
#define NEOPIXEL_PIN 8
45-
#elif defined(ARDUINO_AVR_FEATHER328P)
46-
#define SerialESP32 Serial1
47-
#define SPIWIFI SPI // The SPI port
48-
#define SPIWIFI_SS 4 // Chip select pin
49-
#define ESP32_RESETN 3 // Reset pin
50-
#define SPIWIFI_ACK 2 // a.k.a BUSY or READY pin
51-
#define ESP32_GPIO0 -1
52-
#define NEOPIXEL_PIN 8
53-
#elif defined(TEENSYDUINO)
54-
#define SerialESP32 Serial1
55-
#define SPIWIFI SPI // The SPI port
56-
#define SPIWIFI_SS 5 // Chip select pin
57-
#define ESP32_RESETN 6 // Reset pin
58-
#define SPIWIFI_ACK 9 // a.k.a BUSY or READY pin
59-
#define ESP32_GPIO0 -1
60-
#define NEOPIXEL_PIN 8
61-
#elif defined(ARDUINO_NRF52832_FEATHER )
62-
#define SerialESP32 Serial1
63-
#define SPIWIFI SPI // The SPI port
64-
#define SPIWIFI_SS 16 // Chip select pin
65-
#define ESP32_RESETN 15 // Reset pin
66-
#define SPIWIFI_ACK 7 // a.k.a BUSY or READY pin
67-
#define ESP32_GPIO0 -1
68-
#define NEOPIXEL_PIN 8
69-
#elif !defined(SPIWIFI_SS) // if the wifi definition isnt in the board variant
70-
// Don't change the names of these #define's! they match the variant ones
71-
#define SerialESP32 Serial1
72-
#define SPIWIFI SPI
73-
#define SPIWIFI_SS 10 // Chip select pin
74-
#define SPIWIFI_ACK 7 // a.k.a BUSY or READY pin
75-
#define ESP32_RESETN 5 // Reset pin
76-
#define ESP32_GPIO0 -1 // Not connected
77-
#define NEOPIXEL_PIN 8
78-
#endif
79-
80-
#if defined(ADAFRUIT_PYPORTAL)
81-
#define PIN_NEOPIXEL 2
82-
#elif defined(ADAFRUIT_METRO_M4_AIRLIFT_LITE)
83-
#define PIN_NEOPIXEL 40
84-
#endif
85-
86-
Adafruit_NeoPixel pixel = Adafruit_NeoPixel(1, PIN_NEOPIXEL, NEO_GRB + NEO_KHZ800);
87-
88-
void setup() {
89-
Serial.begin(baud);
90-
pixel.begin();
91-
pixel.setPixelColor(0, 10, 10, 10); pixel.show();
92-
93-
while (!Serial);
94-
pixel.setPixelColor(0, 50, 50, 50); pixel.show();
95-
96-
delay(100);
97-
SerialESP32.begin(baud);
98-
99-
pinMode(SPIWIFI_SS, OUTPUT);
100-
pinMode(ESP32_GPIO0, OUTPUT);
101-
pinMode(ESP32_RESETN, OUTPUT);
102-
103-
// manually put the ESP32 in upload mode
104-
digitalWrite(ESP32_GPIO0, LOW);
105-
106-
digitalWrite(ESP32_RESETN, LOW);
107-
delay(100);
108-
digitalWrite(ESP32_RESETN, HIGH);
109-
pixel.setPixelColor(0, 20, 20, 0); pixel.show();
110-
delay(100);
111-
}
112-
113-
void loop() {
114-
while (Serial.available()) {
115-
pixel.setPixelColor(0, 10, 0, 0); pixel.show();
116-
SerialESP32.write(Serial.read());
117-
}
118-
119-
while (SerialESP32.available()) {
120-
pixel.setPixelColor(0, 0, 0, 10); pixel.show();
121-
Serial.write(SerialESP32.read());
122-
}
123-
}
1+
// SPDX-FileCopyrightText: 2018 Arduino SA
2+
//
3+
// SPDX-License-Identifier: GPL-2.1-or-later
4+
/*
5+
SerialNINAPassthrough - Use esptool to flash the ESP32 module
6+
For use with PyPortal, Metro M4 WiFi...
7+
8+
Copyright (c) 2018 Arduino SA. All rights reserved.
9+
10+
This library is free software; you can redistribute it and/or
11+
modify it under the terms of the GNU Lesser General Public
12+
License as published by the Free Software Foundation; either
13+
version 2.1 of the License, or (at your option) any later version.
14+
15+
This library is distributed in the hope that it will be useful,
16+
but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18+
Lesser General Public License for more details.
19+
20+
You should have received a copy of the GNU Lesser General Public
21+
License along with this library; if not, write to the Free Software
22+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23+
*/
24+
25+
#include <Adafruit_NeoPixel.h>
26+
27+
unsigned long baud = 115200;
28+
29+
#if defined(ADAFRUIT_FEATHER_M4_EXPRESS) || \
30+
defined(ADAFRUIT_FEATHER_M0_EXPRESS) || \
31+
defined(ARDUINO_AVR_FEATHER32U4) || \
32+
defined(ARDUINO_NRF52840_FEATHER) || \
33+
defined(ADAFRUIT_ITSYBITSY_M0) || \
34+
defined(ADAFRUIT_ITSYBITSY_M4_EXPRESS) || \
35+
defined(ARDUINO_AVR_ITSYBITSY32U4_3V) || \
36+
defined(ARDUINO_NRF52_ITSYBITSY)
37+
// Configure the pins used for the ESP32 connection
38+
#define SerialESP32 Serial1
39+
#define SPIWIFI SPI // The SPI port
40+
#define SPIWIFI_SS 13 // Chip select pin
41+
#define ESP32_RESETN 12 // Reset pin
42+
#define SPIWIFI_ACK 11 // a.k.a BUSY or READY pin
43+
#define ESP32_GPIO0 10
44+
#define NEOPIXEL_PIN 8
45+
#elif defined(ARDUINO_AVR_FEATHER328P)
46+
#define SerialESP32 Serial1
47+
#define SPIWIFI SPI // The SPI port
48+
#define SPIWIFI_SS 4 // Chip select pin
49+
#define ESP32_RESETN 3 // Reset pin
50+
#define SPIWIFI_ACK 2 // a.k.a BUSY or READY pin
51+
#define ESP32_GPIO0 -1
52+
#define NEOPIXEL_PIN 8
53+
#elif defined(TEENSYDUINO)
54+
#define SerialESP32 Serial1
55+
#define SPIWIFI SPI // The SPI port
56+
#define SPIWIFI_SS 5 // Chip select pin
57+
#define ESP32_RESETN 6 // Reset pin
58+
#define SPIWIFI_ACK 9 // a.k.a BUSY or READY pin
59+
#define ESP32_GPIO0 -1
60+
#define NEOPIXEL_PIN 8
61+
#elif defined(ARDUINO_NRF52832_FEATHER )
62+
#define SerialESP32 Serial1
63+
#define SPIWIFI SPI // The SPI port
64+
#define SPIWIFI_SS 16 // Chip select pin
65+
#define ESP32_RESETN 15 // Reset pin
66+
#define SPIWIFI_ACK 7 // a.k.a BUSY or READY pin
67+
#define ESP32_GPIO0 -1
68+
#define NEOPIXEL_PIN 8
69+
#elif !defined(SPIWIFI_SS) // if the wifi definition isnt in the board variant
70+
// Don't change the names of these #define's! they match the variant ones
71+
#define SerialESP32 Serial1
72+
#define SPIWIFI SPI
73+
#define SPIWIFI_SS 10 // Chip select pin
74+
#define SPIWIFI_ACK 7 // a.k.a BUSY or READY pin
75+
#define ESP32_RESETN 5 // Reset pin
76+
#define ESP32_GPIO0 -1 // Not connected
77+
#define NEOPIXEL_PIN 8
78+
#endif
79+
80+
#if defined(ADAFRUIT_PYPORTAL)
81+
#define PIN_NEOPIXEL 2
82+
#elif defined(ADAFRUIT_METRO_M4_AIRLIFT_LITE)
83+
#define PIN_NEOPIXEL 40
84+
#endif
85+
86+
Adafruit_NeoPixel pixel = Adafruit_NeoPixel(1, PIN_NEOPIXEL, NEO_GRB + NEO_KHZ800);
87+
88+
void setup() {
89+
Serial.begin(baud);
90+
pixel.begin();
91+
pixel.setPixelColor(0, 10, 10, 10); pixel.show();
92+
93+
while (!Serial);
94+
pixel.setPixelColor(0, 50, 50, 50); pixel.show();
95+
96+
delay(100);
97+
SerialESP32.begin(baud);
98+
99+
pinMode(SPIWIFI_SS, OUTPUT);
100+
pinMode(ESP32_GPIO0, OUTPUT);
101+
pinMode(ESP32_RESETN, OUTPUT);
102+
103+
// manually put the ESP32 in upload mode
104+
digitalWrite(ESP32_GPIO0, LOW);
105+
106+
digitalWrite(ESP32_RESETN, LOW);
107+
delay(100);
108+
digitalWrite(ESP32_RESETN, HIGH);
109+
pixel.setPixelColor(0, 20, 20, 0); pixel.show();
110+
delay(100);
111+
}
112+
113+
void loop() {
114+
while (Serial.available()) {
115+
pixel.setPixelColor(0, 10, 0, 0); pixel.show();
116+
SerialESP32.write(Serial.read());
117+
}
118+
119+
while (SerialESP32.available()) {
120+
pixel.setPixelColor(0, 0, 0, 10); pixel.show();
121+
Serial.write(SerialESP32.read());
122+
}
123+
}

0 commit comments

Comments
 (0)