Skip to content

Commit 3dc81f2

Browse files
committed
Merge pull request #60 from Links2004/esp8266
add more libc functions, fix possible null prt, force close of tcp on error, fix printf / serial.print mix problems, code style
2 parents 7b54e83 + 67f784b commit 3dc81f2

40 files changed

+3393
-3391
lines changed

hardware/esp8266com/esp8266/cores/esp8266/Arduino.h

+15-16
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
/*
2-
Arduino.h - Main include file for the Arduino SDK
3-
Copyright (c) 2005-2013 Arduino Team. All right reserved.
2+
Arduino.h - Main include file for the Arduino SDK
3+
Copyright (c) 2005-2013 Arduino Team. All right reserved.
44
5-
This library is free software; you can redistribute it and/or
6-
modify it under the terms of the GNU Lesser General Public
7-
License as published by the Free Software Foundation; either
8-
version 2.1 of the License, or (at your option) any later version.
5+
This library is free software; you can redistribute it and/or
6+
modify it under the terms of the GNU Lesser General Public
7+
License as published by the Free Software Foundation; either
8+
version 2.1 of the License, or (at your option) any later version.
99
10-
This library is distributed in the hope that it will be useful,
11-
but WITHOUT ANY WARRANTY; without even the implied warranty of
12-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13-
Lesser General Public License for more details.
10+
This library is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
Lesser General Public License for more details.
1414
15-
You should have received a copy of the GNU Lesser General Public
16-
License along with this library; if not, write to the Free Software
17-
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18-
*/
15+
You should have received a copy of the GNU Lesser General Public
16+
License along with this library; if not, write to the Free Software
17+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18+
*/
1919

2020
#ifndef Arduino_h
2121
#define Arduino_h
@@ -30,7 +30,7 @@
3030
#include "pgmspace.h"
3131

3232
#ifdef __cplusplus
33-
extern "C"{
33+
extern "C" {
3434
#endif
3535

3636
void yield(void);
@@ -144,7 +144,6 @@ volatile uint32_t* portOutputRegister(uint32_t port);
144144
volatile uint32_t* portInputRegister(uint32_t port);
145145
volatile uint32_t* portModeRegister(uint32_t port);
146146

147-
148147
#define NOT_A_PIN 0
149148
#define NOT_A_PORT 0
150149
#define NOT_AN_INTERRUPT -1
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,48 @@
11
/*
2-
Client.h - Base class that provides Client
3-
Copyright (c) 2011 Adrian McEwen. All right reserved.
2+
Client.h - Base class that provides Client
3+
Copyright (c) 2011 Adrian McEwen. All right reserved.
44
5-
This library is free software; you can redistribute it and/or
6-
modify it under the terms of the GNU Lesser General Public
7-
License as published by the Free Software Foundation; either
8-
version 2.1 of the License, or (at your option) any later version.
5+
This library is free software; you can redistribute it and/or
6+
modify it under the terms of the GNU Lesser General Public
7+
License as published by the Free Software Foundation; either
8+
version 2.1 of the License, or (at your option) any later version.
99
10-
This library is distributed in the hope that it will be useful,
11-
but WITHOUT ANY WARRANTY; without even the implied warranty of
12-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13-
Lesser General Public License for more details.
10+
This library is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
Lesser General Public License for more details.
1414
15-
You should have received a copy of the GNU Lesser General Public
16-
License along with this library; if not, write to the Free Software
17-
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18-
*/
15+
You should have received a copy of the GNU Lesser General Public
16+
License along with this library; if not, write to the Free Software
17+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18+
*/
1919

2020
#ifndef client_h
2121
#define client_h
2222
#include "Print.h"
2323
#include "Stream.h"
2424
#include "IPAddress.h"
2525

26-
class Client : public Stream {
26+
class Client: public Stream {
2727

28-
public:
29-
virtual int connect(IPAddress ip, uint16_t port) =0;
30-
virtual int connect(const char *host, uint16_t port) =0;
31-
virtual size_t write(uint8_t) =0;
32-
virtual size_t write(const uint8_t *buf, size_t size) =0;
33-
virtual int available() = 0;
34-
virtual int read() = 0;
35-
virtual int read(uint8_t *buf, size_t size) = 0;
36-
virtual int peek() = 0;
37-
virtual void flush() = 0;
38-
virtual void stop() = 0;
39-
virtual uint8_t connected() = 0;
40-
virtual operator bool() = 0;
41-
protected:
42-
uint8_t* rawIPAddress(IPAddress& addr) { return addr.raw_address(); };
28+
public:
29+
virtual int connect(IPAddress ip, uint16_t port) =0;
30+
virtual int connect(const char *host, uint16_t port) =0;
31+
virtual size_t write(uint8_t) =0;
32+
virtual size_t write(const uint8_t *buf, size_t size) =0;
33+
virtual int available() = 0;
34+
virtual int read() = 0;
35+
virtual int read(uint8_t *buf, size_t size) = 0;
36+
virtual int peek() = 0;
37+
virtual void flush() = 0;
38+
virtual void stop() = 0;
39+
virtual uint8_t connected() = 0;
40+
virtual operator bool() = 0;
41+
protected:
42+
uint8_t* rawIPAddress(IPAddress& addr) {
43+
return addr.raw_address();
44+
}
45+
;
4346
};
4447

4548
#endif

0 commit comments

Comments
 (0)