8000 Merge branch 'master' into SharedUartISR · esp8266/Arduino@6b87398 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6b87398

Browse files
authored
Merge branch 'master' into SharedUartISR
2 parents ae7903d + dc03293 commit 6b87398

38 files changed

+503
-289
lines changed

.travis.yml

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,50 +20,69 @@ stages:
2020
jobs:
2121
include:
2222
# Build stage. To save time, run all kinds of builds and tests in parallel.
23-
- name: "Host tests"
24-
stage: build
25-
script: $TRAVIS_BUILD_DIR/tests/ci/host_test.sh
26-
install: sudo apt-get install valgrind lcov
27-
2823
# TODO: since we can now call different script for each job,
2924
# split the do-it-all common.sh into separate scripts responsible
3025
# for different types of jobs below:
26+
- name: "Platformio (1)"
27+
stage: build
28+
script: $TRAVIS_BUILD_DIR/tests/common.sh
29+
env:
30+
- BUILD_TYPE=platformio_even
31+
- name: "Platformio (2)"
32+
stage: build
33+
script: $TRAVIS_BUILD_DIR/tests/common.sh
34+
env:
35+
- BUILD_TYPE=platformio_odd
3136
- name: "Build (1)"
37+
stage: build
3238
script: $TRAVIS_BUILD_DIR/tests/common.sh
3339
env:
3440
- BUILD_TYPE=build_even
3541
- name: "Build (2)"
42+
stage: build
3643
script: $TRAVIS_BUILD_DIR/tests/common.sh
3744
env:
3845
- BUILD_TYPE=build_odd
3946
- name: "Debug (1)"
47+
stage: build
4048
script: $TRAVIS_BUILD_DIR/tests/common.sh
4149
env:
4250
- BUILD_TYPE=debug_even
4351
- name: "Debug (2)"
52+
stage: build
4453
script: $TRAVIS_BUILD_DIR/tests/common.sh
4554
env:
4655
- BUILD_TYPE=debug_odd
47-
- name: "Platformio (1)"
56+
- name: "Build IPv6 (1)"
57+
stage: build
4858
script: $TRAVIS_BUILD_DIR/tests/common.sh
4959
env:
50-
- BUILD_TYPE=platformio_even
51-
- name: "Platformio (2)"
60+
- BUILD_TYPE=build6_even
61+
- name: "Build IPv6 (2)"
62+
stage: build
5263
script: $TRAVIS_BUILD_DIR/tests/common.sh
5364
env:
54-
- BUILD_TYPE=platformio_odd
65+
- BUILD_TYPE=build6_odd
66+
67+
- name: "Host tests"
68+
stage: build
69+
script: $TRAVIS_BUILD_DIR/tests/ci/host_test.sh
70+
install: sudo apt-get install valgrind lcov
5571

5672
- name: "Docs"
73+
stage: build
5774
script: $TRAVIS_BUILD_DIR/tests/ci/build_docs.sh
5875
install:
5976
- sudo apt-get install python3-pip
6077
- pip3 install --user -r doc/requirements.txt;
6178

6279
- name: "Style check"
80+
stage: build
6381
script: $TRAVIS_BUILD_DIR/tests/ci/style_check.sh
6482
install: tests/ci/install_astyle.sh
6583

6684
- name: "Boards"
85+
stage: build
6786
script: $TRAVIS_BUILD_DIR/tests/ci/build_boards.sh
6887

6988
# Deploy stage.

cores/esp8266/HardwareSerial.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <stdio.h>
2828
#include <string.h>
2929
#include <inttypes.h>
30+
#include <PolledTimeout.h>
3031
#include "Arduino.h"
3132
#include "HardwareSerial.h"
3233
#include "Esp.h"
@@ -132,6 +133,22 @@ unsigned long HardwareSerial::detectBaudrate(time_t timeoutMillis)
132133
return detectedBaudrate;
133134
}
134135

136+
size_t HardwareSerial::readBytes(char* buffer, size_t size)
137+
{
138+
size_t got = 0;
139+
140+
while (got < size)
141+
{
142+
esp8266::polledTimeout::oneShot timeOut(_timeout);
143+
size_t avail;
144+
while ((avail = available()) == 0 && !timeOut);
145+
if (avail == 0)
146+
break;
147+
got += read(buffer + got, std::min(size - got, avail));
148+
}
149+
return got;
150+
}
151+
135152
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SERIAL)
136153
HardwareSerial Serial(UART0);
137154
#endif

cores/esp8266/HardwareSerial.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,15 @@ class HardwareSerial: public Stream
132132
// return -1 when data is unvailable (arduino api)
133133
return uart_read_char(_uart);
134134
}
135-
size_t readBytes(char* buffer, size_t size) override
135+
// ::read(buffer, size): same as readBytes without timeout
136+
size_t read(char* buffer, size_t size)
136137
{
137138
return uart_read(_uart, buffer, size);
138139
}
140+
size_t readBytes(char* buffer, size_t size) override;
139141
size_t readBytes(uint8_t* buffer, size_t size) override
140142
{
141-
return uart_read(_uart, (char*)buffer, size);
143+
return readBytes((char*)buffer, size);
142144
}
143145
int availableForWrite(void)
144146
{

cores/esp8266/IPAddress.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,6 @@ const IPAddress INADDR_NONE(255,255,255,255);
187187

188188
#if LWIP_IPV6
189189

190-
IPAddress::IPAddress(const ip_addr_t* from)
191-
{
192-
ip_addr_copy(_ip, *from);
193-
}
194-
195190
bool IPAddress::fromString6(const char *address) {
196191
// TODO: test test test
197192

cores/esp8266/IPAddress.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ class IPAddress: public Printable {
149149
/*
150150
lwIP address compatibility
151151
*/
152+
IPAddress(const ipv4_addr& fw_addr) { setV4(); v4() = fw_addr.addr; }
152153
IPAddress(const ipv4_addr* fw_addr) { setV4(); v4() = fw_addr->addr; }
153-
IPAddress(const ip_addr_t& lwip_addr) { _ip = lwip_addr; }
154154

155155
operator ip_addr_t () const { return _ip; }
156156
operator const ip_addr_t*() const { return &_ip; }
@@ -163,7 +163,8 @@ class IPAddress: public Printable {
163163

164164
#if LWIP_IPV6
165165

166-
IPAddress(const ip_addr_t* from);
166+
IPAddress(const ip_addr_t& lwip_addr) { ip_addr_copy(_ip, lwip_addr); }
167+
IPAddress(const ip_addr_t* lwip_addr) { ip_addr_copy(_ip, *lwip_addr); }
167168

168169
uint16_t* raw6()
169170
{

0 commit comments

Comments
 (0)
0