projects
/
rpipulser
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e49ca36
)
added pin number commandline argument
master
author
John Tsiombikas
<nuclear@mutantstargoat.com>
Tue, 23 Jul 2019 16:43:05 +0000
(19:43 +0300)
committer
John Tsiombikas
<nuclear@mutantstargoat.com>
Tue, 23 Jul 2019 16:43:05 +0000
(19:43 +0300)
pulser.c
patch
|
blob
|
history
diff --git
a/pulser.c
b/pulser.c
index
6362d67
..
3a0bdf1
100644
(file)
--- a/
pulser.c
+++ b/
pulser.c
@@
-59,6
+59,13
@@
int main(int argc, char **argv)
}
break;
}
break;
+ case 'p':
+ if(!argv[++i] || (pin = atoi(argv[i])) < 1 || pin >= 28) {
+ fprintf(stderr, "-p must be followed by a BCM pin number: 1-27\n");
+ return 1;
+ }
+ break;
+
case 'h':
print_usage(argv[0]);
return 0;
case 'h':
print_usage(argv[0]);
return 0;
@@
-128,5
+135,6
@@
void print_usage(const char *argv0)
printf(" -n: number of pulses to emit (default: 1)\n");
printf(" -f: frequency of pulses in hz (default: 1)\n");
printf(" -d: duty cycle [1, 255] (default: 128)\n");
printf(" -n: number of pulses to emit (default: 1)\n");
printf(" -f: frequency of pulses in hz (default: 1)\n");
printf(" -d: duty cycle [1, 255] (default: 128)\n");
+ printf(" -p: BCM pin number [1, 27] (default: 24)\n");
printf(" -h: print usage and exit\n");
}
printf(" -h: print usage and exit\n");
}