summaryrefslogtreecommitdiff
path: root/openpicc
diff options
context:
space:
mode:
authorhenryk <henryk@6dc7ffe9-61d6-0310-9af1-9938baff3ed1>2007-11-11 04:31:13 +0000
committerhenryk <henryk@6dc7ffe9-61d6-0310-9af1-9938baff3ed1>2007-11-11 04:31:13 +0000
commit948f16ee2071b267646f92861208811b3e8e9853 (patch)
treeb1a56c2b5f46126e3ca5c2d2db4b2f6b40aba0bd /openpicc
parent735f640c80948e7cd4d0aa7533d0898fe4b0f0b4 (diff)
Add da_get_value to return the last written value
Add commands to increase and decrease comparator threshold git-svn-id: https://svn.openpcd.org:2342/trunk@320 6dc7ffe9-61d6-0310-9af1-9938baff3ed1
Diffstat (limited to 'openpicc')
-rw-r--r--openpicc/application/cmd.c20
-rw-r--r--openpicc/application/da.c7
-rw-r--r--openpicc/application/da.h1
3 files changed, 20 insertions, 8 deletions
diff --git a/openpicc/application/cmd.c b/openpicc/application/cmd.c
index 1b79b78..7ff7f53 100644
--- a/openpicc/application/cmd.c
+++ b/openpicc/application/cmd.c
@@ -10,6 +10,7 @@
#include "cmd.h"
#include "openpicc.h"
#include "led.h"
+#include "da.h"
xQueueHandle xCmdQueue;
xTaskHandle xCmdTask;
@@ -184,6 +185,9 @@ void prvExecCommand(u_int32_t cmd, portCHAR *args) {
DumpStringToUSB(" * The transmit interval is ");
DumpUIntToUSB(env.e.speed);
DumpStringToUSB("00ms\n\r");
+ DumpStringToUSB(" * The comparator threshold is ");
+ DumpUIntToUSB(da_get_value());
+ DumpStringToUSB("\n\r");
DumpStringToUSB(
" *\n\r"
" *****************************************************\n\r"
@@ -193,16 +197,16 @@ void prvExecCommand(u_int32_t cmd, portCHAR *args) {
case '-':
if(cmd == '+')
{
- if(env.e.speed<9)
- env.e.speed++;
+ if(da_get_value() < 255)
+ da_comp_carr(da_get_value()+1);
}
else
- if(env.e.speed>1)
- env.e.speed--;
+ if(da_get_value() > 0)
+ da_comp_carr(da_get_value()-1);;
- DumpStringToUSB(" * Transmit interval set to ");
- vUSBSendByte(((char)(env.e.speed))+'0');
- DumpStringToUSB("00ms\n\r");
+ DumpStringToUSB(" * Comparator threshold set to ");
+ DumpUIntToUSB(da_get_value());
+ DumpStringToUSB("\n\r");
break;
case 'L':
led = (led+1)%4;
@@ -226,7 +230,7 @@ void prvExecCommand(u_int32_t cmd, portCHAR *args) {
" * c - print configuration\n\r"
" * 0 - receive only mode\n\r"
" * 1..4 - automatic transmit at selected power levels\n\r"
- " * +,- - faster/slower transmit speed\n\r"
+ " * +,- - decrease/increase comparator threshold\n\r"
" * l - cycle LEDs\n\r"
" * ?,h - display this help screen\n\r"
" *\n\r"
diff --git a/openpicc/application/da.c b/openpicc/application/da.c
index 64cee5b..e645053 100644
--- a/openpicc/application/da.c
+++ b/openpicc/application/da.c
@@ -26,6 +26,7 @@
#include <lib_AT91SAM7.h>
static const AT91PS_SPI spi = AT91C_BASE_SPI;
+static u_int8_t last_value;
void da_comp_carr(u_int8_t position)
{
@@ -43,6 +44,12 @@ void da_comp_carr(u_int8_t position)
while (!(spi->SPI_SR & AT91C_SPI_TDRE)) { }
for (i = 0; i < 0xff; i++) { }
AT91F_PIO_SetOutput(AT91C_BASE_PIOA, OPENPICC_PIO_SS2_DT_THRESH);
+ last_value = position;
+}
+
+u_int8_t da_get_value(void)
+{
+ return last_value;
}
void da_init(void)
diff --git a/openpicc/application/da.h b/openpicc/application/da.h
index e264e2b..31e33d4 100644
--- a/openpicc/application/da.h
+++ b/openpicc/application/da.h
@@ -2,6 +2,7 @@
#define _DA_H
extern void da_comp_carr(u_int8_t position);
+extern u_int8_t da_get_value(void);
extern void da_init(void);
#endif
personal git repositories of Harald Welte. Your mileage may vary