aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino/USBAPI.h
diff options
context:
space:
mode:
authorMatthijs Kooijman <matthijs@stdin.nl>2015-07-30 15:33:37 +0200
committerMatthijs Kooijman <matthijs@stdin.nl>2015-07-31 14:06:19 +0200
commit31e0c941240f2b1d0e4f97d6e65d3a1ad66fbae5 (patch)
tree0d080cc0e9601e1dc453f4452d29a5fddf4b2232 /cores/arduino/USBAPI.h
parentacb1a47a78ef96a5fcfbae9013dcc7d39e30292e (diff)
Add Serial_::readBreak() to process SEND_BREAK requests
This allows detecting when the USB host sends a break request and what the value of the request was. See the comments in USBAPI.h for details. This just modifies the avr core, not the sam core.
Diffstat (limited to 'cores/arduino/USBAPI.h')
-rw-r--r--cores/arduino/USBAPI.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/cores/arduino/USBAPI.h b/cores/arduino/USBAPI.h
index ada73b0..3d355d2 100644
--- a/cores/arduino/USBAPI.h
+++ b/cores/arduino/USBAPI.h
@@ -102,6 +102,23 @@ public:
volatile uint8_t _rx_buffer_tail;
unsigned char _rx_buffer[SERIAL_BUFFER_SIZE];
+ // This method allows processing "SEND_BREAK" requests sent by
+ // the USB host. Those requests indicate that the host wants to
+ // send a BREAK signal and are accompanied by a single uint16_t
+ // value, specifying the duration of the break. The value 0
+ // means to end any current break, while the value 0xffff means
+ // to start an indefinite break.
+ // readBreak() will return the value of the most recent break
+ // request, but will return it at most once, returning -1 when
+ // readBreak() is called again (until another break request is
+ // received, which is again returned once).
+ // This also mean that if two break requests are received
+ // without readBreak() being called in between, the value of the
+ // first request is lost.
+ // Note that the value returned is a long, so it can return
+ // 0-0xffff as well as -1.
+ int32_t readBreak();
+
// These return the settings specified by the USB host for the
// serial port. These aren't really used, but are offered here
// in case a sketch wants to act on these settings.