external offsets

  • andypugh
  • andypugh's Avatar Topic Author
  • Offline
  • Moderator
  • Moderator
More
28 Oct 2023 09:36 #283942 by andypugh
external offsets was created by andypugh
Can you elaborate? I don't see how you can be using matrix_kb with a handwheel. matrix_kb works with keyboards (and other matrix-wired switches)

Please Log in or Create an account to join the conversation.

  • andypugh
  • andypugh's Avatar Topic Author
  • Offline
  • Moderator
  • Moderator
More
01 Nov 2023 12:58 #284253 by andypugh
Replied by andypugh on topic external offsets
Do you want to type in an actual number, then press "enter" and have that applied as an offset?

Or set fixed offsets depending on which of the keys 0 to 9 has been pressed?

Please Log in or Create an account to join the conversation.

  • andypugh
  • andypugh's Avatar Topic Author
  • Offline
  • Moderator
  • Moderator
More
03 Nov 2023 11:15 #284433 by andypugh
Replied by andypugh on topic external offsets
One way to do this would be with a mux component. If you feed the
output back to the input then you get a sample-and-hold type
component.

If you connect each of the 10 inputs to a "sel" pin of such a mux,
then each would select from input 1,2,4,8,16.....
However this might be a bit unwieldy as a 10-input mux has 1024 input
values (of which you would only use 10). This isn't a major problem,
it just means that there are an awful lot of unused HAL pins.
mux_generic.9.html

I have looked through the available HAL components and I don't see one
which does what you need, ie output 1 if pit 1 is set, 2 for bit 2, 3
for bit 3. I might add one, but in the interim here is a custom
component to install with
halcompile
Save this code as selector.comp and install as directed in the link.
(short version: sudo halcompile --install selector.comp)
component selector "Select from 10 input values";

pin in bit select-##[10];
pin in signed value-##[10];
pin out signed output;

license "GPL2+";
author "andypugh";

function _;

;;

FUNCTION(_){
    int i;
    for (i = 0; i < 10; i++){
        if (select(i)) output = value(i);
    }
}

Wire the keyboard output pins to the select-nn pins, set the value-nn pins to the required offsets and wire the output pin to the external offset.

Please Log in or Create an account to join the conversation.

Time to create page: 0.056 seconds
Powered by Kunena Forum