aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2015-01-26Use stopListening() in SoftwareSerial::end()Matthijs Kooijman
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-26Fix race condition in SoftwareSerial::overflow()Matthijs Kooijman
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-26Toggle SoftwareSerial interrupts when starting / stopping to listenMatthijs Kooijman
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-26Add SoftwareSerial::stopListening()Matthijs Kooijman
This allows one to explicitly stop a SoftwareSerial instance from listening, without having to make another one listening.
2015-01-26Add SoftwareSerial::setRxIntMsk()Matthijs Kooijman
This moves the interrupt mask enabling / disabling code into a separate method, so we can call it from multiple spots next.
2015-01-26Let SoftwareSerial::end also check against _rx_delay_stopbitMatthijs Kooijman
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-26Let SoftwareSerial::listen() fail on invalid rx baud ratesMatthijs Kooijman
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-26Clear SoftwareSerial rx delay if no interrupt register is foundMatthijs Kooijman
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-19Merge branch 'sam-usart-mode-fix' into ide-1.5.xCristian Maglie
2015-01-18Temporary fix for pulseIn() regression.Cristian Maglie
Fixes #2538
2015-01-07Arduino custom type boolean is now mapped to bool typeCristian Maglie
Fixes #2151 Fixes #2147
2014-12-02Merge branch 'master' into ide-1.5.xCristian Maglie
Conflicts: hardware/arduino/cores/arduino/wiring.c libraries/Ethernet/src/utility/util.h libraries/Ethernet/src/utility/w5100.cpp libraries/Ethernet/src/utility/w5100.h libraries/Ethernet/util.h libraries/Ethernet/utility/util.h libraries/SPI/SPI.cpp libraries/SPI/SPI.h
2014-12-02Backported 'yield()' hook from 1.5.xCristian Maglie
2014-11-25Fix atomicity issues in SPI::beginTransaction and SPI::endTransaction ↵Cristian Maglie
(Andrew Kroll) Previously, it could happen that SPI::beginTransaction was interrupted by an ISR, while it is changing the SPI_AVR_EIMSK register or interruptSave variable (it seems that there is a small window after changing SPI_AVR_EIMSK where an interrupt might still occur). If this happens, interruptSave is overwritten with an invalid value, permanently disabling the pin interrupts. To prevent this, disable interrupts globally while changing these values.
2014-11-25[avr] Made SPI.usingInterrupt() synchronized (Andrew Kroll)Cristian Maglie
2014-11-25[avr] Added SPI.notUsingInterrupt() (Andrew Kroll)Cristian Maglie
2014-11-25[avr] Made SPI.begin() and SPI.end() synchronized (Andrew Kroll)Cristian Maglie
2014-11-25[avr] Improved SPI speed on 16bit transfer.Cristian Maglie
From https://github.com/arduino/Arduino/pull/2376#issuecomment-59671152 Quoting Andrew Kroll: [..this commit..] introduces a small delay that can prevent the wait loop form iterating when running at the maximum speed. This gives you a little more speed, even if it seems counter-intuitive. At lower speeds, it is unnoticed. Watch the output on an oscilloscope when running full SPI speed, and you should see closer back-to-back writes. Quoting Paul Stoffregen: I did quite a bit of experimenting with the NOP addition. The one that's in my copy gives about a 10% speedup on AVR.
2014-11-18Upped version to 1.6.0Cristian Maglie
2014-11-14[avr] SPI: removed redundant includeCristian Maglie
2014-11-14[avr] Small comments and headers fixes in SPICristian Maglie
2014-10-30Reduce avrdude verbosityMatthijs Kooijman
Previously, when verbose uploads were enabled, avrdude was run with four -v options, causing it to dump all raw bytes exchanged with the bootloader. This floods the console so much that meaningful output mostly disappears. Most users probably want to enable verbose mode just to see what avrdude command is ran. Furthermore, users that benefit from the raw bytes dumped are perfectly capable of either running avrdude manually, or modifying platform.txt. Given that, running avrdude with just one -v should be plenty. This fixes #891.
2014-10-21Merge branch 'master' into ide-1.5.xCristian Maglie
Conflicts: hardware/arduino/cores/arduino/HardwareSerial.cpp hardware/arduino/cores/robot/Arduino.h
2014-10-21Revert "Match return value to type in available()"Cristian Maglie
This reverts commit f40e4713542fa862d5b99b256a642e001a796988. Added an hint for the buffer sizes. See #2057 Fixes #2367
2014-10-21Fixed missing NOT_AN_INTERRUPT constant in digitalPinToInterrupt()Cristian Maglie
Fixes #2379
2014-10-01Merge branch 'master' into ide-1.5.x. Updated revision log.Cristian Maglie
Conflicts: build/shared/examples/09.USB/Keyboard/KeyboardLogout/KeyboardLogout.ino hardware/arduino/boards.txt
2014-10-01Merge pull request #2330 from spiritinlife/ide-1.5.xCristian Maglie
Add #include "Print.h" in Server.h Ide 1.5.x
2014-09-26Add #include "Print.h" in Server.hGeorge Chailazopoulos
2014-09-21set correct max size for mega2560 (to address issue #2277)Arnav Gupta
Signed-off-by: Arnav Gupta <championswimmer@gmail.com>
2014-09-20set correct max size for mega2560Arnav Gupta
Signed-off-by: Arnav Gupta <championswimmer@gmail.com>
2014-09-16Merge branch 'master' into ide-1.5.xCristian Maglie
Conflicts: app/src/processing/app/Base.java build/build.xml todo.txt
2014-09-12Fixed trivial include error introduced in previous commit 2e3e539b... oops...Cristian Maglie
2014-09-12Merge pull request #2299 from cmaglie/ide-1.5.x-spi-updatesCristian Maglie
Missing SPI Transaction API methods on Due (SAM3X)
2014-09-12Added license to USBAPI.hCristian Maglie
Close #1847
2014-09-12Merge pull request #1937 from matthijskooijman/stringindexCristian Maglie
String index fixes and cleanups
2014-09-10Fix off-by-one in String::substringMatthijs Kooijman
When checking the `left` argument, it previously allowed having left == len. However, this means the substring starts one past the last character in the string and should return the empty string. In practice, this already worked correctly, because buffer[len] contains the trailing nul, so it would (re)assign the empty string to `out`. However, fixing this check makes it a bit more logical, and prevents a fairly unlikely out-of-buffer write (to address 0x0) when calling substring on an invalidated String: String bar = (char*)NULL; bar.substring(0, 0);
2014-09-10Merge pull request #2279 from cmaglie/fix-leo-upload-osx10.9.4Cristian Maglie
Fix for upload problems on Arduino Leonardo (and derivatives) on OSX 10.9
2014-09-10Simplify String::remove(unsigned int)Matthijs Kooijman
Previously, this method calculated the length of the string from the given index onwards. However, the other remove() method called already contains code for this calculation, which is used when the count passed in is too big. This means we can just pass in a very big count that is guaranteed to point past the end of the string, shrinking the remove method by a few bytes.
2014-09-10Fix bounds check in String::remove()Matthijs Kooijman
Previously, if you passed in a very big index and/or count, the `index + count` could overflow, making the count be used as-is instead of being truncated (causing the string to be updated wrongly and potentially writing to arbitrary memory locations). We can rewrite the comparison to use `len - index` instead. Since we know that index < len, we are sure this subtraction does not overflow, regardless of what values of index and count we pass in. As an added bonus, the `len - index` value already needed be calculated inside the if, so this saves a few instructions in the generated code. To illustrate this problem, consider this code: String foo = "foo"; Serial.println(foo.length()); // Prints 3 foo.remove(1, 65535); // Should remove all but first character Serial.println(foo.length()); // Prints 4 without this patch Not shown in this is example is that some arbitrary memory is written as well.
2014-09-10Remove unneeded check in String::remove(unsigned int)Matthijs Kooijman
This check already happens in the remove(unsigned int, unsigned int) method that is caled, so there is no need to also check this here.
2014-09-06Fixed license for new.cpp and small cosmetic changesCristian Maglie
2014-09-06Correct implementation of gcc specific internal functionsCristian Maglie
The following empty stubs has been replaced by the gcc flag -fno-threadsafe-static: int __cxa_guard_acquire(__guard *); void __cxa_guard_release (__guard *); void __cxa_guard_abort (__guard *); The following empty stubs has been moved into their specific module abi.cpp: void __cxa_pure_virtual(void) __attribute ((noreturn)); void __cxa_deleted_virtual(void) __attribute ((noreturn)); Fix #107
2014-09-06Printable.h doesn't need new.h but only stdlib.h for size_t.Cristian Maglie
Probalby new.h may be removed completely.
2014-09-05Updated version to 1.5.8Cristian Maglie
2014-09-01Fix for upload problems on Arduino Leonardo (and derivatives) with OSX 10.9.4Cristian Maglie
2014-08-25fix Descriptor.cqperez42@gmail.com
2014-08-08Merge branch 'master' into ide-1.5.xCristian Maglie
2014-08-08Added replacement stub for cstdlib atexit() funciton.Christopher Andrews
This is an empty stub to simply allow use of complex types with a non global static lifetime. For more complex handling the function 'atexit' can be redefined in user code. For more information see: https://github.com/arduino/Arduino/pull/2229 https://github.com/arduino/Arduino/issues/1919
2014-08-01SPI Transactions for AVRPaulStoffregen
2014-07-24Merge remote-tracking branch 'arduino/master' into ide-1.5.xCristian Maglie