I am following a couple examples and all of them use the callback function:
void user_uart_callback(uart_callback_args_t * p_args)
The problem is that I keep getting the warning/error:
Description Resource Path Location Type
no previous declaration for 'user_uart_callback' [-Wmissing-declarations] uart_thread0_entry.c /GUIApp/src line 14 C/C++ Problem
I do not understand why I am getting this error and how to fix it. in the screenshot below there is a locked Name of UART callback function to be defined by user to NULL, is that it?
thank you,
Victor
here is my code:
#include "uart_thread0.h"
#include <stdio.h>
#include "tx_api.h"
#include "gx_api.h"
static uint32_t g_arg_event;
extern void uart_thread0_entry(void);
char number = 0;
// Callback Function for UART interrupts
void user_uart_callback(uart_callback_args_t * p_args)
{
// Get Event Type
switch (p_args->event)
{
// Transmission Complete
case UART_EVENT_TX_COMPLETE:
//transmitComplete = true;
break;
// Received Character
case UART_EVENT_RX_CHAR:
//add to buffer here
break;
default: break;
}
}
// uart Thread entry function
void uart_thread0_entry(void)
{
R_BSP_SoftwareDelay(500, BSP_DELAY_UNITS_MILLISECONDS);
g_uart0.p_api->open(g_uart0.p_ctrl, g_uart0.p_cfg);
g_arg_event = UART_EVENT_TX_COMPLETE;
while (1)
{
if (UART_EVENT_TX_COMPLETE & g_arg_event)
{
g_arg_event &= ~((uint32_t) UART_EVENT_TX_COMPLETE);
uint8_t string[14] = "Synergy Test\n\r";
g_uart0.p_api->write (g_uart0.p_ctrl, string, 14);
if (number)
{
g_ioport.p_api->pinWrite (IOPORT_PORT_06_PIN_00, IOPORT_LEVEL_HIGH);
number = 0;
}
else
{
g_ioport.p_api->pinWrite (IOPORT_PORT_06_PIN_00, IOPORT_LEVEL_LOW);
number = 1;
}
}
g_arg_event = UART_EVENT_TX_COMPLETE;
}
}