projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
altoslib: Add range and elevation to AltosGreatCircle
[fw/altos]
/
ao-tools
/
lib
/
cc-usb.c
diff --git
a/ao-tools/lib/cc-usb.c
b/ao-tools/lib/cc-usb.c
index 1580c6d9ffee488f84e1910e3e1cc9ecec943938..f82752435d03c48126253541e8b5af8d5a653b63 100644
(file)
--- a/
ao-tools/lib/cc-usb.c
+++ b/
ao-tools/lib/cc-usb.c
@@
-254,10
+254,10
@@
cc_usb_printf(struct cc_usb *cc, char *format, ...)
}
int
}
int
-cc_usb_getchar
(struct cc_usb *cc
)
+cc_usb_getchar
_timeout(struct cc_usb *cc, int timeout
)
{
while (cc->in_pos == cc->in_count) {
{
while (cc->in_pos == cc->in_count) {
- if (_cc_usb_sync(cc,
5000
) < 0) {
+ if (_cc_usb_sync(cc,
timeout
) < 0) {
fprintf(stderr, "USB link timeout\n");
exit(1);
}
fprintf(stderr, "USB link timeout\n");
exit(1);
}
@@
-265,6
+265,12
@@
cc_usb_getchar(struct cc_usb *cc)
return cc->in_buf[cc->in_pos++];
}
return cc->in_buf[cc->in_pos++];
}
+int
+cc_usb_getchar(struct cc_usb *cc)
+{
+ return cc_usb_getchar_timeout(cc, 5000);
+}
+
void
cc_usb_getline(struct cc_usb *cc, char *line, int max)
{
void
cc_usb_getline(struct cc_usb *cc, char *line, int max)
{
@@
-375,11
+381,12
@@
cc_usb_reset(struct cc_usb *cc)
}
void
}
void
-cc_usb_open_remote(struct cc_usb *cc, int
channe
l)
+cc_usb_open_remote(struct cc_usb *cc, int
freq, char *cal
l)
{
if (!cc->remote) {
{
if (!cc->remote) {
- printf ("channel %d\n", channel);
- cc_usb_printf(cc, "\nc r %d\np\nE 0\n", channel);
+ fprintf (stderr, "freq %dkHz\n", freq);
+ fprintf (stderr, "call %s\n", call);
+ cc_usb_printf(cc, "\nc F %d\nc c %s\np\nE 0\n", freq, call);
do {
cc->in_count = cc->in_pos = 0;
_cc_usb_sync(cc, 100);
do {
cc->in_count = cc->in_pos = 0;
_cc_usb_sync(cc, 100);
@@
-419,6
+426,8
@@
cc_usb_open(char *tty)
tcgetattr(cc->fd, &termios);
save_termios = termios;
cfmakeraw(&termios);
tcgetattr(cc->fd, &termios);
save_termios = termios;
cfmakeraw(&termios);
+ cfsetospeed(&termios, B9600);
+ cfsetispeed(&termios, B9600);
tcsetattr(cc->fd, TCSAFLUSH, &termios);
cc_usb_printf(cc, "\nE 0\nm 0\n");
do {
tcsetattr(cc->fd, TCSAFLUSH, &termios);
cc_usb_printf(cc, "\nE 0\nm 0\n");
do {