aboutsummaryrefslogtreecommitdiff
path: root/cores
AgeCommit message (Collapse)Author
2020-09-17Call std::terminate on pure or deleted virtual functionsMatthijs Kooijman
These are special functions that are presumably put into vtables for deleted or pure virtual functions. Previously, this would call `abort()` directly, but calling `std::terminate()` achieves the same effect, but allows user code to change the behavior (e.g. to print to serial, blink leds or whatever makes sense).
2020-09-17Add weak `std::terminate()` implementationMatthijs Kooijman
This allows calling it from other places later. The default implementation calls `abort()`, but making it weak allows user code to override this function (either directly, or by including a library like uclibc++ that implements `std::set_terminate()`). Note that this does not add a declaration for this function, since the standard dictates this to be in `<exception>`, but we cannot meaningfully or completely implement that header, so better leave it to be overridden by e.g. libraries like uclibc++.
2020-09-17Allow overriding selected operator new and delete functionsMatthijs Kooijman
This makes these functions weak, so that a sketch or library can replace them. This does not apply to all of these operators, only for the ones that the C++ standard specifies as replaceable.
2020-09-17Clean up and complete `<new>` headerMatthijs Kooijman
This makes this header complete up to including C++14, except two exception classes that cannot be defined without `<exception>`. The functions related to the "new_handler" are declared but not actually defined, to prevent overhead and complexity. They are still declared to allow implementing them in user code if needed. This makes the implementation of all operator new and delete functions comply with the C++11/C++14 specification in terms of which should be actually implemented and which should be delegate to other functions. There are still some areas where these implementations are not entirely standards-compliant, which will be fixed in subsequent commits. This fixes part of #287 and fixes #47.
2020-09-17Swap new and new.h header filesMatthijs Kooijman
Originally, the Arduino core used "new.h", rather than the standard "new", probably because the implementation was incomplete, and for the most commonly used new and delete operators, no include is needed at all (they are defined implicitly by the compiler). However, now Arduino does expose the "new" name, as an alias for the older "new.h". Given that the standard name is "new", it makes more sense to put the actual content in "new", and make "new.h" a compatibility header that includes "new" instead of the other way around.
2020-05-13Add "new" proxy header for compatibility with c++-standard #include<new>eudoxos
2020-05-02Update comment on wiring_analog.cMaximilian Leopold
2020-03-18Fix sine -> since typo in HardwareSerial filesDaniel Jackson
2019-09-25Interrupt ordering for 32u2 and 16u2 MCU (#66)Manuel Reimer
* Interrupt ordering for 32u2 and 16u2 MCU * Added missing chip variants
2019-09-16Merge pull request #4 from awatterott/masterAlexander Entinger
No fixed value for USB power current.
2019-09-16Merge pull request #82 from luco5826/masterAlexander Entinger
Minor optimization in shiftOut function
2019-09-16Merge pull request #95 from jrowberg/masterAlexander Entinger
Cast pins to signed integers to avoid Wtype-limits compile warning
2019-09-16Merge pull request #92 from matthijskooijman/cdc-no-prototocol-atAlexander Entinger
Do not claim AT-protocol in CDC interface descriptor
2019-09-16Merge branch 'master' into patch-1Alexander Entinger
2019-09-16Merge pull request #33 from Pharap/add-placement-newAlexander Entinger
Add placement new operator
2019-09-16Merge pull request #64 from paulrnash/paulrnash-intellisenseAlexander Entinger
Add parameter names to common prototypes
2019-09-16Adding parenthesis around 'bitvalue' allowing correct macro expansion when ↵Alexander Entinger
using with ternary operator such as bitWrite(value, bit, some_computed_value == 5 ? 1: 0);'
2019-09-16Merge pull request #76 from dmadison/pluggable-unusedAlexander Entinger
Fix unused variable warning for non-pluggable USB in SendDescriptor
2019-09-04remove unnecessary if branchAkihiro YAMAZAKI
checking `length` in below while statement
2019-07-29Add null pointer test to String destructorJeff Rowberg
2019-06-08Do not claim AT-protocol in CDC interface descriptorMatthijs Kooijman
The CDC code presents itself as a virtual serial port. However, it also sets the "bFunctionProtocol" value to 1, which means it supports AT-commands, which is not actually the case. This might cause problems with some software, such as ModemManager. Originally, ModemManager would be very liberal with probing serial devices, using a blacklist to prevent probing non-modems such as Arduinos. Since version 1.7.990, it has supported a "strict" mode where it tries to be more restrained in what devices it probes. For CDC ACM devices, this means it will only probe devices that claim to support AT-commands. However, it also stopped applying the blacklist (intending to eventually remove the blacklist), meaning it would again probe Arduinos. This new strict policy is not the upstream default, but is enabled in Debian (since Buster) and Ubuntu (since bionic 18.04.2). The proper way to fix this, is to not claim AT comand support in the USB device descriptor, which is what this commit does. The Arduino will still show up as a virtual serial port, just not be probed by ModemManager in strict mode. For the commit that introduced the strict mode in ModemManager, see https://cgit.freedesktop.org/ModemManager/ModemManager/commit/src?id=ee570d44dc117dc69f23e83313dd877f76c5e3e0
2019-04-26Fixed shiftOut in MSBFIRST mode HIGH/LOWluca
2019-04-26Minor optimization in shiftOut functionluca
2019-02-17Define descriptor return var in pluggable blockDavid Madison
Avoids unused variable warning if USB is enabled but pluggable USB is not
2019-01-21Add parameters names to common prototypesPaul R. Nash
Putting the parameter names in these commonly used prototypes makes syntax help like VS Code's Intellisense work 99% more useful. Without them, it doesn't give you the names of the parameters and you have to remember the semantics yourself. :(
2019-01-04Remove commented out code for I2C interrupts on WInterrupts.cPaulo Costa
These are currently implemented by the Wire library, on twi.c
2018-12-11Add USBDevice.isSuspended()Gergely Nagy
Based on code originally by Rob van der Veer <rob.c.veer@gmail.com>, this adds USBDevice.isSuspended(), so user sketches can run custom code in their `loop` methods after checking if the device is suspended or not. Signed-off-by: Gergely Nagy <algernon@keyboard.io>
2018-10-26Add noexcept specifier to placement new operatorPharap
The standard mandates that placement new should be have a noexcept specifier.
2018-08-18Prevent possible compiler warningPharap
Casting to void is a well known trick for prevening 'unused parameter' warnings.
2018-08-18Add placement new operatorPharap
2018-08-11Add `bitToggle` macro to complement `bitSet` etcShriramana Sharma
2017-12-18Fix MCUs without MPCM0 registerMartino Facchin
2017-11-13Fix flush hanging issueJohn Holman
Make write to UDR and clearing of TXC bit in flush() atomic to avoid race condition. Fixes #3745 (second different issue introduced later but discussed in the same issue)
2017-11-13Improve how TXCn bit is cleared in USCRnA registerJohn Holman
Preserve values of configuration bits MPCMn and U2Xn. Avoid setting other read-only bits for datasheet conformance. See #3745
2017-11-13Prevent buffer retransmission when transmit buffer is emptyJohn Holman
Moving the head buffer pointer and setting interrupt flag is now atomic in write(). Previously an intervening ISR could empty the buffer before the second ISR is triggered causing retransmission. Fixes: #3745 (original issue only)
2017-11-13Create macro to guard critical sections for large transmit buffersJohn Holman
New macro TX_BUFFER_ATOMIC makes the following code block atomic only if the transmit buffer is larger than 256 bytes. SREG is restored on completion. The macro is then used to simplify code for availableForWrite()
2017-11-13Always read key to check for new LUFA bootloaderScott Allen
Instead of checking for the NEW_LUFA_SIGNATURE once in program memory and then setting a flag which is used for further checks, a function is used that always checks program memory directly. If a flag is used, there's a slight chance that its location in RAM could fall on MAGIC_KEY_POS. In this case, an aborted USB auto-reset sequence may fail.
2017-11-13Don't use line coding to trigger USB auto-resetScott Allen
An auto-reset invoked using USB CDC is triggered by the port closing (when set to 1200 baud). Closing of the port is indicated by DTR going inactive. There is no need to have auto-reset invoked by a CDC_SET_LINE_CODING command. Only the CDC_SET_CONTROL_LINE_STATE command, which indicates a change in the state of DTR, should be used.
2017-11-13Save/restore the watchdog during USB auto-resetScott Allen
The state of the watchdog timer is saved during a USB auto-reset and then restored if the reset is aborted, in case the sketch is using the watchdog.
2017-11-13Fix save/restore of magic key location during resetScott Allen
In the USB CDC code to invoke an auto-reset, the magic key location could be restored before it had actually been saved. The sketch would then have a corrupted value at this location. This fix prevents the value from being restored if it hasn't previously been saved.
2017-11-13Create timer0 overflow interrupt service routine for all ATtinies not just ↵Torben Nielsen
24, 44 and 84
2017-11-13No fixed value for USB power current.Andreas Watterott
2017-07-07Update comments to reflect Stream functions changed from private to protectedper1234
These functions were changed from private to protected in https://github.com/arduino/Arduino/commit/99f2a2755349784835130147e46cb61659b85893 but the comments were not updated at that time. In conjunction with equivalent pull requests to Arduino SAM Boards and Arduino SAMD Boards, solves https://github.com/arduino/Arduino/issues/6146.
2017-05-23Removed unneeded include in Print.hCristian Maglie
see https://github.com/arduino/Arduino/pull/5789#discussion_r118007759
2017-05-23Move the flush method from Stream to PrintMatthijs Kooijman
This method originally flushed pending input bytes, which makes sense in Stream. At some point it was changed to flush output bytes instead, but it was never moved to Print to reflect this. Since Stream inherits from Print, this should not really affect any users of the Stream or Print classes. However to prevent problems with existing implementations of the Print class that do not provide a flush() implementation, a default implementation is provided. We should probably remove this at some point in the future, though.
2017-05-16Add Print::availableForWriteEric Wieser
If available() is in the base Stream class, then availableForWrite() should be in the base Print class
2017-03-20Fixed warning about unused variableCristian Maglie
2017-03-16use IAD Descriptor for device descriptor per the definition in "USB 2.0 ECN ↵liu nick
Interface Association Descriptor" and "USB Interface Association Descriptor Device Class Code and Use Model"
2017-03-16[AVR] USB send ZLP when neededCristian Maglie
See #5732 #4864 #4138 #3946
2017-03-16Revert "Subtract one from USB_EP_SIZE in USB_SendSpace"Cristian Maglie
This reverts commit 817d700a7503b269f986075cad637ce56c657e37.