# my_api **Repository Path**: rfish/my_api ## Basic Information - **Project Name**: my_api - **Description**: 自己尝试写的一些封装函数。(很low,运行效率比较低) - **Primary Language**: C - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2015-08-27 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README #my_api ##说明 为自己学习嵌入式开发所写的一些封装函数 ##pthread_pool **使用方法:** - 初始化线程池 `init_pthread_pool();` - 插入任务,参数为函数的指针 `insert_pthread_task(func);` - 执行调度Do it `pthread_pool_doit();` **注意事项:** usleep(4000);//多个任务间需要延时,等待上一个任务将自己设置为忙。 ##but_evt **使用方法:** - 初始化按键注册 `init_but_evt();` - 完成按键事件打包 ``` but_evt *but_evt_buf=(but_evt*)malloc(sizeof(but_evt)); but_evt_buf->area[0][0]=0;//矩形按键区域:左上x轴 but_evt_buf->area[0][1]=0;//矩形按键区域:左上y轴 but_evt_buf->area[1][0]=400;//按键区域:右下x轴 but_evt_buf->area[1][1]=480;//按键区域:右下y轴 but_evt_buf->func=func;//按键事件函数 ``` - 按键事件注册 `evt_register(but_evt_buf);` - 执行调度 `deal_evt(NULL);` - 执行调度Do it `pthread_pool_doit();` - 新的按键事件 - 直接按键事件注册即可 **其他** 下次修改结合上一个线程池