/* **************************************************************************************************** * * FunctionName: Lradc_key_Init * * Description: * lradc 按键初始化。 * Parameters: * 无。 * * Return value: * 成功返回EPDK_OK,失败返回EPDK_FAIL. * Notes: * **************************************************************************************************** */ __s32 Lradc_key_Init(void) { __s32 ret; eLIBs_printf("line=%d file=%s\n", __LINE__, __FILE__); if(pLradck == NULL) { pLradck = (KEYC_SETTING *)eLIBs_malloc(sizeof(KEYC_SETTING)); if(pLradck == NULL) { __err("keyc driver memory malloc error!\n"); return EPDK_FAIL; } eLIBs_memset(pLradck, 0, sizeof(KEYC_SETTING)); } else { __wrn("lradc key has been initial!\n"); return EPDK_FAIL; } //eDbug("888888888888888888888888888888\n"); //initial lradc key pLradck->channel = LRADC_ONE_CHANNEL; pLradck->irq_flags = 0; pLradck->irq_no = LRADC_IRQ_NUM; pLradck->irq_prio = 0; pLradck->key_adc = LRADC_USED_ADC0;// ADC0 pLradck->key_down = lradckey_keydown; pLradck->key_up = lradckey_keyup; pLradck->sample = LRADC_SAMPLE_32HZ;// 32ms pLradck->voltageB = LRADC_LEVELB_1_8V; pLradck->pKeycode = pvp_keymapping; solution_keymapping = pvp_keymapping; pLradck->kc_size = sizeof(pvp_keymapping)/sizeof(pvp_keymapping[0]); pLradck->first_key_time = 2; // 32ms*2 = 64ms pLradck->first_key_delay = 5; // 32ms*5 = 160ms pLradck->repeat_key_time = 3; // 32ms*3 = 96ms pLradck->line_notifier = NULL;//none pLradck->line_adc = LRADC_NOTUSED_ADC01; //eDbug("888888888888888888888888888888 init start\n"); ret = BSP_LRADCK_init(pLradck); //eDbug("ret = %d\n", ret); //eDbug("888888888888888888888888888888 init end\n"); return EPDK_OK; }
__s32 RockerKeyDevInit(void) { /* 分配电源键输入设备句柄,并向输入子系统注册.*/ __s32 i; __u32 KeyCodeNum; __input_dev_t * p_input_dev = NULL; p_input_dev = (__input_dev_t *)eLIBs_malloc(sizeof(__input_dev_t)); if (p_input_dev == NULL) { __msg("not enough memory for INPUT physical device handle\n"); return EPDK_FAIL; } eLIBs_memset(p_input_dev, 0, sizeof(__input_dev_t)); __here__; /* 用于向设备管理系统注册一个管理设备节点 */ p_input_dev->classname = INPUT_CLASS_NAME; p_input_dev->name = "RockerKey"; p_input_dev->ops = &rocker_dev_ops; p_input_dev->parg = NULL; p_input_dev->id.product = 0x0001; p_input_dev->id.version = 0x0001; /* 属于按键类设备 */ p_input_dev->device_class = INPUT_KEYBOARD_CLASS; __here__; p_input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); /* 设置ADC设备支持的按键事件 */ KeyCodeNum = sizeof(RockerKeyDevCodes) / sizeof(RockerKeyDevCodes[0]); for (i = 0; i < KeyCodeNum; i++) { __set_bit(RockerKeyDevCodes[i], p_input_dev->keybit); } /* 设备电源键设备的事件反馈回掉函数为NULL,不支持事件的回馈 */ p_input_dev->event = NULL; __here__; /* 向输入子系统注册电源键输入设备 */ if (esINPUT_RegDev(p_input_dev) != EPDK_OK) { __msg("register powerkey device to INPUT system failed\n"); eLIBs_free(p_input_dev); return EPDK_FAIL; } rocker_drv.p_input_dev = p_input_dev; __msg("PowerKey device initialize succeeded\n"); return EPDK_OK; }
static H_LYR StandyWndCreate(const char *file_path) { H_LYR hLyr; int rotation; FB frameBuf; ES_FILE *file = NULL; void *file_data = NULL; bmp_file_head_t *f_head= NULL; __layerwincreate_para_t layerWinCreate; __disp_layer_para_t lyrPara; __u32 lenth; file = eLIBs_fopen(file_path,"rb"); if(file == NULL){ __msg("file open fail\n"); //return NULL; goto end; } f_head = eLIBs_malloc(sizeof(bmp_file_head_t)); if(f_head==NULL){ __msg("file malloc fail\n"); goto end; } eLIBs_fread(f_head,1,sizeof(bmp_file_head_t),file); if(f_head->bfType[0]!='B'||f_head->bfType[1]!='M'){ __msg("file isnot bmp\n"); goto end; } file_data = eLIBs_malloc(f_head->bfSize); eLIBs_fseek(file,0,SEEK_SET); lenth = eLIBs_fread(file_data,1,f_head->bfSize,file); __msg("lenth==%d\n",lenth); rotation = GUI_GetScnDir(); MwLayerParaInit(&layerWinCreate, &frameBuf, &lyrPara, "Layer", rotation, 1, 320, 240); MwFillSize(&frameBuf.size, 320 , 240); MwFillRect(&lyrPara.src_win, 0, 0, 320, 240); hLyr = GUI_LyrWinCreate(&layerWinCreate); if (NULL == hLyr) { __msg("Create layer (%s) failed", layerWinCreate.name); goto end; } GUI_LyrWinSel(hLyr); GUI_BMP_Draw(file_data, 0, 0); GUI_LyrWinSetSta(hLyr,GUI_LYRWIN_STA_ON); eLIBs_fclose(file); eLIBs_free(f_head); eLIBs_free(file_data); return hLyr; end: if(file){ eLIBs_fclose(file); } if(f_head){ eLIBs_free(f_head); } if(file_data){ eLIBs_free(file_data); } return NULL; }