1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-16 11:21:18 +03:00
Commit Graph

1639 Commits

Author SHA1 Message Date
764f24266e Further optimize SoftwareSerial::write
This change restructures the loop, to help the compiler generate shorter
code (because now only the LSB of the data byte is checked and
subsequent bytes are shifted down one by one, it can use th "skip if bit
set" instruction).

Furthermore, it puts most attributes in local variables, which causes
the compiler to put them into registers. This makes the timing-critical
part of the code smaller, making it easier to provide accurate timings.

On an Arduino uno using gcc 4.3, this saves 58 bytes. On gcc 4.8, this
saves 14 bytes.
2015-01-26 17:03:25 +01:00
80ea38b1dc Mark SoftwareSerial::tx_pin_write as "always_inline"
Somehow gcc 4.8 doesn't inline this function, even though it is always
called with constant arguments and can be reduced to just a few
instructions when inlined. Adding the always_inline attribute makes gcc
inline it, saving 46 bytes on the Arduino uno.

gcc 4.3 already inlined this function, so there are no space
savings there.
2015-01-26 17:03:25 +01:00
416198a03b Simplify SoftwareSerial::write
Before, there was nearly identical code for the inverted and regular
cases. However, simply inverting the byte in the inverted case allows
using the regular code twice, reducing the generated code size by 100
bytes (on an Arduino Uno and gcc 4.3, on gcc 4.8 the reduction is 50
bytes).
2015-01-26 17:03:25 +01:00
6685aa999c Use stopListening() in SoftwareSerial::end()
stopListening also disabled the interrupt, if needed, so calling that
function makes more sense. Since stopListening only disables the
interrupt when the current SoftwareSerial is the active object, and that
can only be the case when _rx_delay_stopbit is non-zero, there is no
need to separately check _rx_delay_stopbit anymore.
2015-01-26 17:03:25 +01:00
f3aa5f23c4 Fix race condition in SoftwareSerial::overflow()
If an interrupt causing overflow would occur between reading
_buffer_overflow and clearing it, this overflow condition would be
immediately cleared and never be returned by overflow().

By only clearing the overflow flag if an overflow actually occurred,
this problem goes away (worst case overflow() returns false even though
an overflow _just_ occurred, but then the next call to overflow() will
return true).
2015-01-26 17:03:25 +01:00
b1de3e6621 Toggle SoftwareSerial interrupts when starting / stopping to listen
This prevents interrupts from triggering when the SoftwareSerial
instance is not even listening.

Additionally, this removes the need to disable interrupts in
SoftwareSerial::listen, since no interrupts are active while it touches
the variables.
2015-01-26 17:03:25 +01:00
934393398b Add SoftwareSerial::stopListening()
This allows one to explicitly stop a SoftwareSerial instance from
listening, without having to make another one listening.
2015-01-26 17:03:25 +01:00
db1a4ad139 Add SoftwareSerial::setRxIntMsk()
This moves the interrupt mask enabling / disabling code into a separate
method, so we can call it from multiple spots next.
2015-01-26 17:03:25 +01:00
1704e7e820 Let SoftwareSerial::end also check against _rx_delay_stopbit
The current check is still always false when the old check was, but
additionally it will not disable the interrupts when they were never
enabled (which shouldn't matter much, but this is more consistent).
2015-01-26 17:03:24 +01:00
b1c7a3d05f Let SoftwareSerial::listen() fail on invalid rx baud rates
In this case, SoftwareSerial::begin will not have enabled the
interrupts, so better not allow the SoftwareSerial instance to enter the
listening state either.
2015-01-26 17:03:24 +01:00
937cc51c69 Clear SoftwareSerial rx delay if no interrupt register is found
Before enabling interupts, begin would see if the given receive pin
actually has an associated PCINT register. If not, the interrupts would
not be enabled.

Now, the same check is done, but when no register is available, the rx
parameters are not loaded at all (which in turn prevents the interrupt
from being enabled). This allows all code to use the same "is rx
enabled" (which will be added next).
2015-01-26 17:03:24 +01:00
95f969cb7c Merge branch 'master' into esp8266
* master: (148 commits)
  Update revision log
  Cherry picked fix from 87865ac19d
  Updated revision log
  Added dependencies for AStylej.dll
  Updated translations
  Update revision log
  Temporary fix for pulseIn() regression.
  Added README.adoc for the library manager project
  Fixed some libraries metadata.
  Temporary disabled DefaultTargetTest under certain conditions
  Updated translation from transifex
  Updated some translation strings
  Fixed test
  sam: Fixed initialization of UART/USART mode register
  update revision log
  Fixed NPE when import menu are empty
  Fixed NPE when currently selected platform is no more installed.
  Optimized FileUtils.recursiveDelete(File) function
  Fixed a bunch of simple warnings in java code
  Removed unused classes Commander.java and Webserver.java
  ...
2015-01-26 02:35:02 +03:00
0757396bb3 Add functions for direct IO register access 2015-01-26 02:08:26 +03:00
28bfe331d5 Fix typo, add mode keyword for ESP8266WiFi, remove .bss section from sketch flash size calculation 2015-01-25 22:44:49 +03:00
83f7490cc2 Add WIP SPI library 2015-01-21 04:19:04 +03:00
4727a665bc Use i2c instead of serial for wifio virtual io 2015-01-21 04:17:03 +03:00
27bbeb36ae Move i2c files into core, fix some issues with i2c 2015-01-21 04:13:18 +03:00
0e013406bc Merge branch 'sam-usart-mode-fix' into ide-1.5.x 2015-01-19 13:43:42 +01:00
8ddc5198f6 Temporary fix for pulseIn() regression.
Fixes #2538
2015-01-18 17:34:40 +01:00
7528aca28a Use initVariant for wifio board 2015-01-17 16:35:54 +03:00
748c52996e Update esptool to the latest version 2015-01-17 02:52:50 +03:00
d3c7d0c8b8 Define esp pins E0..E16 for both board variants 2015-01-17 02:51:58 +03:00
abbe858545 Create another board variant 2015-01-16 22:52:19 +03:00
22b3aebdcd Define wiring functions as weak
This way they can be redefined in board variants, allowing for port expansion
2015-01-16 22:46:43 +03:00
d3e4d6d9e3 Add remoteIP and remotePort methods to WiFiClient 2015-01-16 17:56:11 +03:00
5b4e6aca37 GPIO16 support for pinMode, digitalRead, and digitalWrite 2015-01-16 17:55:09 +03:00
5cd194b694 Add more pin mux definitions to eagle_soc.h 2015-01-16 17:53:53 +03:00
2c80d6b7b3 Fix HardwareSerial initialization and interrupt handling
RXD pin was not configured properly
2015-01-16 17:29:58 +03:00
e594bd9746 Fix esp8266 HardwareSerial::flush
HardwareSerial::flush discarded data instead of waiting for it to be sent
2015-01-16 17:28:36 +03:00
00f23d3aad sam: Fixed initialization of UART/USART mode register 2015-01-14 00:08:59 +01:00
2522b059a1 Fix call to tcp_recved after pcb has been closed, abort connections closed by the remote side 2015-01-13 09:10:32 +03:00
5b3a85af6f Fix millis rollover 2015-01-13 08:23:36 +03:00
fbb54e00c2 Update board definitions and esptool usage 2015-01-11 02:48:06 +03:00
7e9cf6d612 sam: updated UART/USART modes 2015-01-09 20:25:09 +00:00
be4642b1d4 Fix license headers in WiFiUDP files 2015-01-09 22:47:07 +03:00
5741c8868c Report flash memory size used by the sketch 2015-01-09 22:43:25 +03:00
78a0b12ed9 Add method to use GPIO13 and GPIO15 as UART RX and TX 2015-01-09 02:33:42 +03:00
15b304efc3 Initial UDP support 2015-01-09 02:10:20 +03:00
2dd0b500ca Remove unused rx_buffer_size argument from WebServer constructor 2015-01-08 00:39:46 +03:00
20ac20f629 Arduino custom type boolean is now mapped to bool type
Fixes #2151
Fixes #2147
2015-01-07 14:56:19 +01:00
e9b7e817d5 Automatically call yield() in WiFiClient::available and WiFiServer::available 2015-01-07 02:45:46 +03:00
8f5ec89b26 Fix WiFi::softAPIP and keywords for ESP8266WiFi library 2015-01-07 02:09:55 +03:00
73bacdd32c Automatically call yield() in WiFiClient::available if called more than once 2015-01-07 01:57:41 +03:00
a8038bd104 Add pgmspace stubs to improve compatibility with AVR libraries 2015-01-07 01:55:27 +03:00
5e97168fbc sam: USART modes now fails if used on UART 2015-01-06 15:47:44 +01:00
37ea166e19 sam: refined UART/USART class inheritance
Let Usart inherit all methods from Uart.
2015-01-05 15:35:32 +01:00
16d836108f sam: fix code format and indent in UART/USART class 2015-01-05 15:34:09 +01:00
cabfd8ed21 Fixed flush so that it actually is sure to flush all outstanding data. 2015-01-04 13:37:28 -05:00
76280e8778 Correct an issue where write could send data out of order. 2014-12-31 08:42:26 -05:00
7207da6be4 WiFiClient cleanup 2014-12-29 10:37:11 +03:00