⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pc_radio.c

📁 基于MMA7260QR2的跌落检查程序
💻 C
字号:
/************************************************************************************
* PC Radio Module File 
*
* Author(s):  $B03847
*
* (c) Copyright 2008, Freescale, Inc.  All rights reserved.
*
* No part of this document must be reproduced in any form - including copied,
* transcribed, printed or by any electronic means - without specific written
* permission from Freescale.
*
* Last Inspected: 05/16/2008
* Last Tested: 
************************************************************************************/

#include "PC_Radio.h"

uint8_t gua8sciString[6];
uint8_t gu8SCIData[1]; 
extern uint8_t gu8SCIDataFlag;
message_t TX_msg;
message_t RX_msg;
int8_t gi8PCRadioState;
bool_t gbDataIndicationFlag;
uint8_t gu8Channel;

/*******************************************************************************
*    This is the main thread of execution when no button is pressed
*    on reset, the PC_Radio application.
*******************************************************************************/
void PC_Radio_App(void) 
{
  gua8sciString[0] = 'x';
  gua8sciString[2] = 'y';
  gua8sciString[4] = 'z';
          
  switch (gi8PCRadioState) 
  {                        
    case IDLE_STATE:
      /*Switch to RECEIVER_ALWAYS_ON */
      gi8PCRadioState = RECEIVER_ALWAYS_ON;
    break;       
    case RECEIVER_ALWAYS_ON:
      if(RECEIVE_END())
      {
        RX_msg.u8BufSize = RX_SIZE;
        (void)MLMERXEnableRequest(&RX_msg, 0x0000F000);                      
      }
      LOW_POWER_WHILE();
    break;             
    /* Should not get here. */
    default:
      gi8PCRadioState = RECEIVER_ALWAYS_ON;
    break;   
  }              
  
  if (gu8SCIDataFlag == 1)
  {
    switch (gu8SCIData[0]) 
    {        
      /* Initial Handshake from the PC GUI */   
      case 'R':
        Uart_Print("N");       
      break;         
      /* Send the PC application "xNyNzN" */
      case 'V':    
        Uart_Print(gua8sciString);        
      break;                  
      /* Received Cal Factor "K" + 9 cal Bytes */                                 
      case 'K':
        /* Not Implememted */																	                
      break;
      /* Received Request for bytes - rsp with "k" + 6 cal bytes */               
      case 'k':
      /* Not Implememted */
      break;                  
      /* Current Query */   
      case 'C':
        Uart_Print("c");        
        Uart_PrintHex((uint8_t *)(&gu8Channel),1,0);
      break;      
    }
    gu8SCIDataFlag = 0;
  }              
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -