00001 /*This file has been prepared for Doxygen automatic documentation generation.*/ 00015 00016 /* Copyright (c) 2007, Atmel Corporation All rights reserved. 00017 * 00018 * Redistribution and use in source and binary forms, with or without 00019 * modification, are permitted provided that the following conditions are met: 00020 * 00021 * 1. Redistributions of source code must retain the above copyright notice, 00022 * this list of conditions and the following disclaimer. 00023 * 00024 * 2. Redistributions in binary form must reproduce the above copyright notice, 00025 * this list of conditions and the following disclaimer in the documentation 00026 * and/or other materials provided with the distribution. 00027 * 00028 * 3. The name of ATMEL may not be used to endorse or promote products derived 00029 * from this software without specific prior written permission. 00030 * 00031 * THIS SOFTWARE IS PROVIDED BY ATMEL ``AS IS'' AND ANY EXPRESS OR IMPLIED 00032 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00033 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND 00034 * SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, 00035 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00036 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00037 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00038 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00039 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 00040 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00041 */ 00042 00043 // LEDs 00044 // **** 00045 #define Leds_init() (DDRD |= 0x03, PORTD &= ~0x03) 00046 00047 #define Led0_on() (PORTD |= 0x01) // PD0 00048 #define Led0_off() (PORTD &= ~0x01) 00049 #define Led0_toggle() (PORTD ^= 0x01) 00050 00051 #define Led1_on() (PORTD |= 0x02) // PD1 00052 #define Led1_off() (PORTD &= ~0x02) 00053 #define Led1_toggle() (PORTD ^= 0x02) 00054 00055 #define Leds_set_val(c) (Leds_off(),PORTD |= (c&0x03)+((c&0x0C)<<2)) 00056 #define Leds_get_val() ((PORTD&0x30)>>2+(PORTD&0x03)) 00057 #define Leds_off() (PORTD &= ~0x03) 00058 00059 // PUSHBUTTONS 00060 // *********** 00061 #define Hwb_button_init() (DDRD &= ~0x80) 00062 #define Is_hwb() (((PIND&0x80) == 0) ? TRUE : FALSE) // PD7 00063 00064 // ================== 00065 // RF_Module 00066 // ================== 00067 // board handles Nordic nRF24L01 : 00068 // -> CE is connecter to PC2 00069 // -> CS is connected to PB4 00070 // -> IRQ is connected to PD4 00071 #define NRF_port_init() (DDRC |= 0x04, DDRB |= 0x10, DDRD &= 0xFB, \ 00072 PORTC &= ~0x04, PORTB |= 0x10, PORTD |= 0x10,\ 00073 DDRB |= 0x01) 00074 00075 #define NRF_CS_PORT PORTB // port 00076 #define NRF_CS_PIN 0x04 // offset 00077 00078 #define NRF_CE_PORT PORTC // port 00079 #define NRF_CE_PIN 0x02 // offset 00080 00081 #define NRF_IRQ_PORT PIND // port 00082 #define NRF_IRQ_PIN 0x04 // offset 00083 00084 00085