• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ tSpiInformation类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中tSpiInformation的典型用法代码示例。如果您正苦于以下问题:C++ tSpiInformation类的具体用法?C++ tSpiInformation怎么用?C++ tSpiInformation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了tSpiInformation类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: SpiPauseSpi

void
SpiTriggerRxProcessing(void)
{

    // Trigger Rx processing
    SpiPauseSpi();
    DEASSERT_CS();

    // The magic number that resides at the end of the TX/RX buffer (1 byte after
    // the allocated size) for the purpose of detection of the overrun. If the
    // magic number is overwritten - buffer overrun occurred - and we will stuck
    // here forever!
    if (sSpiInformation.pRxPacket[CC3000_RX_BUFFER_SIZE - 1] != CC3000_BUFFER_MAGIC_NUMBER)
    {
        while (1)
            ;
    }

    sSpiInformation.ulSpiState = eSPI_STATE_IDLE;
    sSpiInformation.SPIRxHandler(sSpiInformation.pRxPacket + SPI_HEADER_SIZE);
}
开发者ID:Hmaal,项目名称:Espruino,代码行数:21,代码来源:board_spi.c


示例2: SpiTriggerRxProcessing

//*****************************************************************************
//
//! This function enter point for write flow
//!
//!  \param  SpiTriggerRxProcessing
//!
//!  \return none
//!
//!  \brief  The function triggers a user provided callback for 
//
//*****************************************************************************
void SpiTriggerRxProcessing(void)
{
  //
  // Trigger Rx processing
  //
  SpiPauseSpi();
  negate_cs();

  // The magic number that resides at the end of the TX/RX buffer (1 byte after
  // the allocated size) for the purpose of detection of the overrun.
  // If the magic number is overriten - a buffer overrun has occurred - and we
  // will stay here forever!
  if (sSpiInformation.pRxPacket[CC3000_RX_BUFFER_SIZE - 1]
      != CC3000_BUFFER_MAGIC_NUMBER) {
    lSer.println ("Error: buffer overwritten !");
    while (1);
  }

  sSpiInformation.ulSpiState = eSPI_STATE_IDLE;
  sSpiInformation.SPIRxHandler(sSpiInformation.pRxPacket + SPI_HEADER_SIZE);
}
开发者ID:WickedDevice,项目名称:SP3000,代码行数:32,代码来源:spi.cpp


示例3: SpiTriggerRxProcessing

void SpiTriggerRxProcessing(void)
{
  DEBUGPRINT_F("\tCC3000: SpiTriggerRxProcessing\n\r");

  /* Trigger Rx processing */
  SpiPauseSpi();
  CC3000_DEASSERT_CS;

  //DEBUGPRINT_F("Magic?\n\r");
  /* The magic number that resides at the end of the TX/RX buffer (1 byte after the allocated size)
   * for the purpose of detection of the overrun. If the magic number is overriten - buffer overrun
   * occurred - and we will stuck here forever! */
  if (sSpiInformation.pRxPacket[CC3000_RX_BUFFER_SIZE - 1] != CC3000_BUFFER_MAGIC_NUMBER)
  {
    /* You've got problems if you're here! */
    DEBUGPRINT_F("\tCC3000: ERROR - magic number missing!\n\r");
    while (1);
  }

  //DEBUGPRINT_F("OK!\n\r");
  sSpiInformation.ulSpiState = eSPI_STATE_IDLE;
  sSpiInformation.SPIRxHandler(sSpiInformation.pRxPacket + SPI_HEADER_SIZE);
}
开发者ID:0724,项目名称:Adafruit_CC3000_Library,代码行数:23,代码来源:ccspi.cpp


示例4: SPI_DMA_IntHandler

/**
 * @brief  The handler for Interrupt that is generated on SPI at the end of DMA
 transfer.
 * @param  None
 * @retval None
 */
void SPI_DMA_IntHandler(void)
{
	unsigned long ucTxFinished, ucRxFinished;
	unsigned short data_to_recv = 0;

	ucTxFinished = DMA_GetFlagStatus(CC3000_SPI_TX_DMA_TCFLAG );
	ucRxFinished = DMA_GetFlagStatus(CC3000_SPI_RX_DMA_TCFLAG );
	switch(sSpiInformation.ulSpiState)
	{
	case eSPI_STATE_READ_IRQ:
	  // Both Done
          if (ucTxFinished && ucRxFinished)
          {
                  /* Clear SPI_DMA Interrupt Pending Flags */
                  DMA_ClearFlag(CC3000_SPI_TX_DMA_TCFLAG | CC3000_SPI_RX_DMA_TCFLAG);

                  sSpiInformation.ulSpiState = eSPI_STATE_READ_PROCEED;

                  uint16_t *pnetlen = (uint16_t *) &sSpiInformation.pRxPacket[READ_OFFSET_TO_LENGTH];
                  data_to_recv = ntohs(*pnetlen);
                  if (data_to_recv)
                     {
                       /* We will read ARRAY_SIZE(spi_readCommand) + data_to_recv. is it odd? */

                       if ((data_to_recv +  arraySize(spi_readCommand)) & 1)
                         {
                           /* Odd so make it even */

                           data_to_recv++;
                         }

                       /* Read the whole payload in at the beginning of the buffer
                        * Will it fit?
                        */
                       SPARK_ASSERT(data_to_recv <= arraySize(wlan_rx_buffer));
                       SpiIO(eRead,sSpiInformation.pRxPacket,data_to_recv, FALSE);
                     }
          }
	  break;

	case eSPI_STATE_READ_PROCEED:
          //
          // All the data was read - finalize handling by switching to the task
          // and calling from task Event Handler
          //
          if (ucRxFinished)
          {
                  /* Clear SPI_DMA Interrupt Pending Flags */
                  DMA_ClearFlag(CC3000_SPI_TX_DMA_TCFLAG | CC3000_SPI_RX_DMA_TCFLAG);

                  SpiPauseSpi();
                  SetState(eSPI_STATE_IDLE, eDeAssert);
                  WARN("CC3000 DmaHandler release read spi bus");
                  // Call out to the Unsolicited handler
                  // It will handle the event or leave it there for an outstanding opcode
                  // It it handles it the it Will resume the SPI ISR
                  // It it dose not handles it and there are not outstanding Opcodes the it Will resume the SPI ISR
                  sSpiInformation.SPIRxHandler(sSpiInformation.pRxPacket);

          }
          break;

	case eSPI_STATE_FIRST_WRITE:
	case eSPI_STATE_WRITE_PROCEED:
          if (ucTxFinished)
          {
                  /* Loop until SPI busy */
                  while (SPI_I2S_GetFlagStatus(CC3000_SPI, SPI_I2S_FLAG_BSY ) != RESET)
                  {
                  }

                  /* Clear SPI_DMA Interrupt Pending Flags */
                  DMA_ClearFlag(CC3000_SPI_TX_DMA_TCFLAG | CC3000_SPI_RX_DMA_TCFLAG);

                  if ( sSpiInformation.ulSpiState == eSPI_STATE_FIRST_WRITE)
                  {
                      sSpiInformation.ulSpiState = eSPI_STATE_WRITE_PROCEED;
                  }
                  else
                  {
                      SetState(eSPI_STATE_IDLE, eDeAssert);
                      WARN("CC3000 DmaHandler release write spi bus");
                  }
          }
          break;

	default:
	  INVALID_CASE(sSpiInformation.ulSpiState);
	  break;

	}
}
开发者ID:NicholasJohnson9149,项目名称:core-common-lib,代码行数:98,代码来源:cc3000_spi.c



注:本文中的tSpiInformation类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ tString类代码示例发布时间:2022-05-31
下一篇:
C++ symbolt类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap