button.c

来自「SMDK2440 boot code, base on vivi」· C语言 代码 · 共 36 行

C
36
字号
//#include <stdio.h>#include <button.h>#include <vstring.h>#include <param.h>static button_handler_t *button_handlers = NULL;voidadd_button_handler(button_handler_t *handler){	if (button_handlers == NULL) {		button_handlers = handler;	} else {		handler->next = button_handlers;		button_handlers = handler;	}}voidcheck_buttons(void){	button_handler_t *handler = button_handlers;	printk("Cheking buttons\n");	while (handler != NULL) {		if (handler->func()) {	/* If button is pressed */			if (handler->name != NULL)				printk("  Detected %s button.\n", handler->name);			add_linux_cmd_line(handler->cmdstr);		}		if (handler->next != NULL)			handler = handler->next;		else			handler = NULL;	}}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?