stk_600.h

Go to the documentation of this file.
00001 /*This file is prepared for Doxygen automatic documentation generation.*/
00013 
00014 /* Copyright (c) 2009 Atmel Corporation. All rights reserved.
00015  *
00016  * Redistribution and use in source and binary forms, with or without
00017  * modification, are permitted provided that the following conditions are met:
00018  *
00019  * 1. Redistributions of source code must retain the above copyright notice,
00020  * this list of conditions and the following disclaimer.
00021  *
00022  * 2. Redistributions in binary form must reproduce the above copyright notice,
00023  * this list of conditions and the following disclaimer in the documentation
00024  * and/or other materials provided with the distribution.
00025  *
00026  * 3. The name of Atmel may not be used to endorse or promote products derived
00027  * from this software without specific prior written permission.
00028  *
00029  * 4. This software may only be redistributed and used in connection with an Atmel
00030  * AVR product.
00031  *
00032  * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
00033  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00034  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE EXPRESSLY AND
00035  * SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,
00036  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00037  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00038  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00039  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00040  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00041  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00042  */
00043 
00044 #ifndef STK_600_H
00045 #define STK_600_H
00046 
00047 //_____ I N C L U D E S ____________________________________________________
00048 #include "config.h"
00049 
00050 #if (TARGET_BOARD==STK600)
00051 
00052 //_____ M A C R O S ________________________________________________________
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

Generated on Fri Sep 11 15:02:35 2009 for ATMEL by  doxygen 1.5.3