git.ucc.asn.au
/
matches
/
MCTX3420.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Ensure control key is not empty before checking for equality.
[matches/MCTX3420.git]
/
server
/
pin_test.c
diff --git
a/server/pin_test.c
b/server/pin_test.c
index
90ae626
..
2ef0612
100644
(file)
--- a/
server/pin_test.c
+++ b/
server/pin_test.c
@@
-36,9
+36,8
@@
bool Pin_Configure(const char *type, int pin_export, int num)
if (strcmp(type, "gpo") == 0 || strcmp(type, "gpi") == 0)
{
if (strcmp(type, "gpo") == 0 || strcmp(type, "gpi") == 0)
{
- if (pin_export < 0)
- GPIO_Unexport(num);
- else
+ //Don't allow unexport of gpio
+ if (pin_export > 0)
ret = GPIO_Export(num);
}
else if (strcmp(type, "pwm") == 0)
ret = GPIO_Export(num);
}
else if (strcmp(type, "pwm") == 0)
@@
-50,9
+49,8
@@
bool Pin_Configure(const char *type, int pin_export, int num)
}
else if (strcmp(type, "adc") == 0)
{
}
else if (strcmp(type, "adc") == 0)
{
- if (pin_export < 0)
- ADC_Unexport(num);
- else
+ //Don't allow unexport of adc
+ if (pin_export > 0)
ret = ADC_Export(num);
}
return ret;
ret = ADC_Export(num);
}
return ret;
@@
-120,7
+118,7
@@
void Pin_Handler(FCGIContext *context, char * params)
if (strcmp(type, "gpo") == 0)
{
if (strcmp(type, "gpo") == 0)
{
- if (num <= 0 || num > GPIO_
NUM_PINS
)
+ if (num <= 0 || num > GPIO_
MAX_NUMBER
)
{
FCGI_RejectJSON(context, "Invalid GPIO pin");
return;
{
FCGI_RejectJSON(context, "Invalid GPIO pin");
return;
@@
-139,7
+137,7
@@
void Pin_Handler(FCGIContext *context, char * params)
}
else if (strcmp(type, "gpi") == 0)
{
}
else if (strcmp(type, "gpi") == 0)
{
- if (num < 0 || num >
= GPIO_NUM_PINS
)
+ if (num < 0 || num >
GPIO_MAX_NUMBER
)
{
FCGI_RejectJSON(context, "Invalid GPIO pin");
return;
{
FCGI_RejectJSON(context, "Invalid GPIO pin");
return;
@@
-172,7
+170,7
@@
void Pin_Handler(FCGIContext *context, char * params)
else
{
FCGI_PrintRaw("Content-type: text/plain\r\n\r\n");
else
{
FCGI_PrintRaw("Content-type: text/plain\r\n\r\n");
- FCGI_PrintRaw("
ADC%d reads %d\n", num
, raw_adc);
+ FCGI_PrintRaw("
%d\n"
, raw_adc);
}
}
else if (strcmp(type, "pwm") == 0)
}
}
else if (strcmp(type, "pwm") == 0)
UCC
git Repository :: git.ucc.asn.au