Hi all,
Can someone help me figure out whats worng with my code?
I’m trying to capture when the DTR signal from UART1 changes but haven’t been able to get it yet. See code below…
//UART1 - Capture Signal Changes
#include "adl_global.h"
#include "adl_OpenDevice.h"
#include "wm_uart.h"
#include "adl_traces.h"
static psGItfCont_t uart_if;
static u32 uart_hdl;
//static s32 EventHandle;
/***************************************************************************/
/* Mandatory variables */
/*-------------------------------------------------------------------------*/
/* wm_apmCustomStackSize */
/*-------------------------------------------------------------------------*/
/***************************************************************************/
const u16 wm_apmCustomStackSize = 1024*3;
/***************************************************************************/
/* Local functions */
/***************************************************************************/
/* callback declaration */
//static void uart_OnSigStateChange( void* user_data, psUartCbOssc_t psSigState );
/***************************************************************************/
/* UART Callback */
/***************************************************************************/
void uart_OnSigStateChange (void* user_data, psUartCbOssc_t psSigState)
{
adl_atSendResponse(ADL_AT_RSP, "\r\nEVENT : SIG CHANGE delta state \r\n");
//adl_atSendResponse(ADL_AT_RSP, (char*)psSigState->delta );
//adl_atSendResponse(ADL_AT_RSP, (char*)psSigState->state );
TRACE ((1, "EVENT : SIG CHANGE delta %x state %x",psSigState->delta,psSigState->state));
}
/***************************************************************************/
/* Function : adl_main */
/*-------------------------------------------------------------------------*/
/* Object : Customer application initialization */
/*-------------------------------------------------------------------------*/
/* Variable Name |IN |OUT|GLB| Utilization */
/*--------------------+---+---+---+----------------------------------------*/
/* | | | | */
/*--------------------+---+---+---+----------------------------------------*/
/***************************************************************************/
void adl_main ( adl_InitType_e InitType )
{
TRACE (( 1, "My Tests Start" ));
sUartSettings_t settings;
sUartLc_t line_coding;
sUartEvent_t events;
// Set the line coding parameters
line_coding.valid_fields = UART_LC_ALL;
line_coding.rate = (eUartRate_t)( UART_RATE_USER_DEF | 115200 );
line_coding.stop = UART_STOP_BIT_1;
line_coding.data = UART_DATALENGTH_8;
line_coding.parity = UART_PARITY_NONE;
/* Events */
events.user_data = (void*)0;
events.op = G_IOC_OP_GET;
events.valid_cb = UART_CB_ON_SIG_STATE_CHANGE;
events.cb_list[3].evt_hdl = (pGEvtNotif_t)&uart_OnSigStateChange ;
//events.cb_list[3].user_data = (void*)0;
// UART1 will be opened in DCE role
settings.identity = "UART1";
settings.role = UART_ROLE_DCE;
settings.capabilities = NULL;
settings.event_handlers = &events;
settings.interface = &uart_if;
settings.line_coding = &line_coding;
// Open UART1
adl_atSendResponse(ADL_AT_RSP, "\r\nTesting Start...\r\n");
TRACE (( 1, "Opening UART1..." ));
uart_hdl = adl_OpenDevice( DF_UART_CLID, &settings );
TRACE (( 1, "UART return = %d", uart_hdl ));
if( !uart_hdl )
{
// UART1 opening failed...
adl_atSendResponse(ADL_AT_RSP, "\r\nUART Open Failed...\r\n");
TRACE (( 1, "UART1 failed to open" ));
return;
}
else
{
// UART1 successfully opened
adl_atSendResponse(ADL_AT_RSP, "\r\nUART1 Opened Successfully...\r\n");
}
}
Any help will be greatly appreciated. Thanks.
Eddie