49 # error "no robot platform defined"
52 #ifdef __AVR_ATmega644__
53 #define _NIBOBEE_MEGAxx4_
56 #ifdef __AVR_ATmega324__
57 #define _NIBOBEE_MEGAxx4_
60 #ifdef __AVR_ATmega164__
61 #define _NIBOBEE_MEGAxx4_
66 #include <avr/interrupt.h>
71 #define LOBYTE(x) (uint8_t)((uint16_t)x)
72 #define HIBYTE(x) (uint8_t)(((uint16_t)x)>>8)
73 #define MAKE_WORD(hi,lo) ((hi*0x100)+lo)
75 #define enable_interrupts() sei()
76 #define disable_interrupts() cli()
79 #define _PPCAT(a,b) a##b
80 #define _PPCAT3(a,b,c) a##b##c
83 #define activate_output_bit(NAME) _PPCAT(NAME,_DDR)|=_BV(_PPCAT(NAME,_BIT))
84 #define deactivate_output_bit(NAME) _PPCAT(NAME,_DDR)&=~(unsigned char)_BV(_PPCAT(NAME,_BIT))
85 #define set_output_bit(NAME) _PPCAT(NAME,_PORT)|=_BV(_PPCAT(NAME,_BIT))
86 #define clear_output_bit(NAME) _PPCAT(NAME,_PORT)&=~(unsigned char)_BV(_PPCAT(NAME,_BIT))
87 #define set_output_bitval(NAME, VAL) _PPCAT(NAME,_PORT)=(_PPCAT(NAME,_PORT)&~(unsigned char)_BV(_PPCAT(NAME,_BIT)))|((VAL)?_BV(_PPCAT(NAME,_BIT)):0)
89 #define get_input_bit(NAME) (_PPCAT(NAME,_PIN)&_BV(_PPCAT(NAME,_BIT)))
90 #define get_output_bit(NAME) (_PPCAT(NAME,_PORT)&_BV(_PPCAT(NAME,_BIT)))
93 #define activate_output_groupbit(NAME,BIT) _PPCAT(NAME,_DDR)|=_BV(_PPCAT3(NAME,_BIT_,BIT))
94 #define deactivate_output_groupbit(NAME,BIT) _PPCAT(NAME,_DDR)&=~(unsigned char)_BV(_PPCAT3(NAME,_BIT_,BIT))
95 #define set_output_groupbit(NAME,BIT) _PPCAT(NAME,_PORT)|=_BV(_PPCAT3(NAME,_BIT_,BIT))
96 #define clear_output_groupbit(NAME,BIT) _PPCAT(NAME,_PORT)&=~(unsigned char)_BV(_PPCAT3(NAME,_BIT_,BIT))
97 #define set_output_groupbitval(NAME,BIT,VAL) _PPCAT(NAME,_PORT)=(_PPCAT(NAME,_PORT)&~(unsigned char)_BV(_PPCAT3(NAME,_BIT_,BIT)))|((VAL)?_BV(_PPCAT3(NAME,_BIT_,BIT)):0)
99 #define get_input_groupbit(NAME,BIT) (_PPCAT(NAME,_PIN)&_BV(_PPCAT3(NAME,_BIT_,BIT)))
100 #define get_output_groupbit(NAME,BIT) (_PPCAT(NAME,_PORT)&_BV(_PPCAT3(NAME,_BIT_,BIT)))
102 #define activate_output_group(NAME) _PPCAT(NAME,_DDR)|=_PPCAT(NAME,_MASK)
103 #define deactivate_output_group(NAME) _PPCAT(NAME,_DDR)&=~(unsigned char)_PPCAT(NAME,_MASK)
104 #define set_output_group(NAME) _PPCAT(NAME,_PORT)|=_PPCAT(NAME,_MASK)
105 #define clear_output_group(NAME) _PPCAT(NAME,_PORT)&=~(unsigned char)_PPCAT(NAME,_MASK)
108 #define ATOMIC_C90_BEGIN() {uint8_t _sreg_bak__ = SREG; cli(); {
109 #define ATOMIC_C90_END() } SREG = _sreg_bak__;}
Zuordnung der physikalischen Pins zu symbolischen Namen.