board_stkt26.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. */
00028 
00029 /* $Id: board__stkt26_8h_source.html,v 1.1.1.4 2013/04/09 21:11:49 awachtler Exp $ */
00063 #define BOARD_NAME_STKT26 "stkt26"
00064 
00065 #ifndef BOARD_STKT26_H
00066 #define BOARD_STKT26_H
00067 
00068 #define BOARD_TYPE (BOARD_STKT26) 
00069 #define BOARD_NAME "stkt26"       
00071 /*=== Compile time parameters ========================================*/
00072 #ifndef DEFAULT_SPI_RATE
00073 # define DEFAULT_SPI_RATE  (SPI_RATE_1_2)
00074 #endif
00075 
00076 /*=== Hardware Components ============================================*/
00077 #define RADIO_TYPE (RADIO_AT86RF230)    
00079 /*=== TRX pin access macros ==========================================*/
00080 
00081 #define DDR_TRX_RESET   DDRB            
00082 #define PORT_TRX_RESET  PORTB           
00083 #define MASK_TRX_RESET  (_BV(PB4))      
00085 #define PORT_TRX_SLPTR  PORTB           
00086 #define DDR_TRX_SLPTR   DDRB            
00087 #define MASK_TRX_SLPTR  (_BV(PB5))      
00089 /*=== IRQ access macros ==============================================*/
00090 # define TRX_IRQ         _BV(INT0)      
00091 # define TRX_IRQ_vect    INT0_vect      
00094 # define TRX_IRQ_INIT()  do{\
00095                             GIMSK  |= _BV(INT0);\
00096                           } while(0) 
00099 #define DI_TRX_IRQ() {GIMSK &= (~(TRX_IRQ));}
00100 
00101 #define EI_TRX_IRQ() {GIMSK |= (TRX_IRQ);}
00102 
00104 #define TRX_TSTAMP_REG TCNT1
00105 
00106 /*=== SPI access macros ==============================================*/
00107 #define SPI_TYPE  SPI_TYPE_USI
00108 #define DDR_SPI  (DDRB)     
00109 #define PORT_SPI (PORTB)    
00111 #define SPI_MOSI _BV(PB0)   
00112 #define SPI_MISO _BV(PB1)   
00113 #define SPI_SCK  _BV(PB2)   
00114 #define SPI_SS   _BV(PB3)   
00116 #define SPI_DATA_REG USIDR  
00122 static inline void SPI_INIT(uint8_t spirate)
00123 {
00124     /* first configure SPI Port, then SPCR */
00125     PORT_SPI |= SPI_SCK | SPI_SS;
00126     DDR_SPI  |= SPI_MOSI | SPI_SCK | SPI_SS;
00127     DDR_SPI  &= ~SPI_MISO;
00128 }
00129 
00131 #define SPI_SELN_LOW()       uint8_t sreg = SREG; cli(); PORT_SPI &=~SPI_SS
00132 
00133 #define SPI_SELN_HIGH()      PORT_SPI |= SPI_SS; SREG = sreg
00134 
00135 #define SPI_WAITFOR()  \
00136     do \
00137     { \
00138         USISR |= _BV(USIOIF); \
00139         do \
00140         { \
00141             USICR = (_BV(USIWM0)+_BV(USICS1)+_BV(USICLK)+_BV(USITC)); \
00142         } while ((USISR & _BV(USIOIF)) == 0); \
00143     } while(0)
00144 
00145 /*=== LED access macros ==============================================*/
00146 #define LED_PORT      PORTA
00147 #define LED_DDR       DDRA
00148 #define LED_MASK      (0xf0)
00149 #define LED_SHIFT     (4)
00150 #define LED_NUMBER    (4)
00151 #define INVERSE_KEYS  (1)
00152 
00153 /*=== KEY access macros ==============================================*/
00154 #define PORT_KEY     PORTA
00155 #define PIN_KEY      PINA
00156 #define DDR_KEY      DDRA
00157 #define MASK_KEY     (0x0f)
00158 #define SHIFT_KEY    (0)
00159 #define LEDS_INVERSE (0)
00160 
00163 /*=== TIMER Interface ===============================================*/
00169 #define HWTMR_PRESCALE  (1)
00170 #define HWTIMER_TICK    ((1.0*HWTMR_PRESCALE)/F_CPU)
00171 #define HWTIMER_TICK_NB (0xffUL)
00172 #define HWTIMER_REG     (TCNT1)
00173 #define TIMER_TICK      (HWTIMER_TICK_NB * HWTIMER_TICK)
00174 #define TIMER_POOL_SIZE  (1)
00175 #define TIMER_INIT() \
00176     do{\
00177         TCCR0 |= _BV(CS00);\
00178         TIMSK |= _BV(TOIE0);\
00179     }while(0)
00180 #define TIMER_IRQ_vect  TIMER0_OVF0_vect
00181 /*=== Host Interface ================================================*/
00182 #define HIF_TYPE   (HIF_NONE)
00183 
00184 s#endif /* BOARD_STKT26_H */

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