Key exchange - page 2 - Hello, I'm a NEWBIE - HELP!! (Newbies assistance, User Guides and thank you notes) - CHDK Forum  

Key exchange

  • 11 Replies
  • 3775 Views
Re: Key exchange
« Reply #10 on: 15 / April / 2016, 19:44:08 »
Advertisements
I will check the doc to see if I can write that kind of code.
Here's a tested "quick&dirty" version :
Code: [Select]
#define KMETER 0x00040000
#define KSET   0x00002000                                                                                               

void kbd_fetch_data(long *dst)
{
    static int ktimer=0;
    static int keymask=0xFFFFFFFF;
    _GetKbdState(dst);
    _kbd_read_keys_r2(dst);
    if ((*dst & KMETER)==0)
    {
        if (ktimer<0) ktimer=0;
        ktimer++ ;
        if (ktimer>100) *dst = (*dst | KMETER) & ~KSET; 
        else            *dst = *dst | KMETER;   
    }
    else
    {   
        if (ktimer>0)
        {
            if ( ktimer > 100 ) keymask = KSET ;
            else                keymask = KMETER ;
            ktimer = -6;
        }
        if (ktimer<0)
        {
            *dst = *dst & ~keymask ;
            ktimer++ ;
        }
    }
}
Short press looks like the metering key.  Press more than one second and Func/Set is simulated.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Key exchange
« Reply #11 on: 31 / May / 2016, 10:16:52 »
Hi,

Thank you very much.
I did not notice your reply until today as I look aggain at this post.
I have compiled your code and it is working.
Thank you aggain.

AA

 

Related Topics