diff options
author | Keith Packard <keithp@keithp.com> | 2013-12-08 19:43:13 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2013-12-08 19:44:49 -0800 |
commit | b1ffdaf1f5e9b6e8ff0d4e08d8c504f8dfacd3a4 (patch) | |
tree | b37626f9e989521c52784c5c6b58e93fee4d750d /altosui | |
parent | 2cb7a96567e1302a699f78290fab5e29693940ab (diff) |
altoslib: Support binary reading/writing in AltosLink
Binary reads require an explicit length, and do not work while
telemetry is running.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altosui')
-rw-r--r-- | altosui/AltosSerial.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/altosui/AltosSerial.java b/altosui/AltosSerial.java index 491b6e81..b85a7fa1 100644 --- a/altosui/AltosSerial.java +++ b/altosui/AltosSerial.java @@ -161,6 +161,16 @@ public class AltosSerial extends AltosLink { } } + public void putchar(byte c) { + if (altos != null) { + if (debug) + System.out.printf(" %02x", (int) c & 0xff); + if (libaltos.altos_putchar(altos, (char) c) != 0) { + close_serial(); + } + } + } + public void print(String data) { for (int i = 0; i < data.length(); i++) putc(data.charAt(i)); |