亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? main.c

?? CYRF6936 zigbee模塊設(shè)計的全部資料
?? C
字號:
//--------------------------------------------------------------------------
//
//  Filename:     main.c
//
//  Description:  Tutorial 4 file
//
//--------------------------------------------------------------------------
// $Archive: /WirelessUSB/WUSB Kits/CY3630 LP EVK/DocSrc/CD_Root/Firmware/Source/Unsupported/NetworkQuality/main.c $
// $Modtime: 4/25/06 8:50p $
// $Revision: 5 $
//--------------------------------------------------------------------------
//
// Copyright 2005-2006, Cypress Semiconductor Corporation.
//
// This software is owned by Cypress Semiconductor Corporation (Cypress)
// and is protected by and subject to worldwide patent protection (United
// States and foreign), United States copyright laws and international
// treaty provisions. Cypress hereby grants to licensee a personal,
// non-exclusive, non-transferable license to copy, use, modify, create
// derivative works of, and compile the Cypress Source Code and derivative
// works for the sole purpose of creating custom software in support of
// licensee product to be used only in conjunction with a Cypress integrated
// circuit as specified in the applicable agreement. Any reproduction,
// modification, translation, compilation, or representation of this
// software except as specified above is prohibited without the express
// written permission of Cypress.
//
// Disclaimer: CYPRESS MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
// Cypress reserves the right to make changes without further notice to the
// materials described herein. Cypress does not assume any liability arising
// out of the application or use of any product or circuit described herein.
// Cypress does not authorize its products for use as critical components in
// life-support systems where a malfunction or failure may reasonably be
// expected to result in significant injury to the user. The inclusion of
// Cypress' product in a life-support systems application implies that the
// manufacturer assumes all risk of such use and in doing so indemnifies
// Cypress against all charges.
//
// Use may be limited by and subject to the applicable Cypress software
// license agreement.
//
//--------------------------------------------------------------------------

//--------------------------------------
// Included files
//--------------------------------------
#include <m8c.h>        // PSoC Part specific constants and macros
#include "PSoCAPI.h"    // PSoC API definitions for all User Modules
#include "PSoCgpioint.h" // Contains nFPGA_SS* defines
#include "lpregs.h"
#include "lpradio.h"
#include "debug.h"


//--------------------------------------
// Local Definitions and Types
//--------------------------------------
#define PAYLOAD_LENGTH      5  // 0-10
#define CHANNEL             80 // 0-98
#define SOP_PN_CODE         2  // 0-11

// Select one DATMODE_1MBPS | DATMODE_8DR | DATMODE_DDR | DATMODE_SDR
#define DATA_RATE           DATMODE_8DR

#define RX_TIMEOUT          0x03FF // Number of receive loop iterations before a timeout occurs. ~40ms
#define TX_DELAY            0x03FF // Give the receiver time to start. ~4ms

#define LAST_RADIO_REGISTER 0x35


//--------------------------------------
// Global Definitions
//--------------------------------------
// The following bit array is used by DumpRadioRegisters() to know whether
// to dump a register value.  Each bit in the array represents a LP register.
// As DumpRadioRegisters() loops through the registers it checks the bits in
// this array.  If the bit is set, the register is printed.  If it is clear,
// "xx" is printed.
// 0x20-0x25 are the file registers.
// Within each byte, the least significant bit is 0 and the most significant
// bit is 7
//                                 Register  0-7   8-F 10-17 18-1F 20-27 28-2F 30-37
const unsigned char LpRegistersToPrint[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x03, 0x24};


//--------------------------------------
// Local Function Declarations
//--------------------------------------
void HardwareInit(void);
void DumpRadioRegisters(void);
void Delay(unsigned short Count);
void DumpBuffer(char *ptr, unsigned Length);


//--------------------------------------
// Local Function Definitions
//--------------------------------------

//--------------------------------------------------------------------------
//
//  Function:    main
//
//  Description: The main program loop
//
//--------------------------------------------------------------------------
void main()
{
    unsigned char  TxPayloadBuffer[10] = { 0x51, 0xA2, 0xF3, 0x44, 0x95, 0xE6, 0x37, 0x88, 0xD9, 0x2A };
    unsigned char  RxPayloadBuffer[PAYLOAD_LENGTH];
    unsigned short RxTimeout;
    unsigned char  ConsecutiveDroppedPackets = 0;
    unsigned char  SopDetect; // Start Of Packet Detect

    HardwareInit();

    // DATMODE_8DR needs a little extra time to receive the ACK
    RadioInit(XACT_CFG_RST | END_STATE_IDLE | ACK_TO_8X, (TX_CFG_RST & ~TX_DATMODE_MSK) | DATA_RATE);

    // Use 64 chips for start of packet (will increase range)
    RadioSetFrameConfig(FRAMING_CFG_RST | SOP_LEN);

    RadioSetFrequency(CHANNEL); // Set the transmit frequency (2400MHz + CHANNEL)
    RadioSetSopPnCode(SOP_PN_CODE); // Change the PN Code for the Start of Packet

    OutStr("\r\n\n");
    DumpRadioRegisters();
    OutStr("\r\n\nWelcome to WirelessUSB LP - Network Quality Application\r\n");

    while(1)
    {
        RadioSetPtr(RxPayloadBuffer);
        RadioSetLength(PAYLOAD_LENGTH);

        RadioStartReceive();

        RxTimeout = RX_TIMEOUT;  // Receive times out when 0 is reached
        SopDetect = FALSE;

        // Receive a packet (or timeout trying)
        while (RxTimeout != 0)
        {
            RADIO_STATE RxState;
            RADIO_LENGTH ReceivedPayloadSize;

            RxState = RadioGetReceiveState();

            if ((RxState & RADIO_SOP) && !SopDetect)
            {
                // A Start of Packet has been detected
                RxTimeout = 1; // Give the packet a chance to arrive
                SopDetect = TRUE;
            }

            if (RxState & RADIO_COMPLETE)
            {
                ReceivedPayloadSize = RadioEndReceive();

                if (!(RxState & RADIO_ERROR))
                {
                    if (ReceivedPayloadSize == PAYLOAD_LENGTH)
                    {
                        // Successfully received a packet
                        ConsecutiveDroppedPackets = 0;

                        OutChar('_');
                        break;
                    }
                    // else not the correct length.  Drop Packet
                }
                else
                {
                    // Packet received with an error.
                    OutHex(ReceivedPayloadSize); // Print size
                }

                // Restart the receive operation
                SopDetect = FALSE;
                RxTimeout = 0;
                RadioStartReceive();
            }

            --RxTimeout;
        }

        if (RxTimeout == 0)
        {
            RxTimeout = RX_TIMEOUT;  // Receive times out when 0 is reached
            ++ConsecutiveDroppedPackets;

            if (ConsecutiveDroppedPackets == 0) // Wrap detection
                ConsecutiveDroppedPackets = 0xFF;

            if (SopDetect)
                OutChar('^'); // A SOP has been detected before calling Abort

            RadioAbort();
        }

        // Give the user feedback what is going on
        if (ConsecutiveDroppedPackets > 4)
        {
            nRED_LED_Data_ADDR    &= ~nRED_LED_MASK;    // Red LED On
            nYELLOW_LED_Data_ADDR |=  nYELLOW_LED_MASK; // Yellow LED Off
            nGREEN_LED_Data_ADDR  |=  nGREEN_LED_MASK;  // Green LED Off
        }
        else if (ConsecutiveDroppedPackets > 1)
        {
            nRED_LED_Data_ADDR    |=  nRED_LED_MASK;    // Red LED Off
            nYELLOW_LED_Data_ADDR &= ~nYELLOW_LED_MASK; // Yellow LED On
            nGREEN_LED_Data_ADDR  |=  nGREEN_LED_MASK;  // Green LED Off
        }
        else
        {
            nRED_LED_Data_ADDR    |=  nRED_LED_MASK;    // Red LED Off
            nYELLOW_LED_Data_ADDR |=  nYELLOW_LED_MASK; // Yellow LED Off
            nGREEN_LED_Data_ADDR  &= ~nGREEN_LED_MASK;  // Green LED On
        }

        Delay(TX_DELAY); // Give the receiver time to start.

        //--- Transmit a packet ----------------------------------
        RadioSetPtr(TxPayloadBuffer); // Set the transmit buffer

        RadioBlockingTransmit(1, PAYLOAD_LENGTH); // Send it
        OutChar('+');
    }
}


//--------------------------------------------------------------------------
//
//  Function:    HardwareInit
//
//  Description: Initialize the hardware components on the EVK Board
//               (Non-LP Radio related)
//
//--------------------------------------------------------------------------
void HardwareInit()
{
    // Turn LEDs off by default
    nRED_LED_Data_ADDR    |= nRED_LED_MASK;
    nYELLOW_LED_Data_ADDR |= nYELLOW_LED_MASK;
    nGREEN_LED_Data_ADDR  |= nGREEN_LED_MASK;

    // Serial Transmit line must start high
    UART_TX_Data_ADDR |= UART_TX_MASK;

    // Initialize the software-based serial output.
    OutChar(0x00);

    // Write a one to the PSoC register so the switches can be read
    SW1_Data_ADDR |= SW1_MASK;
    SW2_Data_ADDR |= SW2_MASK;

    // Start the SPI interface with the LP radio
    // This is a PSoC created function
    SPIM_Radio_Start(SPIM_Radio_SPIM_MODE_0 | SPIM_Radio_SPIM_MSB_FIRST);
}


//--------------------------------------------------------------------------
//
//  Function:    DumpRadioRegisters
//
//  Description: Print the radio registers to the screen
//
//--------------------------------------------------------------------------
void DumpRadioRegisters()
{
    unsigned char Index;
    unsigned char ByteInArray = 0;
    unsigned char BitInByte = 0x01;

    OutStr("\r\n Registers: ");

    for (Index = 0; Index <= LAST_RADIO_REGISTER; ++Index)
    {
        if (LpRegistersToPrint[ByteInArray] & BitInByte)
            OutHex(RadioRead(Index));
        else
            OutStr("xx"); // This register cannot be displayed

        BitInByte <<= 1;

        if (!BitInByte)
        {
            // Bit has rotated out
            ++ByteInArray; // Move to next byte in array
            BitInByte = 0x01; // Start with the first bit in the byte
        }

        // Start a new line after every 16 values
        if ((Index & 0x0F) == 0x0F)
            OutStr("\r\n            ");
        else
            OutChar(' ');
    }
}


//--------------------------------------------------------------------------
//
//  Function:    Delay
//
//  Description: Burn MCU cycles with an arbitrary delay
//
//  Inputs:      Count - the amount of arbitrary delay
//
//--------------------------------------------------------------------------
void Delay(unsigned short Count)
{
    for (; Count; --Count)
    {
        asm("nop");
    }
}


//--------------------------------------------------------------------------
//
//  Function:    DumpBuffer
//
//  Description: Ouput a buffer to the serial port
//
//  Inputs:      ptr and Length
//
//--------------------------------------------------------------------------
void DumpBuffer(char *Ptr, unsigned Length)
{
    for (; Length; Length--)
    {
        OutHex(*Ptr++);
        OutChar(' ');
    }
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
www.色综合.com| 国产成人鲁色资源国产91色综 | 激情亚洲综合在线| 日韩美女在线视频| 国产资源精品在线观看| 久久这里只有精品6| 成人黄色大片在线观看| 最新热久久免费视频| 欧美伊人久久久久久午夜久久久久| 亚洲图片你懂的| 欧美少妇性性性| 免费欧美高清视频| 国产亚洲综合在线| www.亚洲国产| 日韩黄色免费网站| 欧美精品一区二区久久久| 国产精品一区二区免费不卡| 国产精品久久免费看| 欧美午夜寂寞影院| 精品一区二区免费| 中文字幕在线不卡一区二区三区| 91国产免费观看| 日韩影视精彩在线| 天堂久久一区二区三区| 欧美xxxxxxxx| 在线一区二区视频| 精久久久久久久久久久| 最新中文字幕一区二区三区| 69p69国产精品| 99久久99久久精品免费观看| 日韩**一区毛片| 中文字幕一区在线观看视频| 欧美日韩国产色站一区二区三区| 国产一区二区三区四区五区入口| 中文字幕亚洲一区二区va在线| 91麻豆精品国产无毒不卡在线观看| 韩国一区二区在线观看| 亚洲一区二区精品久久av| 久久综合一区二区| 欧美亚洲免费在线一区| 成人一级片在线观看| 午夜欧美一区二区三区在线播放| 欧美激情在线一区二区| 欧美一区二区三区影视| 一本色道a无线码一区v| 国产精品一二三四| 日韩国产一二三区| 一区二区免费在线播放| 国产午夜精品美女毛片视频| 欧美一区二区三区四区视频| 91在线小视频| 日韩免费电影一区| 欧美日韩高清在线| 色婷婷精品久久二区二区蜜臂av | 久久夜色精品国产噜噜av| 91国产免费观看| 成人av在线播放网址| 九九久久精品视频| 午夜伦欧美伦电影理论片| 亚洲婷婷综合色高清在线| 国产亚洲婷婷免费| 欧美大胆人体bbbb| 7777精品伊人久久久大香线蕉超级流畅 | 欧美日韩高清影院| 91理论电影在线观看| 国产91精品免费| 国产一区美女在线| 久久69国产一区二区蜜臀| 五月婷婷综合激情| 亚洲成人自拍偷拍| 午夜电影网亚洲视频| 亚洲一区二区黄色| 亚洲一级二级三级| 亚洲夂夂婷婷色拍ww47| 亚洲一区二区精品视频| 亚洲一区二区三区在线看| 一区二区三区资源| 一区二区高清免费观看影视大全 | 6080亚洲精品一区二区| 欧美三级日韩三级国产三级| 欧美这里有精品| 在线国产亚洲欧美| 欧美日韩小视频| 制服视频三区第一页精品| 欧美精品一卡两卡| 88在线观看91蜜桃国自产| 5858s免费视频成人| 日韩欧美色综合| 精品国产成人系列| 国产清纯白嫩初高生在线观看91 | 中文字幕一区二区三区av| 国产精品免费视频观看| 国产精品女同一区二区三区| 国产精品毛片无遮挡高清| 亚洲视频 欧洲视频| 亚洲一区二区三区不卡国产欧美 | 国产精品素人视频| 最新日韩在线视频| 亚洲成av人片在线观看| 麻豆视频观看网址久久| 国产另类ts人妖一区二区| kk眼镜猥琐国模调教系列一区二区| 91视频观看免费| 欧美日本国产一区| 欧美精品一区视频| 国产精品国产三级国产普通话99| 一区二区视频在线看| 日韩1区2区3区| 成人一区二区在线观看| 在线视频综合导航| 97精品电影院| 91精品国产入口在线| 国产欧美一区二区精品性色超碰| 亚洲美女视频一区| 久久精品国产精品亚洲红杏| 成人激情校园春色| 欧美精品123区| 国产日韩欧美亚洲| 亚洲福利一二三区| 国产一区二区三区久久久| 91成人在线精品| 久久久久久久久99精品| 亚洲人成在线观看一区二区| 日本在线不卡视频一二三区| 成人激情图片网| 欧美一级电影网站| 亚洲精品国产精品乱码不99| 久久电影网站中文字幕| 色视频一区二区| 久久综合999| 日韩专区在线视频| 91在线porny国产在线看| 欧美mv日韩mv国产| 亚洲在线免费播放| 高清不卡一区二区在线| 欧美一区二区三区在线看| 亚洲丝袜自拍清纯另类| 国产在线不卡一卡二卡三卡四卡| 欧美午夜影院一区| 亚洲欧洲精品一区二区三区不卡| 久久99精品久久久久久久久久久久 | 亚洲蜜臀av乱码久久精品蜜桃| 久久99精品国产麻豆婷婷| 在线视频观看一区| 中文字幕一区二区三区色视频| 国模无码大尺度一区二区三区| 欧美日韩三级一区| 亚洲激情综合网| 波多野结衣中文一区| 久久久无码精品亚洲日韩按摩| 日本不卡一区二区| 欧美午夜不卡视频| 一区二区三区四区不卡在线| 成人激情黄色小说| 国产精品色噜噜| 国产成a人无v码亚洲福利| 欧美成人艳星乳罩| 美腿丝袜亚洲一区| 91精品国产综合久久久蜜臀图片| 夜夜爽夜夜爽精品视频| 色综合久久99| 亚洲乱码一区二区三区在线观看| 成人黄色在线看| 中文字幕亚洲区| 99视频在线观看一区三区| 国产精品卡一卡二| 北条麻妃国产九九精品视频| 国产精品免费看片| eeuss鲁片一区二区三区在线看| 中文字幕巨乱亚洲| 成人丝袜18视频在线观看| 国产精品麻豆一区二区| 白白色 亚洲乱淫| 亚洲青青青在线视频| 91色porny蝌蚪| 一区二区三区不卡在线观看| 欧美日韩在线精品一区二区三区激情| 一区二区三区中文在线| 欧美日韩一区成人| 青青草伊人久久| 久久夜色精品国产噜噜av| 国产99久久精品| 国产精品久久久久久久久快鸭| 91一区二区在线| 亚洲国产另类av| 日韩欧美在线1卡| 丁香天五香天堂综合| 亚洲婷婷国产精品电影人久久| 欧美午夜电影网| 老司机午夜精品| 国产精品入口麻豆九色| av不卡免费在线观看| 亚洲国产精品尤物yw在线观看| 日韩一区二区在线观看视频| 国产一区免费电影| 综合网在线视频| 7777精品伊人久久久大香线蕉完整版| 久99久精品视频免费观看| 亚洲国产成人在线| 欧美亚洲国产一区二区三区va |