A Atmel RF2xx Radio Library for Mbed

Dependents:   xBedRadio MxSniffer

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MxRadio_trx_rf230_misc.cpp Source File

MxRadio_trx_rf230_misc.cpp

Go to the documentation of this file.
00001 /* Copyright (c) 2007 Axel Wachtler
00002    All rights reserved.
00003 
00004    Redistribution and use in source and binary forms, with or without
00005    modification, are permitted provided that the following conditions
00006    are met:
00007 
00008    * Redistributions of source code must retain the above copyright
00009      notice, this list of conditions and the following disclaimer.
00010    * Redistributions in binary form must reproduce the above copyright
00011      notice, this list of conditions and the following disclaimer in the
00012      documentation and/or other materials provided with the distribution.
00013    * Neither the name of the authors nor the names of its contributors
00014      may be used to endorse or promote products derived from this software
00015      without specific prior written permission.
00016 
00017    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00018    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00019    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00020    ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00021    LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00022    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00023    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00024    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00025    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00026    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00027    POSSIBILITY OF SUCH DAMAGE. */
00028 
00029 /*
00030  * ===========================================================================
00031  * This file contains refactored code from hif_rf230.c,
00032  * which is part of Atmels software package "IEEE 802.15.4 MAC for AVR Z-Link"
00033  * ===========================================================================
00034  */
00035 /*
00036  * Copyright (c) 2006, Atmel Corporation All rights reserved.
00037  *
00038  * Redistribution and use in source and binary forms, with or without
00039  * modification, are permitted provided that the following conditions are met:
00040  *
00041  * 1. Redistributions of source code must retain the above copyright notice,
00042  * this list of conditions and the following disclaimer.
00043  *
00044  * 2. Redistributions in binary form must reproduce the above copyright notice,
00045  * this list of conditions and the following disclaimer in the documentation
00046  * and/or other materials provided with the distribution.
00047  *
00048  * 3. The name of ATMEL may not be used to endorse or promote products derived
00049  * from this software without specific prior written permission.
00050  *
00051  * THIS SOFTWARE IS PROVIDED BY ATMEL ``AS IS'' AND ANY EXPRESS OR IMPLIED
00052  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00053  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND
00054  * SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,
00055  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00056  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00057  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00058  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00059  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00060  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00061  */
00062 
00063 
00064 /* $Id$ */
00065 /**
00066  * @file
00067  * @brief ....
00068  * @addtogroup grpApp...
00069  */
00070 
00071 /* === includes ============================================================ */
00072 #include <MxRadio.h>
00073 
00074 /* === functions =========================================================== */
00075 uint8_t cMxRadio::trx_frame_get_length(void)
00076 {
00077 uint8_t length = 0;
00078 
00079     /* Select transceiver */
00080     m_cs=0;//SPI_SELN_LOW();
00081 
00082     /* start frame read */
00083     m_spi.write(TRX_CMD_FR);//SPI_DATA_REG = TRX_CMD_FR;
00084     //SPI_WAITFOR();
00085 
00086     /* read length */
00087     //SPI_DATA_REG = 0;
00088     //SPI_WAITFOR();
00089     length =  m_spi.write(0);//SPI_DATA_REG;
00090 
00091     m_cs=1;//SPI_SELN_HIGH();
00092     return length;
00093 }
00094 
00095 /* EOF */