Skip to content

Commit c92b617

Browse files
leresme-no-dev
authored andcommitted
Convert the few remaining cr/lf files to use lf for eol. (espressif#1316)
If you develop on windows and need cr/lf files, see this: https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#_formatting_and_whitespace Git can handle this by auto-converting CRLF line endings into LF when you add a file to the index, and vice versa when it checks out code onto your filesystem. You can turn on this functionality with the core.autocrlf setting. If you're on a Windows machine, set it to true - this converts LF endings into CRLF when you check out code: $ git config --global core.autocrlf true
1 parent 1da3138 commit c92b617

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+9773
-9773
lines changed

Diff for: .gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ tools/esptool
44
tools/esptool.exe
55
tools/mkspiffs/mkspiffs
66
tools/mkspiffs/mkspiffs.exe
7-
.DS_Store
7+
.DS_Store

Diff for: cores/esp32/HardwareSerial.cpp

+110-110
Original file line numberDiff line numberDiff line change
@@ -1,110 +1,110 @@
1-
#include <stdlib.h>
2-
#include <stdio.h>
3-
#include <string.h>
4-
#include <inttypes.h>
5-
6-
#include "HardwareSerial.h"
7-
8-
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SERIAL)
9-
HardwareSerial Serial(0);
10-
#endif
11-
12-
HardwareSerial::HardwareSerial(int uart_nr) : _uart_nr(uart_nr), _uart(NULL) {}
13-
14-
void HardwareSerial::begin(unsigned long baud, uint32_t config, int8_t rxPin, int8_t txPin, bool invert)
15-
{
16-
if(0 > _uart_nr || _uart_nr > 2) {
17-
log_e("Serial number is invalid, please use 0, 1 or 2");
18-
return;
19-
}
20-
if(_uart) {
21-
end();
22-
}
23-
if(_uart_nr == 0 && rxPin < 0 && txPin < 0) {
24-
rxPin = 3;
25-
txPin = 1;
26-
}
27-
if(_uart_nr == 1 && rxPin < 0 && txPin < 0) {
28-
rxPin = 9;
29-
txPin = 10;
30-
}
31-
if(_uart_nr == 2 && rxPin < 0 && txPin < 0) {
32-
rxPin = 16;
33-
txPin = 17;
34-
}
35-
_uart = uartBegin(_uart_nr, baud, config, rxPin, txPin, 256, invert);
36-
}
37-
38-
void HardwareSerial::end()
39-
{
40-
if(uartGetDebug() == _uart_nr) {
41-
uartSetDebug(0);
42-
}
43-
uartEnd(_uart);
44-
_uart = 0;
45-
}
46-
47-
void HardwareSerial::setDebugOutput(bool en)
48-
{
49-
if(_uart == 0) {
50-
return;
51-
}
52-
if(en) {
53-
uartSetDebug(_uart);
54-
} else {
55-
if(uartGetDebug() == _uart_nr) {
56-
uartSetDebug(0);
57-
}
58-
}
59-
}
60-
61-
int HardwareSerial::available(void)
62-
{
63-
return uartAvailable(_uart);
64-
}
65-
int HardwareSerial::availableForWrite(void)
66-
{
67-
return uartAvailableForWrite(_uart);
68-
}
69-
70-
int HardwareSerial::peek(void)
71-
{
72-
if (available()) {
73-
return uartPeek(_uart);
74-
}
75-
return -1;
76-
}
77-
78-
int HardwareSerial::read(void)
79-
{
80-
if(available()) {
81-
return uartRead(_uart);
82-
}
83-
return -1;
84-
}
85-
86-
void HardwareSerial::flush()
87-
{
88-
uartFlush(_uart);
89-
}
90-
91-
size_t HardwareSerial::write(uint8_t c)
92-
{
93-
uartWrite(_uart, c);
94-
return 1;
95-
}
96-
97-
size_t HardwareSerial::write(const uint8_t *buffer, size_t size)
98-
{
99-
uartWriteBuf(_uart, buffer, size);
100-
return size;
101-
}
102-
uint32_t HardwareSerial::baudRate()
103-
104-
{
105-
return uartGetBaudRate(_uart);
106-
}
107-
HardwareSerial::operator bool() const
108-
{
109-
return true;
110-
}
1+
#include <stdlib.h>
2+
#include <stdio.h>
3+
#include <string.h>
4+
#include <inttypes.h>
5+
6+
#include "HardwareSerial.h"
7+
8+
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SERIAL)
9+
HardwareSerial Serial(0);
10+
#endif
11+
12+
HardwareSerial::HardwareSerial(int uart_nr) : _uart_nr(uart_nr), _uart(NULL) {}
13+
14+
void HardwareSerial::begin(unsigned long baud, uint32_t config, int8_t rxPin, int8_t txPin, bool invert)
15+
{
16+
if(0 > _uart_nr || _uart_nr > 2) {
17+
log_e("Serial number is invalid, please use 0, 1 or 2");
18+
return;
19+
}
20+
if(_uart) {
21+
end();
22+
}
23+
if(_uart_nr == 0 && rxPin < 0 && txPin < 0) {
24+
rxPin = 3;
25+
txPin = 1;
26+
}
27+
if(_uart_nr == 1 && rxPin < 0 && txPin < 0) {
28+
rxPin = 9;
29+
txPin = 10;
30+
}
31+
if(_uart_nr == 2 && rxPin < 0 && txPin < 0) {
32+
rxPin = 16;
33+
txPin = 17;
34+
}
35+
_uart = uartBegin(_uart_nr, baud, config, rxPin, txPin, 256, invert);
36+
}
37+
38+
void HardwareSerial::end()
39+
{
40+
if(uartGetDebug() == _uart_nr) {
41+
uartSetDebug(0);
42+
}
43+
uartEnd(_uart);
44+
_uart = 0;
45+
}
46+
47+
void HardwareSerial::setDebugOutput(bool en)
48+
{
49+
if(_uart == 0) {
50+
return;
51+
}
52+
if(en) {
53+
uartSetDebug(_uart);
54+
} else {
55+
if(uartGetDebug() == _uart_nr) {
56+
uartSetDebug(0);
57+
}
58+
}
59+
}
60+
61+
int HardwareSerial::available(void)
62+
{
63+
return uartAvailable(_uart);
64+
}
65+
int HardwareSerial::availableForWrite(void)
66+
{
67+
return uartAvailableForWrite(_uart);
68+
}
69+
70+
int HardwareSerial::peek(void)
71+
{
72+
if (available()) {
73+
return uartPeek(_uart);
74+
}
75+
return -1;
76+
}
77+
78+
int HardwareSerial::read(void)
79+
{
80+
if(available()) {
81+
return uartRead(_uart);
82+
}
83+
return -1;
84+
}
85+
86+
void HardwareSerial::flush()
87+
{
88+
uartFlush(_uart);
89+
}
90+
91+
size_t HardwareSerial::write(uint8_t c)
92+
{
93+
uartWrite(_uart, c);
94+
return 1;
95+
}
96+
97+
size_t HardwareSerial::write(const uint8_t *buffer, size_t size)
98+
{
99+
uartWriteBuf(_uart, buffer, size);
100+
return size;
101+
}
102+
uint32_t HardwareSerial::baudRate()
103+
104+
{
105+
return uartGetBaudRate(_uart);
106+
}
107+
HardwareSerial::operator bool() const
108+
{
109+
return true;
110+
}

Diff for: cores/esp32/StreamString.cpp

+71-71
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,71 @@
1-
/**
2-
StreamString.cpp
3-
4-
Copyright (c) 2015 Markus Sattler. All rights reserved.
5-
6-
This library is free software; you can redistribute it and/or
7-
modify it under the terms of the GNU Lesser General Public
8-
License as published by the Free Software Foundation; either
9-
version 2.1 of the License, or (at your option) any later version.
10-
11-
This library is distributed in the hope that it will be useful,
12-
but WITHOUT ANY WARRANTY; without even the implied warranty of
13-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14-
Lesser General Public License for more details.
15-
16-
You should have received a copy of the GNU Lesser General Public
17-
License along with this library; if not, write to the Free Software
18-
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19-
20-
*/
21-
22-
#include <Arduino.h>
23-
#include "StreamString.h"
24-
25-
size_t StreamString::write(const uint8_t *data, size_t size)
26-
{
27-
if(size && data) {
28-
if(reserve(length() + size + 1)) {
29-
memcpy((void *) (buffer + len), (const void *) data, size);
30-
len += size;
31-
*(buffer + len) = 0x00; // add null for string end
32-
return size;
33-
}
34-
}
35-
return 0;
36-
}
37-
38-
size_t StreamString::write(uint8_t data)
39-
{
40-
return concat((char) data);
41-
}
42-
43-
int StreamString::available()
44-
{
45-
return length();
46-
}
47-
48-
int StreamString::read()
49-
{
50-
if(length()) {
51-
char c = charAt(0);
52-
remove(0, 1);
53-
return c;
54-
55-
}
56-
return -1;
57-
}
58-
59-
int StreamString::peek()
60-
{
61-
if(length()) {
62-
char c = charAt(0);
63-
return c;
64-
}
65-
return -1;
66-
}
67-
68-
void StreamString::flush()
69-
{
70-
}
71-
1+
/**
2+
StreamString.cpp
3+
4+
Copyright (c) 2015 Markus Sattler. All rights reserved.
5+
6+
This library is free software; you can redistribute it and/or
7+
modify it under the terms of the GNU Lesser General Public
8+
License as published by the Free Software Foundation; either
9+
version 2.1 of the License, or (at your option) any later version.
10+
11+
This library is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+
Lesser General Public License for more details.
15+
16+
You should have received a copy of the GNU Lesser General Public
17+
License along with this library; if not, write to the Free Software
18+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19+
20+
*/
21+
22+
#include <Arduino.h>
23+
#include "StreamString.h"
24+
25+
size_t StreamString::write(const uint8_t *data, size_t size)
26+
{
27+
if(size && data) {
28+
if(reserve(length() + size + 1)) {
29+
memcpy((void *) (buffer + len), (const void *) data, size);
30+
len += size;
31+
*(buffer + len) = 0x00; // add null for string end
32+
return size;
33+
}
34+
}
35+
return 0;
36+
}
37+
38+
size_t StreamString::write(uint8_t data)
39+
{
40+
return concat((char) data);
41+
}
42+
43+
int StreamString::available()
44+
{
45+
return length();
46+
}
47+
48+
int StreamString::read()
49+
{
50+
if(length()) {
51+
char c = charAt(0);
52+
remove(0, 1);
53+
return c;
54+
55+
}
56+
return -1;
57+
}
58+
59+
int StreamString::peek()
60+
{
61+
if(length()) {
62+
char c = charAt(0);
63+
return c;
64+
}
65+
return -1;
66+
}
67+
68+
void StreamString::flush()
69+
{
70+
}
71+

0 commit comments

Comments
 (0)