RK: RK3288 红外遥控器增加已有按键

 

驱动编译

CONFIG_ROCKCHIP_REMOTECTL=y
CONFIG_ROCKCHIP_REMOTECTL_PWM=y

 一. rkxx_remotectl.c

1.1.kernel\drivers\input\remotectl\rkxx_remotectl.c

用户码

        case RMC_USERCODE:
        {
            ddata->scanData <<= 1;
            ddata->count ++;
	   // printk("RMC_USERCODE,period=%d,count=%d\n",ddata->period,ddata->count );
            if ((TIME_BIT1_MIN < ddata->period) && (ddata->period < TIME_BIT1_MAX)){
                ddata->scanData |= 0x01;
            }
		
            if (ddata->count == 0x10){//16 bit user code
               // printk("u=0x%x\n",((ddata->scanData)&0xFFFF));
                if (remotectl_keybdNum_lookup(ddata)){
                    ddata->state = RMC_GETDATA;
                    ddata->scanData = 0;
                    ddata->count = 0;
                }else{                //user code error
                    ddata->state = RMC_PRELOAD;
                }
            }
        }
        break;

 键值

        case RMC_GETDATA:
        {
            ddata->count ++;
            ddata->scanData <<= 1;

          
            if ((TIME_BIT1_MIN < ddata->period) && (ddata->period < TIME_BIT1_MAX)){
                ddata->scanData |= 0x01;
            }           
            if (ddata->count == 0x10){
               // printk("RMC_GETDATA=%x\n",(ddata->scanData&0xFFFF));

                if ((ddata->scanData&0x0ff) == ((~ddata->scanData >> 8)&0x0ff)){
                    if (remotectl_keycode_lookup(ddata)){
                        ddata->press = 1;

 二.rockchip_pwm_remotectl.c

kernel\drivers\input\remotectl\rockchip_pwm_remotectl.c  

  

posted @ 2020-12-25 18:23  CrushGirl  阅读(648)  评论(0编辑  收藏  举报