本文整理汇总了C++中UART_Send函数的典型用法代码示例。如果您正苦于以下问题:C++ UART_Send函数的具体用法?C++ UART_Send怎么用?C++ UART_Send使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了UART_Send函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: putchar3
void putchar3(int ch)
{
unsigned char buf[2] = {0};
buf[0] = ch;
if (ch == '\n') {
buf[1] = '\n';
buf[0] = '\r';
UART_Send((LPC_UART_TypeDef *)FPGA_UART3_PORT, (unsigned char *)buf, 2, BLOCKING);
} else {
UART_Send((LPC_UART_TypeDef *)FPGA_UART3_PORT, (unsigned char *)buf, 1, BLOCKING);
}
}
示例2: SendCOM0
uint8 SendCOM0(void *buf,uint32 len)
{
uint8 station;
if( (!len) )
{
return FALSE;
}
station = GetUart0Status();
while(!(station & (0x01<<6)))
{
station = GetUart0Status();
}
WriteEN_485_0(1);
UART_Send((LPC_UART_TypeDef *)LPC_UART0,buf,len,BLOCKING);
station = GetUart0Status();
while(!(station & (0x01<<6)))
{
station = GetUart0Status();
}
WriteEN_485_0(0);
return TRUE;
}
示例3: CheckForFwIdentMessage
static void CheckForFwIdentMessage()
{
g_Odd_STX_Received = !g_Odd_STX_Received;
if (g_Odd_STX_Received == FALSE) {
UART_Send(FW_IDENT);
}
}
示例4: rt_uart_write
static rt_size_t rt_uart_write(rt_device_t dev, rt_off_t pos, const void* buffer, rt_size_t size)
{
struct rt_uart_lpc *uart = (struct rt_uart_lpc*)dev;
char *ptr;
ptr = (char*)buffer;
if (dev->flag & RT_DEVICE_FLAG_STREAM)
{
/* stream mode */
while (size)
{
if (*ptr == '\n')
{
while (!(uart->UART->LSR & UART_LSR_THRE));
UART_SendByte( uart->UART,'\r');
}
while (!(uart->UART->LSR & UART_LSR_THRE));
UART_SendByte( uart->UART,*ptr);
ptr ++;
size --;
}
}
else
{
UART_Send( uart->UART, (uint8_t *)buffer, size, BLOCKING);
}
return (rt_size_t) ptr - (rt_size_t) buffer;
}
示例5: UART1_IntTransmit
/********************************************************************//**
* @brief UART transmit function (ring buffer used)
* @param[in] None
* @return None
*********************************************************************/
void UART1_IntTransmit(void)
{
// Disable THRE interrupt
UART_IntConfig((LPC_UART_TypeDef *)LPC_UART1, UART_INTCFG_THRE, DISABLE);
/* Wait for FIFO buffer empty, transfer UART_TX_FIFO_SIZE bytes
* of data or break whenever ring buffers are empty */
/* Wait until THR empty */
while (UART_CheckBusy((LPC_UART_TypeDef *)LPC_UART1) == SET);
while (!__BUF_IS_EMPTY(rb.tx_head,rb.tx_tail))
{
/* Move a piece of data into the transmit FIFO */
if (UART_Send((LPC_UART_TypeDef *)LPC_UART1, (uint8_t *)&rb.tx[rb.tx_tail], \
1, NONE_BLOCKING)){
/* Update transmit ring FIFO tail pointer */
__BUF_INCR(rb.tx_tail);
} else {
break;
}
}
/* If there is no more data to send, disable the transmit
interrupt - else enable it or keep it enabled */
if (__BUF_IS_EMPTY(rb.tx_head, rb.tx_tail)) {
UART_IntConfig((LPC_UART_TypeDef *)LPC_UART1, UART_INTCFG_THRE, DISABLE);
// Reset Tx Interrupt state
TxIntStat = RESET;
}
else{
// Set Tx Interrupt state
TxIntStat = SET;
UART_IntConfig((LPC_UART_TypeDef *)LPC_UART1, UART_INTCFG_THRE, ENABLE);
}
}
示例6: GSM_SerialSendString
static uint32_t GSM_SerialSendString(uint8_t* ptr )
{
uint32_t nrOfBytesSend;
nrOfBytesSend = UART_Send(UARTx, ptr, buffLength(ptr), BLOCKING);
while(UART_CheckBusy(UARTx));
return nrOfBytesSend;
}
示例7: serialUSBWrite
int serialUSBWrite(char *buffer) {
int string_len;
string_len = strlen(buffer);
return(UART_Send((LPC_UART_TypeDef *)LPC_UART0,
(uint8_t *)buffer, string_len, BLOCKING));
}
示例8: uart_putchar
/** @brief Send a character via UART
*
* @param [in] uart The UART on which to send the character
* @param [in] c The character to send
*
* @return None.
*
* Blocks until the UART is ready to accept the new character, then
* writes it.
*/
void uart_putchar(UART_Type *uart, uint8_t c)
{
/* Wait for tx holding register to empty */
while ((UART_GetLineStatus(uart) & UART_LineStatus_TxEmpty) == 0);
/* Send character */
UART_Send(uart, c);
}
示例9: UART_RS485Send
/*********************************************************************//**
* @brief Send data on RS485 bus with specified parity stick value (9-bit mode).
* @param[in] UARTx LPC_UART1 (only)
* @param[in] pDatFrm Pointer to data frame.
* @param[in] size Size of data.
* @param[in] ParityStick Parity Stick value, should be 0 or 1.
* @return None
**********************************************************************/
uint32_t UART_RS485Send(LPC_UART1_TypeDef *UARTx, uint8_t *pDatFrm, \
uint32_t size, uint8_t ParityStick)
{
uint8_t tmp, save;
uint32_t cnt;
if (ParityStick){
save = tmp = UARTx->LCR & UART_LCR_BITMASK;
tmp &= ~(UART_LCR_PARITY_EVEN);
UARTx->LCR = tmp;
cnt = UART_Send((LPC_UART_TypeDef *)UARTx, pDatFrm, size, BLOCKING);
while (!(UARTx->LSR & UART_LSR_TEMT));
UARTx->LCR = save;
} else {
cnt = UART_Send((LPC_UART_TypeDef *)UARTx, pDatFrm, size, BLOCKING);
while (!(UARTx->LSR & UART_LSR_TEMT));
}
return cnt;
}
示例10: __putchar
void __putchar(int ch)
{
unsigned char buf[2] = {0};
buf[0] = ch & 0xff;
if (ch == 0xa) {
buf[0] = 0xa;
buf[1] = 0;
//UART_Send((LPC_UART_TypeDef *)CONSOLE_UART_PORT, (unsigned char *)buf, 2, BLOCKING);
UART_Send((LPC_UART_TypeDef *)CONSOLE_UART_PORT, (unsigned char *)buf, 1, BLOCKING);
buf[0] = 0xd;
buf[1] = 0;
UART_Send((LPC_UART_TypeDef *)CONSOLE_UART_PORT, (unsigned char *)buf, 1, BLOCKING);
} else {
UART_Send((LPC_UART_TypeDef *)CONSOLE_UART_PORT, (unsigned char *)buf, 1, BLOCKING);
}
}
示例11: GPS_Wakeup
void GPS_Wakeup()
{
CLKPWR_ConfigPPWR (CLKPWR_PCONP_PCUART3, ENABLE);
//Send GPS Sleep command
uint8_t wakeCmd = ' ';
UART_Send(UART_3, &wakeCmd, 1, BLOCKING);
//Set state to GPS on
gpsActive = 1;
}
示例12: panic_internal
void ATTR_VISIBLE panic_internal(const char *fmt, ...) {
va_list va;
char buffer[80];
int n;
va_start(va, fmt);
n = vsnprintf(buffer, sizeof(buffer) - 2, fmt, va);
if (n > (sizeof(buffer) - 2))
n = sizeof(buffer) - 2;
buffer[n] = '\r';
buffer[n + 1] = '\n';
UART_Send(DEBUG_UART, (uint8_t *) PANIC_STRING, sizeof(PANIC_STRING),
BLOCKING);
UART_Send(DEBUG_UART, (uint8_t *) buffer, n + 2, BLOCKING);
while (1);
}
示例13: GPS_Sleep
void GPS_Sleep()
{
//Send GPS Sleep command
uint8_t* sleepCmd = (uint8_t*)"$PMTK161,0*28\r\n";
UART_Send(UART_3, sleepCmd, 15, BLOCKING);
CLKPWR_ConfigPPWR (CLKPWR_PCONP_PCUART3, DISABLE);
//Set state to GPS off
gpsActive = 0;
gpsData.valid = 0;
}
示例14: SND_SetVol
void SND_SetVol(uint8_t SndVol)
{
uint8_t vol = 0;
if(SndVol < SND_VOL_MIN)
vol = SND_VOL_MIN;
else if(SndVol > SND_VOL_MAX)
vol = SND_VOL_MAX;
else
vol = SndVol;
UART_Send(UART_2, VOL[vol], 5, BLOCKING);
}
示例15: SND_SelectID
void SND_SelectID(uint8_t SndID)
{
uint8_t id = 0;
if(SndID < SND_ID_MIN)
id = SND_ID_MIN;
else if(SndID > SND_ID_MAX)
id = SND_ID_MAX;
else
id = SndID;
UART_Send(UART_2, SND[SndID-1], 6, BLOCKING);
}