Example #1
0
/*
 *  ======== closeHandle ========
 */
static Void closeHandle(Int index)
{
    ports[index].open--;
    if (ports[index].open == 0) {
        UART_close(ports[index].handle);
    }
}
void hm10_end(){
	if(uart != NULL)
	{
		hm10_initialised = 0;
		UART_close(uart);
		uart = NULL;
	}
}
Example #3
0
int8_t BtStack_push(const BtStack_Frame* frame)
{
	// special character declarations
	const char escapedEnd[] = {SLIP_ESC, SLIP_ESC_END};	// escaped 0xC0
	const char escapedEsc[] = {SLIP_ESC, SLIP_ESC_ESC};	// escaped 0xDB

	char sendStream[KFP_WORST_SIZE];
	uint8_t sentChar = 0;

	// append start character
	sendStream[0] = SLIP_END;
	sentChar++;

	// iterate through frame adding ESC characters where necessary
	uint8_t i;
	for (i=0; i<KFP_FRAME_SIZE-2; i++)
	{
		switch(frame->b8[i])
		{
		case(SLIP_END):
				// escape END character
				strncat(sendStream, escapedEnd, 2);
				sentChar+=2;
				break;
		case(SLIP_ESC):
				// escape ESC character
				strncat(sendStream, escapedEsc, 2);
				sentChar+=2;
				break;
		default:
				sendStream[sentChar] = frame->b8[i];
				sentChar++;
		}
	}

	// append end character
	sendStream[sentChar] = SLIP_END;
	sentChar++;

	// prepare UART socket
	UART_Handle s;
	UART_Params params;
	UART_Params_init(&params);
	params.baudRate = uartBaud;
	params.writeMode = UART_MODE_BLOCKING;
	params.writeDataMode = UART_DATA_BINARY;
	params.readDataMode = UART_DATA_BINARY;
	params.readReturnMode = UART_RETURN_FULL;
	params.readEcho = UART_ECHO_OFF;
	s = UART_open(Board_BT1, &params);

	// write to socket and close once complete
	int8_t ret = UART_write(s, sendStream, sentChar);
	UART_close(s);

	return ret;
}
Example #4
0
/*********************************************************************
 * @fn      rpcTransportClose
 *
 * @brief   closes the serial port to the CC253x.
 *
 * @param   fd - file descriptor of the UART device
 *
 * @return  status
 */
void rpcTransportClose(void)
{
	if (uart != NULL)
	{
		// call TI-RTOS driver
		UART_close(uart);
	}

	return;
}
Example #5
0
void SDITLUART_closeUART(void)
{
  ICall_CSState key;
  
  key = ICall_enterCriticalSection();
  
  // Cancel any pending reads
  UART_readCancel(uartHandle);
  
  // Close / power off the UART.
  UART_close(uartHandle);
  
  ICall_leaveCriticalSection(key);
}
Example #6
0
/**
 * @fn      SBL_TL_close
 *
 * @brief   Close interface to target device
 *
 * @param   None.
 *
 * @return  None.
 */
void SBL_TL_close(void)
{
  UART_close(sblUartHandle);
} 
Example #7
0
// -----------------------------------------------------------------------------
//! \brief      This routine closes Transport Layer port
//!
//! \return     void
// -----------------------------------------------------------------------------
void NPITLUART_closeTransport(void)
{
    UART_close(uartHandle);
}
Example #8
0
/*!
 *  @brief  Closes the UART console
 *
 *  @param  None
 *  @return None
 */
void UARTConsole_close()
{
	UART_close(handle);
}
// -----------------------------------------------------------------------------
//! \brief      This routine closes Transport Layer port           
//!
//! \return     void
// -----------------------------------------------------------------------------
void NPITLUART_closeTransport(void)
{
  UART_readCancel(uartHandle);
  UART_close(uartHandle);
}
void sim800_end(){
	UART_close(uart);
	uart = NULL;
}