summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author(no author) <(no author)@6dc7ffe9-61d6-0310-9af1-9938baff3ed1>2006-09-10 00:07:08 +0000
committer(no author) <(no author)@6dc7ffe9-61d6-0310-9af1-9938baff3ed1>2006-09-10 00:07:08 +0000
commit5cc02937f49aadfa0eff9affe3825346bc48eaf3 (patch)
tree6908fc5c673ac5e101facb6cabb31ba56b1c4e35
parent67f41d39e1fac6008a007fb15ab47a067e471851 (diff)
add unfinished code to read ADC
git-svn-id: https://svn.openpcd.org:2342/trunk@167 6dc7ffe9-61d6-0310-9af1-9938baff3ed1
-rw-r--r--openpcd/opcd_test/opcd_test.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/openpcd/opcd_test/opcd_test.c b/openpcd/opcd_test/opcd_test.c
index 2aa1753..ef1dfb3 100644
--- a/openpcd/opcd_test/opcd_test.c
+++ b/openpcd/opcd_test/opcd_test.c
@@ -75,6 +75,8 @@ static struct option opts[] = {
{ "set-bits", 1, 0, 's' },
{ "clear-bits", 1, 0, 'c' },
{ "usb-perf", 1, 0, 'u' },
+ { "adc-read", 0, 0, 'a' },
+ { "adc-loop", 0, 0, 'A' },
{ "help", 0, 0, 'h'},
};
@@ -92,7 +94,7 @@ int main(int argc, char **argv)
while (1) {
int option_index = 0;
- c = getopt_long(argc, argv, "l:r:w:R:W:s:c:h?u:", opts,
+ c = getopt_long(argc, argv, "l:r:w:R:W:s:c:h?u:aA", opts,
&option_index);
if (c == -1)
@@ -155,6 +157,18 @@ int main(int argc, char **argv)
exit(2);
opcd_usbperf(od, i);
break;
+ case 'a':
+ opcd_send_command(od, OPNPC_CMD_ADC_READ, 0, 0, 0, NULL);
+ opcd_recv_reply(od, buf, buf_len);
+ /* FIXME: interpret and print ADC result */
+ break;
+ case 'A':
+ while (1) {
+ opcd_send_command(od, OPNPC_CMD_ADC_READ, 0, 0, 0, NULL);
+ opcd_recv_reply(od, buf, buf_len);
+ /* FIXME: interpret and print ADC result */
+ }
+ break;
case 'h':
case '?':
print_help();
personal git repositories of Harald Welte. Your mileage may vary