xmpl.h

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. */
00032 #ifndef XMPL_H
00033 #define XMPL_H
00034 
00035 /* === includes ============================================================ */
00036 #include <stdint.h>
00037 #include <stdbool.h>
00038 #include "board.h"
00039 #include "ioutil.h"
00040 #include "radio.h"
00041 #include "transceiver.h"
00042 /* === macros ============================================================== */
00043 #ifndef CHANNEL
00044 
00045 # if defined(TRX_SUPPORTS_BAND_800)
00046 #  define CHANNEL    (0)
00047 # elif defined(TRX_SUPPORTS_BAND_900) && defined(REGION_USA)
00048 #  define CHANNEL    (5)
00049 # elif defined(TRX_SUPPORTS_BAND_2400)
00050 #  define CHANNEL    (17)
00051 # else
00052 #  error "No supported frequency band found"
00053 # endif
00054 #endif
00055 
00057 #define PANID      (0xcafe)
00058 
00059 #define SHORT_ADDR (0xbabe)
00060 
00061 #define ERR_CHECK(x) do{}while(x)
00062 
00063 /* === types =============================================================== */
00064 
00065 /* === prototypes ========================================================== */
00066 #ifdef __cplusplus
00067 extern "C" {
00068 #endif
00069 
00070 #ifdef __cplusplus
00071 } /* extern "C" */
00072 #endif
00073 
00074 
00075 static inline void WAIT_MS(uint16_t t)
00076 {
00077     while (t--) DELAY_MS(1);
00078 }
00079 
00080 #define WAIT500MS() WAIT_MS(500)
00081 
00082 
00083 static inline void ERR_CHECK_DIAG(bool test, char code)
00084 {
00085 uint8_t i;
00086     if(test)
00087     {
00088         do
00089         {
00090             LED_SET_VALUE(0);
00091             WAIT_MS(500);
00092 
00093             for(i=0;i<code;i++)
00094             {
00095                 LED_SET(0);
00096                 WAIT_MS(150);
00097 
00098                 LED_CLR(0);
00099                 WAIT_MS(400);
00100             }
00101             LED_SET_VALUE(0);
00102             WAIT_MS(500);
00103         }
00104         while(1);
00105     }
00106     LED_SET_VALUE(code);
00107 }
00108 
00109 #endif  /* #ifndef XMPL_H */

This documentation for µracoli was generated on Wed Feb 2 2011 by  doxygen 1.7.1