1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-11-29 10:24:12 +01:00
Commit Graph

1483 Commits

Author SHA1 Message Date
Collin Kidder
eff20deb27 Add ability to set interrupt priority for UART/USARTs. 2014-12-24 10:36:40 -05:00
Collin Kidder
2fedb00552 Switch all of the transmit interrupt code to UARTClass. Also, turn USARTClass into a stub because it did nothing differently from the UART code anyway. Now all serial ports use transmit interrupts. 2014-12-24 10:20:37 -05:00
Collin Kidder
bb341c6d92 Modifications to make serial transmit interrupt work more reliably. Also, added the availableForWrite function. 2014-12-23 22:37:58 -05:00
Collin Kidder
4eb05c303b Change RingBuffer to have buffer size of 128 and also set its members volatile since they are all accessed and modified in interrupt handlers. 2014-12-23 22:36:35 -05:00
Collin Kidder
065459c18f Implement transmit buffering with interrupts for USART devices 2014-12-21 20:57:08 -05:00
Cristian Maglie
a9735bf91f Fix atomicity issues in SPI::beginTransaction and SPI::endTransaction (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 15:56:11 +01:00
Cristian Maglie
84b6cc27a5 [avr] Made SPI.usingInterrupt() synchronized (Andrew Kroll) 2014-11-25 15:56:11 +01:00
Cristian Maglie
d9537cb7da [avr] Added SPI.notUsingInterrupt() (Andrew Kroll) 2014-11-25 15:56:11 +01:00
Cristian Maglie
8344812ce8 [avr] Made SPI.begin() and SPI.end() synchronized (Andrew Kroll) 2014-11-25 15:49:17 +01:00
Cristian Maglie
53e25d8b55 [avr] Improved SPI speed on 16bit transfer.
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-25 15:49:17 +01:00
Cristian Maglie
b9e186e45a Upped version to 1.6.0 2014-11-18 14:48:01 +01:00
Cristian Maglie
34c40b224f [avr] SPI: removed redundant include 2014-11-14 00:23:11 +01:00
Cristian Maglie
993cc9bbb4 [avr] Small comments and headers fixes in SPI 2014-11-14 00:23:11 +01:00
Matthijs Kooijman
cd9a9e3fd7 Reduce avrdude verbosity
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-30 12:36:06 +01:00
Cristian Maglie
d1714a9fb8 [sam] Added -MMD flag to tell compiler to produce dependencies files
Now a full rebuild of the sketch is triggered only if needed.
2014-10-22 13:36:14 +02:00
Cristian Maglie
0824abfee5 Merge branch 'master' into ide-1.5.x
Conflicts:
	hardware/arduino/cores/arduino/HardwareSerial.cpp
	hardware/arduino/cores/robot/Arduino.h
2014-10-21 17:47:59 +02:00
Cristian Maglie
62cf4b6b55 Revert "Match return value to type in available()"
This reverts commit f40e471354.
Added an hint for the buffer sizes.

See #2057
Fixes #2367
2014-10-21 17:18:26 +02:00
Cristian Maglie
58b6fd4789 Fixed missing NOT_AN_INTERRUPT constant in digitalPinToInterrupt()
Fixes #2379
2014-10-21 16:55:37 +02:00
Cristian Maglie
3687289727 Merge pull request #2330 from spiritinlife/ide-1.5.x
Add #include "Print.h" in Server.h    Ide 1.5.x
2014-10-01 13:29:29 +02:00
Cristian Maglie
21939e6f89 [sam] Fixed compile error when using math functions
Fixes #2338
2014-09-30 17:34:25 +02:00
George Chailazopoulos
2c289ace73 Add #include "Print.h" in Server.h 2014-09-26 22:59:02 +03:00
George Chailazopoulos
f5fe16bf2a Add #include "Print.h" in Server.h 2014-09-26 22:58:19 +03:00
Cristian Maglie
974613a0a2 [sam] Fixed architecture specific macro digitalPinToTimer, added comment to uninplemented portModeRegister
Fix #1833
2014-09-22 00:38:02 +02:00
Arnav Gupta
4dd931a99a set correct max size for mega2560 (to address issue #2277)
Signed-off-by: Arnav Gupta <championswimmer@gmail.com>
2014-09-21 17:10:06 +05:30
Arnav Gupta
15064ad96a set correct max size for mega2560
Signed-off-by: Arnav Gupta <championswimmer@gmail.com>
2014-09-20 03:09:54 +05:30
Cristian Maglie
84518e442c Fixed attribution rights for SAM delayMicroseconds function 2014-09-16 12:31:16 +02:00
Cristian Maglie
44bcd2040b Merge branch 'master' into ide-1.5.x
Conflicts:
	app/src/processing/app/Base.java
	build/build.xml
	todo.txt
2014-09-16 12:19:39 +02:00
Cristian Maglie
5f67650b80 Fixed trivial include error introduced in previous commit 2e3e539b... oops... 2014-09-12 16:58:05 +02:00
Cristian Maglie
8018a26e3d Merge pull request #2299 from cmaglie/ide-1.5.x-spi-updates
Missing SPI Transaction API methods on Due (SAM3X)
2014-09-12 14:07:03 +02:00
Cristian Maglie
2e3e539b71 Added license to USBAPI.h
Close #1847
2014-09-12 12:27:39 +02:00
Cristian Maglie
69e37647a6 Ported #1397 to SAM. 2014-09-12 12:06:00 +02:00
Cristian Maglie
3d222cc372 Merge pull request #1937 from matthijskooijman/stringindex
String index fixes and cleanups
2014-09-12 11:56:12 +02:00
Cristian Maglie
6a5b82f062 [sam] Implementation of SPI multibyte transfer 2014-09-11 17:50:00 +02:00
Cristian Maglie
5f88564b2b [sam] Simplified formula for SPI speed 2014-09-11 13:57:08 +02:00
Cristian Maglie
848dd39313 [sam] SPI library: added SPI_HAS_EXTENDED_CS_PIN_HANDLING flag
This allows to check if SPI provides extended API to allow automatic
CS pin handling.
2014-09-11 13:57:07 +02:00
Cristian Maglie
11cf45d6d6 Fix indent and small cosmetic changes 2014-09-10 18:22:02 +02:00
Matthijs Kooijman
04dba1e46f Fix off-by-one in String::substring
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-10 13:42:06 +02:00
Cristian Maglie
6f9674288b Merge pull request #2279 from cmaglie/fix-leo-upload-osx10.9.4
Fix for upload problems on Arduino Leonardo (and derivatives) on OSX 10.9
2014-09-10 12:58:10 +02:00
Matthijs Kooijman
86015f441e Simplify String::remove(unsigned int)
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-10 12:33:25 +02:00
Matthijs Kooijman
2068f88a21 Fix bounds check in String::remove()
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-10 12:33:25 +02:00
Matthijs Kooijman
2b90124e3d Remove unneeded check in String::remove(unsigned int)
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-10 12:33:24 +02:00
Cristian Maglie
9a8b9c5c58 Fixed license for new.cpp and small cosmetic changes 2014-09-06 12:44:53 +02:00
Cristian Maglie
37ee800abd Correct implementation of gcc specific internal functions
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-06 12:42:25 +02:00
Cristian Maglie
b0b83625c1 Printable.h doesn't need new.h but only stdlib.h for size_t.
Probalby new.h may be removed completely.
2014-09-06 12:37:57 +02:00
Cristian Maglie
07e3e83424 Added new/delete stubs for Arduino Due
Fix #1485
A better implementation may be desirable as discussed in #108
2014-09-06 10:26:59 +02:00
Cristian Maglie
b7b9da7710 Updated version to 1.5.8 2014-09-05 10:11:47 +02:00
Cristian Maglie
aa776b30ba Fix for upload problems on Arduino Leonardo (and derivatives) with OSX 10.9.4 2014-09-01 12:16:41 +02:00
qperez42@gmail.com
70bc56275d fix Descriptor.c 2014-08-25 09:52:10 +02:00
Cristian Maglie
7f2350f714 Merge branch 'master' into ide-1.5.x 2014-08-08 15:44:41 +02:00
Christopher Andrews
1bbcb2f9d4 Added replacement stub for cstdlib atexit() funciton.
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-08 15:38:57 +02:00
PaulStoffregen
daa7e7dcc9 Fix interrupt masking on Arduino Due 2014-08-01 16:44:47 -07:00
PaulStoffregen
ef06410d16 Add SPI_HAS_TRANSACTION symbol for Arduino Due 2014-08-01 13:00:29 -07:00
PaulStoffregen
abb37e202f SPI Transactions for Arduino Due 2014-08-01 05:57:13 -07:00
PaulStoffregen
3d5ef6d5d9 SPI Transactions for AVR 2014-08-01 05:38:27 -07:00
Cristian Maglie
fd94e184a5 Merge remote-tracking branch 'arduino/master' into ide-1.5.x 2014-07-24 14:46:05 +02:00
Cristian Maglie
163b60ee29 Merge pull request #2206 from amulya349/master
Fix of a bug #2199
2014-07-24 14:40:52 +02:00
Amulya Kumar Sahoo
865594d132 Fix of a bug 2014-07-23 01:03:44 +05:30
Cristian Maglie
6200ec2039 Merge pull request #2194 from Fede85/ide-1.5.x_lib-description
Ide 1.5.x lib description
2014-07-21 12:16:20 +02:00
Cristian Maglie
dbd9b77b49 Merge pull request #2190 from ribbons/compiler-warnings
Fix two compiler warnings generated by updated toolchain
2014-07-19 09:35:58 +02:00
Fede85
dd77375fe9 missing paragraph field in library.properties 2014-07-18 20:08:01 +02:00
Fede85
b02e85ceb2 modified sentences in library.properties files 2014-07-18 19:41:34 +02:00
PaulStoffregen
33cec73f26 Add availableForWrite() to HardwareSerial 2014-07-18 07:01:26 -07:00
Matt Robinson
61a3558946 Cast empty string to char* to fix compiler warning
Stream::find(char *target) passes an empty terminator string to
Stream::findUntil(char *target, char *terminator) which caused a compiler
warning with the updated toolchain, so cast it to a char*.
2014-07-17 16:51:35 +01:00
Cristian Maglie
75ec6a1b31 Due: Wire.setClock can be called at any time
See #2157
2014-07-06 00:36:22 +02:00
Kristian Lauszus
9d20959b6a Implemented setClock for the Due as well
This allows users to change the I2C clock frequency
2014-07-02 19:47:23 +02:00
Cristian Maglie
49ec540204 Merge pull request #1912 from Lauszus/issues440
Enable user to change the I2C clock frequency by calling setClock in the Wire library
2014-07-02 15:37:30 +02:00
Cristian Maglie
396278598c Merge pull request #2148 from Lauszus/promini
Arduino Pro and Pro Mini should use eightanaloginputs variant
2014-07-02 15:29:31 +02:00
Fede85
8e48cef584 added support for the ArduinoISP 2014-07-02 15:03:12 +02:00
Cristian Maglie
d07eb8866a Update ArduinoWifiShield_upgrade_mac.sh 2014-07-01 19:11:19 +02:00
Ankit Daftery
b0ab27c47e Update ArduinoWifiShield_upgrade.sh
File path should be updated, is wrong currently, will throw an error saying files missing.
2014-07-01 19:09:49 +02:00
Cristian Maglie
81a5352811 Merge branch 'master' into ide-1.5.x 2014-07-01 19:07:55 +02:00
Cristian Maglie
494d3de97d Fixed permission on wifishield upgrade script. 2014-07-01 19:05:03 +02:00
Cristian Maglie
fe78ffe429 Merge pull request #2118 from benoit-artefactlabs/wifishield-upgrade-firmware-mac-path
corrected wrong path to firmware binaries in wifishield upgrade script f...
2014-07-01 18:52:41 +02:00
Cristian Maglie
c2c122b079 Merge branch 'master' into matthijskooijman-ide-1.5.x-timer-variant
Conflicts:
	app/src/processing/app/debug/Compiler.java
	hardware/arduino/sam/cores/arduino/main.cpp
2014-07-01 18:34:46 +02:00
Cristian Maglie
e5f34e5a83 Merge branch 'ide-1.5.x-timer-variant' of github.com:matthijskooijman/Arduino into matthijskooijman-ide-1.5.x-timer-variant 2014-07-01 18:29:07 +02:00
Cristian Maglie
29f9dd9f1f Merge pull request #2139 from cmaglie/init-variant
Allow variants to define an initVariant() function that is called at startup
2014-07-01 17:28:45 +02:00
Cristian Maglie
00087c11f4 Reverting -flto flag from AVR core until all compatibility problems are worked out.
For more info:
https://groups.google.com/a/arduino.cc/d/msg/developers/21G5w2HbUOg/NRMW6c9OIFUJ
2014-07-01 17:18:04 +02:00
Cristian Maglie
e0f83a3617 Backported digitalPinToInterrupt macro from IDE 1.5.x 2014-06-30 18:24:08 +02:00
Kristian Lauszus
4e38e595eb Arduino Pro and Pro Mini should use eightanaloginputs variant, so all 8 analog pins can be used 2014-06-28 22:37:26 +02:00
Cristian Maglie
bb095a2a59 initVariant() is now declared as external "C" function.
See #2080 for more details.
2014-06-27 14:26:32 +02:00
Cristian Maglie
370648a532 Merge branch 'ide-1.5.7' into ide-1.5.x 2014-06-27 13:44:18 +02:00
Matthijs Kooijman
10a89a1d8d Support Atmega8 (and similar that define PE instead of UPE) again
These chips were previously supported, but since parity error checking
was added, this support has broken. Most chips define UPE0 (etc.) for
the parity error bit. Some chips don't have numbered UARTS so only
define UPE and even fewer define PE instead of UPE. This adds support
for those chips again.

Closes: #2137
2014-06-25 17:20:07 +02:00
Matthijs Kooijman
4014dd6070 Allow variants to define an initVariant() function that is called at startup.
See #2080 and #2139.
2014-06-25 16:56:19 +02:00
Cristian Maglie
c2e5f67ea6 Updated arm gcc to version 4.8.3-2014q1 2014-06-25 11:59:47 +02:00
Cristian Maglie
4df2c8982a Updated arm gcc to 4.8.3 2014-06-25 11:57:49 +02:00
Cristian Maglie
3a4381955e Updated arm gcc to 4.7.4 2014-06-25 11:56:50 +02:00
Cristian Maglie
59767b4c03 Removed patch for old malloc bug (no more useful with updated toolchain) 2014-06-25 10:14:35 +02:00
Federico Fissore
b72f461b4c Fixed compilation error when targetting Mega. Error is caused by #2039 and this fix is just a workaround 2014-06-25 10:14:35 +02:00
Federico Fissore
6f74581bba gcc: Adding -w flag to compiler.c.elf.flags in order to avoid printing ISR warning http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59396 2014-06-25 10:14:35 +02:00
Federico Fissore
44a6cbf2de Enabling link-time optimization. See #660 2014-06-25 10:14:34 +02:00
Federico Fissore
5a015b3eec New common AVR toolchain 2014-06-25 10:12:39 +02:00
Cristian Maglie
40270306e0 Allow variants to define an initVariant() function that is called at startup.
See #2080
2014-06-19 19:49:47 +02:00
Cristian Maglie
1a305cdc45 Merge branch 'master' into ide-1.5.x 2014-06-19 17:01:53 +02:00
Cristian Maglie
11e02db954 Fixed regression in USBAPI and CDC (xaljox)
See:
9ac7e30252 (commitcomment-6718676)
2014-06-19 16:52:48 +02:00
Cristian Maglie
7f9e9b1cc2 Merge branch 'master' into HEAD 2014-06-13 10:29:12 +02:00
Embedded Micro
9ac7e30252 Update USBAPI.h
Fixes bug where Serial.read() would always return 0 as the first byte.
2014-06-10 08:48:23 -07:00
benoit.git
d460dd6683 corrected wrong path to firmware binaries in wifishield upgrade script for mac 2014-06-08 00:01:40 +02:00
Cristian Maglie
1918966aef Merge pull request #2104 from amulya349/master
Fix of a bug in Stream.cpp
2014-06-02 10:37:37 +02:00
Cristian Maglie
82fe44d76d Merge branch 'master' into HEAD 2014-05-30 10:54:14 +02:00
Cristian Maglie
6914af0d63 USB CDC available() method returns correct number of bytes in buffer.
See #1953
2014-05-30 10:46:46 +02:00