summaryrefslogtreecommitdiff
path: root/tkr-utils
diff options
context:
space:
mode:
authorJason D. McCormick <jason@mfamily.org>2022-11-04 22:31:16 -0400
committerJason D. McCormick <jason@mfamily.org>2022-11-04 22:31:16 -0400
commit65f7c546552ce1b822dc47d5d2d2123fd429e57f (patch)
treececf19afc1f1dfa260548e2f00b8ca55d8341415 /tkr-utils
parenteb74644514e1b2a2a8b75396c216fa467869e293 (diff)
Diffstat (limited to 'tkr-utils')
-rwxr-xr-xtkr-utils/tkr-chansel53
-rwxr-xr-xtkr-utils/tkr-cycle10
2 files changed, 63 insertions, 0 deletions
diff --git a/tkr-utils/tkr-chansel b/tkr-utils/tkr-chansel
new file mode 100755
index 0000000..11adc9f
--- /dev/null
+++ b/tkr-utils/tkr-chansel
@@ -0,0 +1,53 @@
+#!/usr/bin/perl
+
+use strict;
+use Data::Dumper qw(Dumper);
+
+# See Kenwood TKR Manual Page 53 Table 20-3
+my %tkrchansel = (
+ '1' => { '1' => '0', '2' => '1', '3' => '1', '4' => '1' },
+ '2' => { '1' => '1', '2' => '0', '3' => '1', '4' => '1' },
+ '3' => { '1' => '0', '2' => '0', '3' => '1', '4' => '1' },
+ '4' => { '1' => '1', '2' => '1', '3' => '0', '4' => '1' },
+ '5' => { '1' => '0', '2' => '1', '3' => '0', '4' => '1' },
+ '6' => { '1' => '1', '2' => '0', '3' => '0', '4' => '1' },
+ '7' => { '1' => '0', '2' => '0', '3' => '0', '4' => '1' },
+ '8' => { '1' => '1', '2' => '1', '3' => '1', '4' => '0' },
+ '9' => { '1' => '0', '2' => '1', '3' => '1', '4' => '0' },
+ '10' => { '1' => '1', '2' => '0', '3' => '1', '4' => '0' },
+ '11' => { '1' => '0', '2' => '0', '3' => '1', '4' => '0' },
+ '12' => { '1' => '1', '2' => '1', '3' => '0', '4' => '0' },
+ '13' => { '1' => '0', '2' => '1', '3' => '0', '4' => '0' },
+ '14' => { '1' => '1', '2' => '0', '3' => '0', '4' => '0' },
+ '15' => { '1' => '0', '2' => '0', '3' => '0', '4' => '0' },
+ '16' => { '1' => '1', '2' => '1', '3' => '1', '4' => '1' },
+);
+
+my ($chan) = @ARGV;
+
+if( ! defined($chan) ){
+ print STDERR "Usage: tkr-chansel CHANNUM\n";
+ exit 1;
+}
+
+if($chan =~ m/\D/ || $chan < 1 || $chan > 16){
+ print STDERR "Usage: tkr-chansel CHANNUM\n";
+ print STDERR "CHANNUM must be between 1 and 16\n";
+ exit 1;
+}
+
+for( my $i = 3; $i <= 6; $i++ ){
+ `gpio mode $i output`;
+ `gpio write $i 0`;
+}
+
+for( my $pin = 3; $pin <= 6; $pin++ ){
+ my $cmd = sprintf(
+ "gpio write %i %i",
+ $pin,
+ $tkrchansel{$chan}{$pin - 2}
+ );
+ system($cmd);
+}
+
+exit 0;
diff --git a/tkr-utils/tkr-cycle b/tkr-utils/tkr-cycle
new file mode 100755
index 0000000..6845d79
--- /dev/null
+++ b/tkr-utils/tkr-cycle
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+for f in `seq 4`
+do
+ echo $f
+ ./tkr-chansel $f
+ sleep 0.5
+done
+
+exec ./tkr-cycle