|
回調函數(shù)的出現(xiàn),實際上是使用協(xié)議棧直接接口實現(xiàn)web服務器的結果。
3步曲:
一:初始化函數(shù)
void httpd_init(void)-->
二:設置新的連接到達時,調用函數(shù)http_accept
static err_t http_accept(void *arg, struct tcp_pcb *pcb, err_terr)-->
三:當一個TCP段到達這個連接時,調用函數(shù)My_http_recv
static err_t My_http_recv(void *arg, struct tcp_pcb *pcb, structpbuf *p, err_t err)
多類似,CC1100的驅動代碼呀。
當接收到數(shù)據(jù),跳轉到中斷服務程序去獲取CC1100接收到的數(shù)據(jù)。
回調函數(shù)類似中斷復位函數(shù)。
|
|