Reputation: 95
I have two function definitions
void USART_puts(USART_TypeDef* USARTx, volatile char *s)
{
.....
}
void send_packet(char op, unsigned char *data, unsigned char len)
{
....
}
now I have created a function pointer for send_packet(char,unsigned char*,unsigned char) as
void (*send_packet)(char,unsigned char*,unsigned char);
I want to pass this function pointer like this
USART_Puts(USART1,send_packet)
But I am getting an error " argument of type send_packet * is incompatible with type volatile char * " I can understand from the error that two arguments are not matching. But can anyone please tell me how can I pass this function pointer?
Upvotes: 1
Views: 1002
Reputation: 137770
USART_Puts
needs to have a parameter of function pointer type.
void USART_puts(USART_TypeDef* USARTx, void (*s)(char,unsigned char*,unsigned char))
The definition of send_packet
as a pointer after its definition as a function is unnecessary. Two such declarations of the same name should not even coexist.
Upvotes: 1