AVR Z-LINKŪ


hal_avr.h

Go to the documentation of this file.
00001 /* This file has been prepared for Doxygen automatic documentation generation.*/
00072 #ifndef HAL_AVR_H
00073 #define HAL_AVR_H
00074 /*============================ INCLUDE =======================================*/
00075 #include <stdint.h>
00076 #include <stdbool.h>
00077 /*============================ MACROS ========================================*/
00078 
00083 #define SLP_TR              ( 0x04 )
00084 
00089 #define DDR_SLP_TR          ( DDRB )
00090 
00094 #define PORT_SLP_TR         ( PORTB )
00095 
00099 #define PIN_SLP_TR          ( PINB )        
00100 
00105 #define hal_set_slptr_high( )         ( PORT_SLP_TR |= ( 1 << SLP_TR ) )
00106 
00111 #define hal_set_slptr_low( )          ( PORT_SLP_TR &= ~( 1 << SLP_TR ) )
00112 
00119 #define hal_get_slptr( ) ( ( PIN_SLP_TR & ( 1 << SLP_TR ) ) >> SLP_TR )
00120 
00124 #define RST                 ( 0x05 )
00125 
00130 #define DDR_RST             ( DDRB )
00131 
00135 #define PORT_RST            ( PORTB )
00136 
00140 #define PIN_RST             ( PINB )
00141 
00146 #define hal_set_rst_high( )           ( PORT_RST |= ( 1 << RST ) )
00147 
00152 #define hal_set_rst_low( )            ( PORT_RST &= ~( 1 << RST ) )
00153 
00160 #define hal_get_rst( ) ( ( PIN_RST & ( 1 << RST )  ) >> RST )
00161 
00165 #define HAL_SS_PIN              ( 0x00 )
00166 
00170 #define HAL_PORT_SPI            ( PORTB )
00171 
00175 #define HAL_DDR_SPI             ( DDRB )
00176 
00180 #define HAL_DD_SS               ( 0x00 )
00181 
00185 #define HAL_DD_SCK              ( 0x01 )
00186 
00190 #define HAL_DD_MOSI             ( 0x02 )
00191 
00195 #define HAL_DD_MISO             ( 0x03 )
00196 
00197 #define HAL_SS_HIGH( ) (HAL_PORT_SPI |= ( 1 << HAL_SS_PIN )) 
00198 #define HAL_SS_LOW( )  (HAL_PORT_SPI &= ~( 1 << HAL_SS_PIN )) 
00199 
00200 
00209 #if ( F_CPU == 16000000UL )
00210     #define HAL_TCCR1B_CONFIG ( ( 1 << ICES1 ) | ( 1 << CS12 ) )
00211     #define HAL_US_PER_SYMBOL ( 1 )
00212     #define HAL_SYMBOL_MASK   ( 0xFFFFffff )
00213 #elif ( F_CPU == 8000000UL )
00214     #define HAL_TCCR1B_CONFIG ( ( 1 << ICES1 ) | ( 1 << CS11 ) | ( 1 << CS10 ) )
00215     #define HAL_US_PER_SYMBOL ( 2 )
00216     #define HAL_SYMBOL_MASK   ( 0x7FFFffff )
00217 #elif ( F_CPU == 4000000UL )
00218     #define HAL_TCCR1B_CONFIG ( ( 1 << ICES1 ) | ( 1 << CS11 ) | ( 1 << CS10 ) )
00219     #define HAL_US_PER_SYMBOL ( 1 )
00220     #define HAL_SYMBOL_MASK   ( 0xFFFFffff )
00221 #elif ( F_CPU == 1000000UL )
00222     #define HAL_TCCR1B_CONFIG ( ( 1 << ICES1 ) | ( 1 << CS11 ) )
00223     #define HAL_US_PER_SYMBOL ( 2 )
00224     #define HAL_SYMBOL_MASK   ( 0x7FFFffff )
00225 #else
00226     #error "Clock speed not supported."
00227 #endif
00228 
00229 #define HAL_ENABLE_INPUT_CAPTURE_INTERRUPT( ) ( TIMSK1 |= ( 1 << ICIE1 ) )
00230 #define HAL_DISABLE_INPUT_CAPTURE_INTERRUPT( ) ( TIMSK1 &= ~( 1 << ICIE1 ) )
00231 
00232 #define HAL_ENABLE_OVERFLOW_INTERRUPT( ) ( TIMSK1 |= ( 1 << TOIE1 ) )
00233 #define HAL_DISABLE_OVERFLOW_INTERRUPT( ) ( TIMSK1 &= ~( 1 << TOIE1 ) )
00234 
00239 #define hal_enable_trx_interrupt( ) ( HAL_ENABLE_INPUT_CAPTURE_INTERRUPT( ) )
00240 
00247 #define hal_disable_trx_interrupt( ) ( HAL_DISABLE_INPUT_CAPTURE_INTERRUPT( ) )
00248 /*============================ TYPDEFS =======================================*/
00249 /*============================ PROTOTYPES ====================================*/
00250 
00251 #endif
00252 /*EOF*/
@DOC_TITLE@
Generated on Wed Jul 11 18:16:31 2007 for AVR2001 AT86RF230 Software Programmer's Manual by doxygen 1.4.7