0
問題,我試圖調用庫函數與簽名與結構
void GPIO_Init(GPIO_InitTypeDef* GPIO_InitStruct)
其中GPIO_InitTypeDef
是typedef
結構。
我曾嘗試做如下:
GPIO_InitTypeDef NE1 = {
7, GPIO_Mode_AF, GPIO_Speed_25MHz, GPIO_OType_PP, GPIO_PuPd_UP
};
GPIO_Init(NE1);
但我得到一個編譯器錯誤
error: incompatible type for argument 1 of 'GPIO_Init' expected 'struct GPIO_InitTypeDef *' but argument is of type 'GPIO_InitTypeDef'
我也使用struct
關鍵字嘗試:
struct GPIO_InitTypeDef NE1 = {
7, GPIO_Mode_AF, GPIO_Speed_25MHz, GPIO_OType_PP, GPIO_PuPd_UP
};
GPIO_Init(NE1);
但他們我得到編譯器錯誤
error: storage size of 'NE1' isn't known
我做錯了什麼,以及什麼是正確的方法叫GPIO_Init
?
謝謝。我想這整個混亂來自我不正確理解我在做什麼。你能解釋一下嗎? – Randomblue 2012-03-15 09:01:23
@Randomblue,當然,我已經添加了一些額外的信息,希望更清楚。 – paxdiablo 2012-03-15 09:03:54