compiler warning for fsl_gpio.h

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

compiler warning for fsl_gpio.h

跳至解决方案
1,074 次查看
randylee
Contributor V

Using MCUexpresso 10.2 I get a compiler warning message:

../drivers/fsl_gpio.h:161:20: note: expected 'GPIO_Type * {aka struct <anonymous> *}' but argument is of type 'PORT_Type * {aka struct <anonymous> *}'
 static inline void GPIO_PinWrite(GPIO_Type *base, uint32_t pin, uint8_t output)

when using e.g. GPIO_PinWrite(BOARD_PWR_ON_PORT, BOARD_PWR_ON_PIN, 0);

pinmux.h has:

#define BOARD_PWR_ON_PORT PORTC /*!<@brief PORT device name: PORTC */

MK22FN512.h has:

/** Peripheral PORTC base address */
#define PORTC_BASE                               (0x4004B000u)
/** Peripheral PORTC base pointer */
#define PORTC                                    ((PORT_Type *)PORTC_BASE)

so somewhere along the line the compiler is getting plenty confused by something.  Since it's a warning, I'm only a little annoyed by it, but I really don't want that warning in there (and there are a lot of those kinds of warnings).

标签 (1)
0 项奖励
回复
1 解答
894 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello RANDY LEE,

Please change

#define BOARD_PWR_ON_PORT PORTC

to

#define BOARD_PWR_ON_PORT GPIOC 

the warning will be disappear. 

From the definition of function GPIO_PinWrite:

static inline void GPIO_PinWrite(GPIO_Type *base, uint32_t pin, uint8_t output)

the parameter type is GPIO_Type * .

Hope it helps,


Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

在原帖中查看解决方案

0 项奖励
回复
2 回复数
894 次查看
randylee
Contributor V

thanx...  yes my eyes are playing tricks on me apparently. Sorry...

0 项奖励
回复
895 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello RANDY LEE,

Please change

#define BOARD_PWR_ON_PORT PORTC

to

#define BOARD_PWR_ON_PORT GPIOC 

the warning will be disappear. 

From the definition of function GPIO_PinWrite:

static inline void GPIO_PinWrite(GPIO_Type *base, uint32_t pin, uint8_t output)

the parameter type is GPIO_Type * .

Hope it helps,


Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复