×

Notice

The forum is in read only mode.

button matrix and Jog Dial

More
25 May 2013 18:32 #10301 by kenkenlau
button matrix and Jog Dial was created by kenkenlau
I am looking into the tx_buttons.c and quite confusing about the buttonmap[] declare. In Eclipse it say BUT_LEFT unresolved......dont know where BUT_XXXX are declared.

And if I wish to add jog dial support, am I looking at the right place?

Thanks
  • rbe2012
  • rbe2012's Avatar
  • Offline
  • So much to do, so little time...
More
25 May 2013 18:59 #10302 by rbe2012
Replied by rbe2012 on topic button matrix and Jog Dial
Look into the capabilities.h - there are the buttons defined. The construct used there was not easy to understand for me, but it is quite brilliant: the capabilities.h is included in other files where a "#define"-directive tells what to do with the information: the buttons are defined in inputs.c:
const char *INPUT_ButtonName(u8 button)
{
    if (! button) {
        return _tr("None");
    }
    #define BUTTONDEF(x) case BUT_##x : return BUTNAME_##x;
    switch(button) {
        #include "capabilities.h"
    };
    #undef BUTTONDEF
    return "";
}
  • rbe2012
  • rbe2012's Avatar
  • Offline
  • So much to do, so little time...
More
25 May 2013 19:01 #10303 by rbe2012
Replied by rbe2012 on topic button matrix and Jog Dial
Oh, for a jog dial don't you need two input lines? Aren't they phase-shifted to recognize the direction? Or do you mean something else?
More
25 May 2013 19:30 #10304 by kenkenlau
Replied by kenkenlau on topic button matrix and Jog Dial
yes, phase shifted for direction. plus a push in button.

So i think need to modify some code to detect the phase. In assembly, it is very simple with a -ve edge IRQ
EXINT1_ISR:		//Update_JogAB via IRQ
	push	PSW
	mov		C, port_JogB
	mov		bit_JogA, C
	cpl		C
	mov		bit_JogB, C
	pop		PSW
reti

but in C++ I am still learning how to implement it.
Worst case is adding a tiny MCU to feed in the button matrix, but I think its a stupid idea.

If the code is done, I may build a 3D printing button that can replace the ENT button. so that the ENT button can roll and press.
More
25 May 2013 19:33 #10305 by kenkenlau
Replied by kenkenlau on topic button matrix and Jog Dial

rbe2012 wrote: Oh, for a jog dial don't you need two input lines? Aren't they phase-shifted to recognize the direction? Or do you mean something else?


using this one.
Attachments:
Time to create page: 0.128 seconds
Powered by Kunena Forum