Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 #ifndef _CFG_XNUT_H_
00037 #define _CFG_XNUT_H_
00038 
00039 #ifndef _XNUT_XXX_H_INCLUDED
00040 #  define _XNUT_XXX_H_INCLUDED "cfg/xnut.h"
00041 #else
00042 #  error "Attempt to include more than one <xnut-xxx.h> file"
00043 #endif
00044 
00045 
00046 #include <cfg/os.h>
00047 #include <cfg/memory.h>
00048 #include <cfg/arch.h>
00049 #include <cfg/eeprom.h>
00050 #include <arch/avr.h>
00051 #include <cfg/arch/avrpio.h>
00052 
00053 
00054 #if F_CPU == 1000000UL
00055 #  error "F_CPU is set to avr-lib default 1 MHz! Please include <avr/delay.h> after <xnut.h>"
00056 #endif
00057 #define F_CPU NUT_CPU_FREQ
00058 
00059 
00073 
00074 
00075 
00076 
00077 
00084 
00086 #define LED_S1_OFF()         do {PORTF &= ~_BV(2); PORTF &= ~_BV(3);} while(0)
00087 
00088 #define LED_S1_RED()         do {PORTF &= ~_BV(2); PORTF |= _BV(3);} while(0)
00089 
00090 #define LED_S1_RED_TOGGLE()  do {PORTF &= ~_BV(2); PORTF ^= _BV(3);} while(0)
00091 
00092 #define LED_S1_GREEN()       do {PORTF |= _BV(2); PORTF &= ~_BV(3);} while(0)
00093 
00094 #define LED_S1_GREEN_TOGGLE() do {PORTF ^= _BV(2); PORTF &= ~_BV(3);} while(0)
00095 #define LED_S1_RED_GREEN_TOGGLE() do {PORTF ^= _BV(2); if (bit_is_set(PORTF, 2)) \
00096    PORTF &= ~_BV(3); else PORTF |= _BV(3);} while(0)
00097 
00099 #define LED_S2_OFF()         do {PORTF &= ~_BV(0); PORTF &= ~_BV(1);} while(0)
00100 
00101 #define LED_S2_RED()         do {PORTF &= ~_BV(0); PORTF |= _BV(1);} while(0)
00102 
00103 #define LED_S2_RED_TOGGLE()  do {PORTF &= ~_BV(0); PORTF ^= _BV(1);} while(0)
00104 
00105 #define LED_S2_GREEN()       do {PORTF |= _BV(0); PORTF &= ~_BV(1);} while(0)
00106 
00107 #define LED_S2_GREEN_TOGGLE() do {PORTF ^= _BV(0); PORTF &= ~_BV(1);} while(0)
00108 #define LED_S2_RED_GREEN_TOGGLE() do {PORTF ^= _BV(0); if (bit_is_set(PORTF, 0)) \
00109    PORTF &= ~_BV(1); else PORTF |= _BV(1);} while(0)
00110 
00112 
00113 
00114 
00115 
00116 
00117 
00124 
00131 #define SER0_RS232_MODE()    (PORTB |= _BV(0))
00132 
00139 #define SER0_RS485_MODE()    (PORTB &= ~_BV(0))
00140 
00147 #define SER0_RS485_DRV_ON()   (PORTB |= _BV(1))
00148 
00152 #define SER0_RS485_DRV_OFF()  (PORTB &= ~_BV(1))
00153 
00160 #define SER1_RS232_MODE()    (PORTB |= _BV(2))
00161 
00168 #define SER1_RS485_MODE()    (PORTB &= ~_BV(2))
00169 
00176 #define SER1_RS485_DRV_ON()   (PORTB |= _BV(3))
00177 
00181 #define SER1_RS485_DRV_OFF()  (PORTB &= ~_BV(3))
00182 
00189 #define SER0_GET_CD()        bit_is_set(PINB, 6)
00190 
00197 #define SER0_GET_RI()        bit_is_clear(PINB, 7)
00198 
00205 #define SER0_GET_CTS()       bit_is_clear(PINE, 6)
00206 
00215 #define SER0_GET_DSR()       bit_is_clear(PINE, 4)
00216 
00217 
00221 #define SER0_SET_RTS()       (PORTB &= ~_BV(4))
00222 
00226 #define SER0_CLR_RTS()       (PORTB |= _BV(4))
00227 
00235 #define SER0_SET_DTR()       (PORTB &= ~_BV(5))
00236 
00244 #define SER0_CLR_DTR()       (PORTB |= _BV(5))
00245 
00247 
00249 
00250 #endif // ifdef ..._H_INCLUDED
00251