Skip to content
This repository was archived by the owner on Feb 21, 2020. It is now read-only.

Commit f65f711

Browse files
committed
renamed Serial0 to Serial and removed unwanted files
1 parent 04f06bd commit f65f711

File tree

14 files changed

+204
-383
lines changed

14 files changed

+204
-383
lines changed

cores/arduino/HardwareSerial.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
/* UART handler declaration */
4545
UART_HandleTypeDef UartHandle;
4646

47-
HardwareSerial Serial0(UART4_dev);
47+
HardwareSerial Serial(UART4_dev);//Serial0(UART4_dev);
4848
HardwareSerial Serial1(USART3_dev);
4949
HardwareSerial Serial2(USART2_dev);
5050
HardwareSerial Serial3(USART6_dev);

cores/arduino/HardwareSerial.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class HardwareSerial : public Stream {
7979
uint8 rx_pin;
8080
};
8181

82-
extern HardwareSerial Serial0;
82+
extern HardwareSerial Serial;//Serial0;
8383
extern HardwareSerial Serial1;
8484
extern HardwareSerial Serial2;
8585
extern HardwareSerial Serial3;

cores/arduino/usb_serial.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ extern __IO uint32_t UserRxBufPtrIn;
5757
extern __IO uint32_t UserRxBufPtrOut;
5858
__IO uint32_t usbEnableBlockingTx;
5959

60-
USBSerial Serial;
60+
//USBSerial Serial;
6161
USBSerial SerialUSB;
6262

6363

cores/arduino/usb_serial.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class USBSerial : public Stream {
7171

7272
};
7373

74-
extern USBSerial Serial;
74+
//extern USBSerial Serial;
7575
extern USBSerial SerialUSB;
7676

7777
#endif

libraries/Audio/example/SimpleAudioPlayer/SimpleAudioPlayer.ino

+9-9
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222

2323
void setup() {
2424
// initialize serial communication at 9600 bits per second:
25-
Serial.begin(115200);
26-
delay(15000);
25+
SerialUSB.begin(115200);
26+
while(!SerialUSB);
2727

2828
/* Test begin() method */
2929
while (SD.begin(SD_DETECT_PIN) != TRUE)
@@ -38,21 +38,21 @@ void loop() {
3838
const int S = 1024; // Number of samples to read in block
3939
uint32_t buffer[S];
4040
int duration;
41-
delay(5000); // delay for console
41+
delay(1000); // delay for console
4242

4343
File myFile = SD.open("test.wav");
4444
if (!myFile.available()) {
4545
// if the file didn't open, print an error and stop
46-
Serial.println("error opening test.wav");
46+
SerialUSB.println("error opening test.wav");
4747
while (true);
4848
} else {
49-
Serial.println("test.wav open OK");
49+
SerialUSB.println("test.wav open OK");
5050
}
5151

5252
myFile.read((void*) &WaveFormat, sizeof(WaveFormat));
5353

5454
delay(1000);
55-
Serial.println("STARTUP AUDIO\r\n");
55+
SerialUSB.println("STARTUP AUDIO\r\n");
5656
delay(1000);
5757
Audio.begin(WaveFormat.SampleRate, 100);
5858

@@ -68,7 +68,7 @@ void loop() {
6868
// Every 100 block print a '.'
6969
count++;
7070
if (count == 1000) {
71-
Serial.print(".");
71+
SerialUSB.print(".");
7272
count = 0;
7373
}
7474
// read from the file into buffer
@@ -78,11 +78,11 @@ void loop() {
7878
Audio.write(buffer, sizeof(buffer));
7979
}
8080
/* reaching end of file */
81-
Serial.println("End of file. Thank you for listening!");
81+
SerialUSB.println("End of file. Thank you for listening!");
8282
Audio.end();
8383
myFile.close();
8484

8585
delay(5000);
86-
Serial.println("Restart Playing");
86+
SerialUSB.println("Restart Playing");
8787

8888
}

libraries/Audio/example/SimpleAudioPlayerWithDebug/SimpleAudioPlayerWithDebug.ino

-161
This file was deleted.

libraries/Audio/example/SimpleAudioRecorder/SimpleAudioRecorder.ino

+28-28
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
Original by Frederic Pillon November 09, 2016
1111
1212
This example code is in the public domain
13-
13+
1414
* A sound file named "record.wav" in the root directory of the SD card
1515
* will be created. Record duration is 30 seconds.
1616
@@ -26,9 +26,9 @@ const char recFile[] = "record.wav";
2626
#define RECORD_5PERCENT ((5*REC_SAMPLE_LENGTH)/100)
2727

2828
void setup() {
29-
// initialize serial communication at 115200 bits per second:
30-
Serial.begin(115200);
31-
delay(15000);
29+
// initialize SerialUSB communication at 115200 bits per second:
30+
SerialUSB.begin(115200);
31+
while(!SerialUSB);
3232

3333
while (SD.begin(SD_DETECT_PIN) != TRUE)
3434
{
@@ -48,37 +48,37 @@ void loop() {
4848
File myFile = SD.open(recFile, FILE_WRITE);
4949
if (!SD.exists(recFile)) {
5050
// If the file didn't open, print an error and stop
51-
Serial.print("Error: failed to create ");
52-
Serial.println(recFile);
51+
SerialUSB.print("Error: failed to create ");
52+
SerialUSB.println(recFile);
5353
while (true);
5454
} else {
55-
Serial.print(recFile);
56-
Serial.println(" created succesfully.");
55+
SerialUSB.print(recFile);
56+
SerialUSB.println(" created succesfully.");
5757
}
5858

5959
// Initialize header file
6060
status = WavProcess_EncInit(&WaveFormat, AUDIO_IN_FREQUENCY, pHeaderBuff);
6161
if( status != 0 ) {
62-
Serial.print("Error: could not encode wav header: ");
63-
Serial.println(status, DEC);
64-
while (true);
62+
SerialUSB.print("Error: could not encode wav header: ");
63+
SerialUSB.println(status, DEC);
64+
while (true);
6565
}
6666
if (myFile.write(pHeaderBuff, sizeof(pHeaderBuff)) != sizeof(pHeaderBuff)){
67-
Serial.print("Error: could not write header to ");
68-
Serial.println(recFile);
67+
SerialUSB.print("Error: could not write header to ");
68+
SerialUSB.println(recFile);
6969
while (true);
7070
}
7171

7272
delay(1000);
73-
Serial.println("Start AUDIO record");
73+
SerialUSB.println("Start AUDIO record");
7474
delay(1000);
7575
status = Audio.begin(WaveFormat.SampleRate, 100, AUDIO_IN);
7676
if (status != 0) {
77-
Serial.print("Error: Audio could not begin: ");
78-
Serial.println(status, DEC);
77+
SerialUSB.print("Error: Audio could not begin: ");
78+
SerialUSB.println(status, DEC);
7979
while (true);
8080
} else {
81-
Serial.println("Audio begin: OK");
81+
SerialUSB.println("Audio begin: OK");
8282
}
8383

8484
delay(1000);
@@ -87,42 +87,42 @@ void loop() {
8787
int volume = 100;
8888
Audio.prepare(NULL, S, volume);
8989
delay(1000);
90-
90+
9191
// MAX Recording time reached, so stop audio interface and close file
9292
while ( Audio.getSampleIn() < REC_SAMPLE_LENGTH) {
9393
if ( Audio.isBufferInFull()) {
9494
byteswritten = myFile.write((uint8_t*)Audio.getBufferInWithOffset(), Audio.getBufferInSize());
9595
Audio.setBufferInEmpty(byteswritten);
9696
}
97-
97+
9898
// Display percent of recording every 5%
9999
if ( ((Audio.getSampleIn() / RECORD_5PERCENT) - count) == 1)
100-
{
100+
{
101101
count++;
102-
Serial.print(5*count, DEC);
103-
Serial.println("%");
102+
SerialUSB.print(5*count, DEC);
103+
SerialUSB.println("%");
104104
}
105-
105+
106106
}
107-
107+
108108
// Update wav header file
109109
if (myFile.seek(0) == TRUE)
110110
{
111111
// Update the wav file header and save it into wav file
112112
WavProcess_HeaderUpdate(pHeaderBuff, Audio.getSampleIn());
113113
if (myFile.write(pHeaderBuff, sizeof(pHeaderBuff)) != sizeof(pHeaderBuff)){
114-
Serial.print("Error: header not updated to ");
115-
Serial.println(recFile);
114+
SerialUSB.print("Error: header not updated to ");
115+
SerialUSB.println(recFile);
116116
while (true);
117117
}
118118
}
119119
else
120120
{
121-
Serial.println("Error: could not update wav header.");
121+
SerialUSB.println("Error: could not update wav header.");
122122
while (true);
123123
}
124124

125-
Serial.println("End of recording. Thank you!");
125+
SerialUSB.println("End of recording. Thank you!");
126126
Audio.end();
127127
myFile.close();
128128
while(1);

0 commit comments

Comments
 (0)