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

1289 Commits

Author SHA1 Message Date
Matthijs Kooijman
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
Matthijs Kooijman
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
Matthijs Kooijman
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
Matthijs Kooijman
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
Matthijs Kooijman
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
Matthijs Kooijman
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
Matthijs Kooijman
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
Matthijs Kooijman
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
Cristian Maglie
0e013406bc Merge branch 'sam-usart-mode-fix' into ide-1.5.x 2015-01-19 13:43:42 +01:00
Cristian Maglie
8ddc5198f6 Temporary fix for pulseIn() regression.
Fixes #2538
2015-01-18 17:34:40 +01:00
Cristian Maglie
00f23d3aad sam: Fixed initialization of UART/USART mode register 2015-01-14 00:08:59 +01:00
Chris
7e9cf6d612 sam: updated UART/USART modes 2015-01-09 20:25:09 +00:00
Cristian Maglie
20ac20f629 Arduino custom type boolean is now mapped to bool type
Fixes #2151
Fixes #2147
2015-01-07 14:56:19 +01:00
Cristian Maglie
5e97168fbc sam: USART modes now fails if used on UART 2015-01-06 15:47:44 +01:00
Cristian Maglie
37ea166e19 sam: refined UART/USART class inheritance
Let Usart inherit all methods from Uart.
2015-01-05 15:35:32 +01:00
Cristian Maglie
16d836108f sam: fix code format and indent in UART/USART class 2015-01-05 15:34:09 +01:00
Collin Kidder
cabfd8ed21 Fixed flush so that it actually is sure to flush all outstanding data. 2015-01-04 13:37:28 -05:00
Collin Kidder
76280e8778 Correct an issue where write could send data out of order. 2014-12-31 08:42:26 -05:00
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