From: John Tsiombikas Date: Tue, 23 Jul 2019 16:43:05 +0000 (+0300) Subject: added pin number commandline argument X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=commitdiff_plain;ds=inline;p=rpipulser added pin number commandline argument --- diff --git a/pulser.c b/pulser.c index 6362d67..3a0bdf1 100644 --- a/pulser.c +++ b/pulser.c @@ -59,6 +59,13 @@ int main(int argc, char **argv) } 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; @@ -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(" -p: BCM pin number [1, 27] (default: 24)\n"); printf(" -h: print usage and exit\n"); }