board_derfa.h

Go to the documentation of this file.
00001 /* Copyright (c) 2009 - 2011 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 /* $Id: board__derfa_8h_source.html,v 1.1.1.4 2013/04/09 21:12:04 awachtler Exp $ */
00067 #ifndef BOARD_DERFA_H
00068 #define BOARD_DERFA_H
00069 
00070 #if defined(derfa1)
00071 # define BOARD_TYPE BOARD_DERFA1
00072 # define BOARD_NAME "derfa1"
00073 #define RADIO_TYPE (RADIO_ATMEGA128RFA1_C)
00074 #elif defined(radiofaro)
00075 # define BOARD_TYPE BOARD_RADIOFARO
00076 # define BOARD_NAME "radiofaro"
00077 #define RADIO_TYPE (RADIO_ATMEGA128RFA1_D)
00078 #elif defined(radiofaro_v1)
00079 # define BOARD_TYPE BOARD_RADIOFARO_V1
00080 # define BOARD_NAME "radiofaro v1"
00081 #define RADIO_TYPE (RADIO_ATMEGA128RFA1_C)
00082 #elif defined(zigduino)
00083 # define BOARD_TYPE BOARD_ZIGDUINO
00084 # define BOARD_NAME "zigduino"
00085 #define RADIO_TYPE (RADIO_ATMEGA128RFA1_C)
00086 #elif defined(xxo)
00087 # define BOARD_TYPE BOARD_XXO
00088 # define BOARD_NAME "tic_tac_toe"
00089 #define RADIO_TYPE (RADIO_ATMEGA128RFA1_C)
00090 #elif defined(wprog)
00091 # define BOARD_TYPE BOARD_WPROG
00092 # define BOARD_NAME "wprog"
00093 # define RADIO_TYPE (RADIO_ATMEGA128RFA1_D)
00094 #elif defined(pinoccio)
00095 # define BOARD_TYPE BOARD_PINOCCIO
00096 # define BOARD_NAME "pinoccio"
00097 # define RADIO_TYPE (RADIO_ATMEGA128RFA1_D)
00098 #endif
00099 /*=== Compile time parameters ========================================*/
00100 
00101 /*=== Hardware Components ============================================*/
00102 
00104 #define TRX_TSTAMP_REG TCNT1
00105 #if BOARD_TYPE == BOARD_RADIOFARO
00106 # define LED_PORT      PORTG
00107 # define LED_DDR       DDRG
00108 # define LED_MASK      (0x06)
00109 # define LED_SHIFT     (1)
00110 # define LEDS_INVERSE  (0)
00111 # define LED_NUMBER    (2)
00112 #elif BOARD_TYPE == BOARD_WPROG
00113 # define LED_PORT      PORTD
00114 # define LED_DDR       DDRD
00115 # define LED_MASK      (0x40)
00116 # define LED_SHIFT     (6)
00117 # define LEDS_INVERSE  (1)
00118 # define LED_NUMBER    (1)
00119 #elif BOARD_TYPE == BOARD_PINOCCIO
00120 # define LED_PORT      PORTB
00121 # define LED_DDR       DDRB
00122 # define LED_MASK      (0x70)
00123 # define LED_SHIFT     (4)
00124 # define LEDS_INVERSE  (1)
00125 # define LED_NUMBER    (3)
00126 #elif BOARD_TYPE == BOARD_XXO
00127 
00128 /* We just define the first three LEDs in row 1
00129  * use a special display driver, that is frequently
00130  * updated to handle the full LED matrix.
00131  */
00132 
00133 #define LED_INIT() \
00134     do {\
00135         DDRB |= (_BV(PB0) | _BV(PB1) | _BV(PB2) | _BV(PB3));\
00136         PORTB |= (_BV(PB0) | _BV(PB1) | _BV(PB2) | _BV(PB3));\
00137     } while(0)
00138 
00139 
00140 #define LED_SET(x) \
00141   switch (x) { \
00142   case 0: PORTB &= ~_BV(0); break; \
00143   case 1: PORTB &= ~_BV(1); break; \
00144   case 2: PORTB &= ~_BV(2); break; \
00145   }
00146 
00147 #define LED_CLR(x) \
00148   switch (x) { \
00149   case 0: PORTB |= _BV(0); break; \
00150   case 1: PORTB |= _BV(1); break; \
00151   case 2: PORTB |= _BV(2); break; \
00152   }
00153 
00154 #define LED_SET_VALUE(x) \
00155   do { \
00156   if (x & 1) PORTB &= ~_BV(0); else PORTB |= _BV(0); \
00157   if (x & 2) PORTB &= ~_BV(1); else PORTB |= _BV(1); \
00158   if (x & 4) PORTB &= ~_BV(2); else PORTB |= _BV(2); \
00159   } while (0)
00160 
00161 #define LED_GET_VALUE() ( \
00162   ((PORTB & _BV(0))? 0: 1) | \
00163   ((PORTB & _BV(1))? 0: 2) | \
00164   ((PORTB & _BV(2))? 0: 4) \
00165               )
00166 
00167 #define LED_VAL(msk,val) do{}while(0) 
00169 #define LED_TOGGLE(ln) \
00170   switch (ln) { \
00171   case 0: PORTB ^= _BV(5); break; \
00172   case 1: PORTB ^= _BV(7); break; \
00173   case 2: PORTB ^= _BV(6); break; \
00174   }
00175 
00176 #define LED_NUMBER (3)
00177 #define LED_ACTIVITY (0)
00178 
00179 #else
00180 # define LED_NUMBER    (0)
00181 # define NO_LEDS       (1)
00182 #endif
00183 
00184 #define NO_KEYS        (1)
00185 
00186 /*=== Host Interface ================================================*/
00187 #if BOARD_TYPE == BOARD_RADIOFARO_V1 || \
00188     BOARD_TYPE == BOARD_ZIGDUINO || \
00189     BOARD_TYPE == BOARD_PINOCCIO
00190 # define HIF_TYPE    HIF_UART_0
00191 #else
00192 # define HIF_TYPE    HIF_UART_1
00193 #endif
00194 
00195 #define TRX_RESET_LOW()   do { TRXPR &= ~_BV(TRXRST); } while (0)
00196 #define TRX_RESET_HIGH()  do { TRXPR |= _BV(TRXRST); } while (0)
00197 #define TRX_SLPTR_LOW()   do { TRXPR &= ~_BV(SLPTR); } while (0)
00198 #define TRX_SLPTR_HIGH()  do { TRXPR |= _BV(SLPTR); } while (0)
00199 
00200 /*=== TIMER Interface ===============================================*/
00201 #define HWTMR_PRESCALE  (1)
00202 #define HWTIMER_TICK    ((1.0*HWTMR_PRESCALE)/F_CPU)
00203 #define HWTIMER_TICK_NB (0xFFFFUL)
00204 #define HWTIMER_REG     (TCNT1)
00205 #define TIMER_TICK      (HWTIMER_TICK_NB * HWTIMER_TICK)
00206 #define TIMER_POOL_SIZE (4)
00207 #define TIMER_INIT() \
00208     do{ \
00209         TCCR1B |= (_BV(CS10)); \
00210         TIMSK1 |= _BV(TOIE1); \
00211     }while(0)
00212 #define TIMER_IRQ_vect   TIMER1_OVF_vect
00213 
00214 #endif /* BOARD_DERFA_H */

This documentation for µracoli was generated on Tue Apr 9 2013 by  doxygen 1.7.1