コード例 #1
0
ファイル: UARTUtils.c プロジェクト: NatCain/KIRC_Software
/*
 *  ======== closeHandle ========
 */
static Void closeHandle(Int index)
{
    ports[index].open--;
    if (ports[index].open == 0) {
        UART_close(ports[index].handle);
    }
}
コード例 #2
0
void hm10_end(){
	if(uart != NULL)
	{
		hm10_initialised = 0;
		UART_close(uart);
		uart = NULL;
	}
}
コード例 #3
0
ファイル: BtStack.c プロジェクト: sudo-g/Matilda
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;
}
コード例 #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;
}
コード例 #5
0
ファイル: sdi_tl_uart.c プロジェクト: 247765843/ble_examples
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);
}
コード例 #6
0
ファイル: sbl_tl.c プロジェクト: PolymorphicLabs/PML-Firmware
/**
 * @fn      SBL_TL_close
 *
 * @brief   Close interface to target device
 *
 * @param   None.
 *
 * @return  None.
 */
void SBL_TL_close(void)
{
  UART_close(sblUartHandle);
} 
コード例 #7
0
ファイル: npi_tl_uart.c プロジェクト: kfurlong/sensortag
// -----------------------------------------------------------------------------
//! \brief      This routine closes Transport Layer port
//!
//! \return     void
// -----------------------------------------------------------------------------
void NPITLUART_closeTransport(void)
{
    UART_close(uartHandle);
}
コード例 #8
0
ファイル: UARTConsole.c プロジェクト: GisKook/smarthomebox
/*!
 *  @brief  Closes the UART console
 *
 *  @param  None
 *  @return None
 */
void UARTConsole_close()
{
	UART_close(handle);
}
コード例 #9
0
// -----------------------------------------------------------------------------
//! \brief      This routine closes Transport Layer port           
//!
//! \return     void
// -----------------------------------------------------------------------------
void NPITLUART_closeTransport(void)
{
  UART_readCancel(uartHandle);
  UART_close(uartHandle);
}
コード例 #10
0
void sim800_end(){
	UART_close(uart);
	uart = NULL;
}