gpio口 核心定時器使用

2021-09-22 06:51:24 字數 918 閱讀 3838

/*申請gpio*/

int gpio_request(unsigned gpio, const char *label);

/*設定gpio為輸入狀態,即設定如(gph0con)*/

int gpio_direction_input(unsigned gpio);

/*設定gpio為輸出狀態,即設定如(gph0con)*/

int gpio_direction_output(unsigned gpio, int value);

/*設定gpio為輸入或輸出狀態,即設定如(gph0con)*/

int s3c_gpio_cfgpin(unsigned int pin, unsigned int config);

/*讀取gpio的值,0或1.即讀取(gphodat)

*/int gpio_get_value(unsigned gpio);

/*向gpio設定值,0或1,即設定(gphodat)

*/void gpio_set_value(unsigned gpio, int value);

struct timer_list timer;

init_timer(&timer);

timer.function = &gpio_check_button;

timer.data = (unsigned long)bdata;

timer.expires = jiffies + msecs_to_jiffies(500);

add_timer(&timer);/*核心定時器第一次用*/

mod_timer(&timer, jiffies + msecs_to_jiffies(500));/*核心定時器第二次用*/

在中斷服務程式中,新增核心定時器,服務程式執行完才開始新增定時器,開始計時。

定時器使用

dword winapi checksendinfovector lpvoid lpparameter return 0 void callback dotimer hwnd hwnd,uint umsg,uint ptr idevent,dword dwtime timerproc的引數hwnd是...

Delphi Timer定時器使用

timer定時器是乙個非視覺化元件,能夠定時觸發ontimer事件,完成模擬時鐘 系統延時 倒計時等工作。在system選項卡中。1 timer的主要屬性 1 enabled屬性 當值為true時,開啟定時器,否則關閉定時器。預設值為true。2 interval屬性 控制ontimer事件觸發的時...

workman定時器使用

workerman 定時器例子,可單獨使用,稍加改善可以開啟乙個守護程序,用來做一些定時發布等等類似的任務,使用方便,不需要額外的擴充套件或者類似 crontab 等工具。以下是測試程式 php view plain copy use workerman autoloader use workerm...