00001
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 #ifndef STK_600_H
00045 #define STK_600_H
00046
00047
00048 #include "config.h"
00049
00050 #if (TARGET_BOARD==STK600)
00051
00052
00053
00070
00071
00075
00076 #define LED_PORT PORTC
00077 #define LED_DDR DDRC
00078 #define LED_PIN PINC
00079 #define LED6_BIT PINC6
00080 #define LED7_BIT PINC7
00081
00082 #define Leds_init() (LED_DDR |= (1<<LED7_BIT) | (1<<LED6_BIT))
00083 #define Leds_on() (LED_PORT &= ~((1<<LED7_BIT) | (1<<LED6_BIT)))
00084 #define Leds_off() (LED_PORT |= (1<<LED7_BIT) | (1<<LED6_BIT))
00085
00086 #define Led6_on() (LED_PORT &= ~(1<<LED6_BIT))
00087 #define Led7_on() (LED_PORT &= ~(1<<LED7_BIT))
00088 #define Led6_off() (LED_PORT |= (1<<LED6_BIT))
00089 #define Led7_off() (LED_PORT |= (1<<LED7_BIT))
00090 #define Led6_toggle() (LED_PIN |= (1<<LED6_BIT))
00091 #define Led7_toggle() (LED_PIN |= (1<<LED7_BIT))
00092 #define Is_led6_on() (LED_PIN & (1<<LED6_BIT) ? FALSE : TRUE)
00093 #define Is_led7_on() (LED_PIN & (1<<LED7_BIT) ? FALSE : TRUE)
00095
00099 #define Switches_init() (DDRB &= ~0xFF, PORTB |= 0xFF)
00100 #define Is_switch_7() ((PINB & (1<<PINB7)) ? FALSE : TRUE)
00101 #define Is_switch_6() ((PINB & (1<<PINB6)) ? FALSE : TRUE)
00102 #define Is_switch_5() ((PINB & (1<<PINB5)) ? FALSE : TRUE)
00103 #define Is_switch_4() ((PINB & (1<<PINB4)) ? FALSE : TRUE)
00104 #define Is_switch_3() ((PINB & (1<<PINB3)) ? FALSE : TRUE)
00105 #define Is_switch_2() ((PINB & (1<<PINB2)) ? FALSE : TRUE)
00106 #define Is_switch_1() ((PINB & (1<<PINB1)) ? FALSE : TRUE)
00107 #define Is_switch_0() ((PINB & (1<<PINB0)) ? FALSE : TRUE)
00108 #define Is_not_switch_7() ((PINB & (1<<PINB7)) ? TRUE : FALSE)
00109 #define Is_not_switch_6() ((PINB & (1<<PINB6)) ? TRUE : FALSE)
00110 #define Is_not_switch_5() ((PINB & (1<<PINB5)) ? TRUE : FALSE)
00111 #define Is_not_switch_4() ((PINB & (1<<PINB4)) ? TRUE : FALSE)
00112 #define Is_not_switch_3() ((PINB & (1<<PINB3)) ? TRUE : FALSE)
00113 #define Is_not_switch_2() ((PINB & (1<<PINB2)) ? TRUE : FALSE)
00114 #define Is_not_switch_1() ((PINB & (1<<PINB1)) ? TRUE : FALSE)
00115 #define Is_not_switch_0() ((PINB & (1<<PINB0)) ? TRUE : FALSE)
00116
00121 #define Switches_enable_it() { \
00122 PCMSK0 |= (1<<PCINT0)|(1<<PCINT1)|(1<<PCINT2)|(1<<PCINT3)|(1<<PCINT4)|(1<<PCINT5)|(1<<PCINT6)|(1<<PCINT7);\
00123 PCIFR |= (1<<PCIF0); \
00124 PCICR |= (1<<PCIE0);}
00125
00130 #define Switches_disable_it() { \
00131 PCICR &= ~(1<<PCIE0); \
00132 PCIFR |= (1<<PCIF0); \
00133 PCMSK0 &= ~((1<<PCINT0)|(1<<PCINT1)|(1<<PCINT2)|(1<<PCINT3)|(1<<PCINT4)|(1<<PCINT5)|(1<<PCINT6)|(1<<PCINT7));}
00135
00137
00138 #endif // TARGET_BOARD==STK600
00139
00140 #endif // STK_600_H