本文整理汇总了C++中rt_device_t::rx_indicate方法的典型用法代码示例。如果您正苦于以下问题:C++ rt_device_t::rx_indicate方法的具体用法?C++ rt_device_t::rx_indicate怎么用?C++ rt_device_t::rx_indicate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rt_device_t
的用法示例。
在下文中一共展示了rt_device_t::rx_indicate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rt_hw_serial_isr
/* ISR for serial interrupt */
void rt_hw_serial_isr(rt_device_t device)
{
struct serial_device* uart = (struct serial_device*) device->user_data;
/* interrupt mode receive */
RT_ASSERT(device->flag & RT_DEVICE_FLAG_INT_RX);
/* save on rx buffer */
while (uart->uart_device->ustat & USTAT_RCV_READY)
{
rt_serial_savechar(uart, uart->uart_device->urxh & 0xff);
}
/* invoke callback */
if (device->rx_indicate != RT_NULL)
{
rt_size_t rx_length;
/* get rx length */
rx_length = uart->int_rx->read_index > uart->int_rx->save_index ?
UART_RX_BUFFER_SIZE - uart->int_rx->read_index + uart->int_rx->save_index :
uart->int_rx->save_index - uart->int_rx->read_index;
device->rx_indicate(device, rx_length);
}
}
示例2: rt_hw_serial_isr
/* ISR for serial interrupt */
void rt_hw_serial_isr(rt_device_t device)
{
struct stm32_serial_device* uart = (struct stm32_serial_device*) device->user_data;
if(USART_GetITStatus(uart->uart_device, USART_IT_RXNE) != RESET)
{
/* interrupt mode receive */
RT_ASSERT(device->flag & RT_DEVICE_FLAG_INT_RX);
/* save on rx buffer */
while (uart->uart_device->SR & USART_FLAG_RXNE)
{
rt_base_t level;
/* disable interrupt */
level = rt_hw_interrupt_disable();
/* save character */
uart->int_rx->rx_buffer[uart->int_rx->save_index] = uart->uart_device->DR & 0xff;
uart->int_rx->save_index ++;
if (uart->int_rx->save_index >= UART_RX_BUFFER_SIZE)
uart->int_rx->save_index = 0;
/* if the next position is read index, discard this 'read char' */
if (uart->int_rx->save_index == uart->int_rx->read_index)
{
uart->int_rx->read_index ++;
if (uart->int_rx->read_index >= UART_RX_BUFFER_SIZE)
uart->int_rx->read_index = 0;
}
/* enable interrupt */
rt_hw_interrupt_enable(level);
}
/* clear interrupt */
USART_ClearITPendingBit(uart->uart_device, USART_IT_RXNE);
/* invoke callback */
if (device->rx_indicate != RT_NULL)
{
rt_size_t rx_length;
/* get rx length */
rx_length = uart->int_rx->read_index > uart->int_rx->save_index ?
UART_RX_BUFFER_SIZE - uart->int_rx->read_index + uart->int_rx->save_index :
uart->int_rx->save_index - uart->int_rx->read_index;
device->rx_indicate(device, rx_length);
}
}
if (USART_GetITStatus(uart->uart_device, USART_IT_TC) != RESET)
{
/* clear interrupt */
USART_ClearITPendingBit(uart->uart_device, USART_IT_TC);
}
}
示例3: rt_hw_serial_isr
//.........这里部分代码省略.........
&&(gprmcbuf[3] =='G')&&(gprmcbuf[4] == 'A'))
{
isgprmc =1;//位置信息
}
if ( (gprmcbuf[0] == 'G')
&&(gprmcbuf[1] == 'P')&&(gprmcbuf[2] =='V')
&&(gprmcbuf[3] == 'T')&&(gprmcbuf[4] == 'G'))
{
isgprmc =2;//速度信息
uart3flag =2;
}
}
break;
case FIELD_ONE://提取时间
uart3flag =1;
if(isgprmc == 1)
{
if(gprmccnt == 10 )
{
//get the time
GetTheGPSTime(gprmcbuf);
}
}
break;
case FIELD_TWO: //判断数据是否可信(当GPS天线能接收到有3颗GPS卫星时为A,可信
if(isgprmc == 1)
{
if(gprmccnt == 9 )
{
//get the time
GetGPSLocation1(gprmcbuf);
}
}
break;
case FIELD_THREE://提取出纬度
break;
case FIELD_FOUR://提取出速度
if(isgprmc == 1)
{
if(gprmccnt == 10 )
{
//get the time
GetGPSLocation2(gprmcbuf);
}
}
break;
case FIELD_FIVE://提取出经度
break;
case FIELD_SEVEN:
if(isgprmc == 1)
{
if(gprmccnt == 2 )
{
//get the singal
GettheSinaldata(gprmcbuf);
}
}
break;
case FIELD_NIGHT://提取高度
break;
default:
break;
}
}
}
if((&uart4_device )== device)
{
gprmcbuf[gprmccnt] = uart->uart_device->DR & 0xff;
gprmccnt++;
}
/* enable interrupt */
rt_hw_interrupt_enable(level);
}
/* clear interrupt */
USART_ClearITPendingBit(uart->uart_device, USART_IT_RXNE);
/* invoke callback */
if (device->rx_indicate != RT_NULL)
{
rt_size_t rx_length;
/* get rx length */
rx_length = uart->int_rx->read_index > uart->int_rx->save_index ?
UART_RX_BUFFER_SIZE - uart->int_rx->read_index + uart->int_rx->save_index :
uart->int_rx->save_index - uart->int_rx->read_index;
device->rx_indicate(device, rx_length);
}
}
if (USART_GetITStatus(uart->uart_device, USART_IT_TC) != RESET)
{
/* clear interrupt */
USART_ClearITPendingBit(uart->uart_device, USART_IT_TC);
}
}
示例4: rt_hw_usart_rx_isr
/***************************************************************************//**
* @brief
* USART RX data valid interrupt handler
*
* @details
*
* @note
* 9-bit SPI mode has not implemented yet and SPI slave mode is untested
*
* @param[in] dev
* Pointer to device descriptor
******************************************************************************/
void rt_hw_usart_rx_isr(rt_device_t dev)
{
struct efm32_usart_device_t *usart;
struct efm32_usart_int_mode_t *int_rx;
rt_uint32_t flag;
/* interrupt mode receive */
RT_ASSERT(dev->flag & RT_DEVICE_FLAG_INT_RX);
usart = (struct efm32_usart_device_t *)(dev->user_data);
int_rx = (struct efm32_usart_int_mode_t *)(usart->rx_mode);
RT_ASSERT(int_rx->data_ptr != RT_NULL);
#if defined(UART_PRESENT)
if (usart->state & USART_STATE_ASYNC_ONLY)
{
flag = UART_STATUS_RXDATAV;
}
else
#endif
{
flag = USART_STATUS_RXDATAV;
}
/* Set status */
usart->state |= USART_STATE_RX_BUSY;
/* save into rx buffer */
while (usart->usart_device->STATUS & flag)
{
rt_base_t level;
/* disable interrupt */
level = rt_hw_interrupt_disable();
/* save character */
int_rx->data_ptr[int_rx->save_index] = \
(rt_uint8_t)(usart->usart_device->RXDATA & 0xFFUL);
int_rx->save_index ++;
if (int_rx->save_index >= USART_RX_BUFFER_SIZE)
int_rx->save_index = 0;
/* if the next position is read index, discard this 'read char' */
if (int_rx->save_index == int_rx->read_index)
{
int_rx->read_index ++;
if (int_rx->read_index >= USART_RX_BUFFER_SIZE)
{
int_rx->read_index = 0;
}
}
/* enable interrupt */
rt_hw_interrupt_enable(level);
}
/* invoke callback */
if (dev->rx_indicate != RT_NULL)
{
rt_size_t rx_length;
/* get rx length */
rx_length = int_rx->read_index > int_rx->save_index ?
USART_RX_BUFFER_SIZE - int_rx->read_index + int_rx->save_index : \
int_rx->save_index - int_rx->read_index;
dev->rx_indicate(dev, rx_length);
}
}