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).
已解决! 转到解答。
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!
-----------------------------------------------------------------------------------------------------------------------
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!
-----------------------------------------------------------------------------------------------------------------------