/
rfm12_config.h
105 lines (89 loc) · 2.84 KB
/
rfm12_config.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/**** RFM 12 library for Atmel AVR Microcontrollers *******
*
* This software is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* @author Peter Fuhrmann, Hans-Gert Dahmen, Soeren Heisrath
*/
/******************************************************
* *
* C O N F I G U R A T I O N *
* *
******************************************************/
/*
Connect the RFM12 to the AVR as follows:
RFM12 | AVR
----------------+------------
SDO | MISO
nIRQ | INT0
FSK/DATA/nFFS | VCC
DCLK/CFIL/FFIT | -
CLK | -
nRES | -
GND | GND
ANT | -
VDD | VCC
GND | GND
nINT/VDI | -
SDI | MOSI
SCK | SCK
nSEL | Slave select pin defined below
*/
#ifndef RFM12_CONFIG_H
//Pin that the RFM12's slave select is connected to
#define DDR_SS DDRB
#define PORT_SS PORTB
//#define BIT_SS 4
#define BIT_SS 1
//SPI port
#define DDR_SPI DDRB
#define PORT_SPI PORTB
#define PIN_SPI PINB
#define BIT_MOSI 5
#define BIT_MISO 6
#define BIT_SCK 7
#define BIT_SPI_SS 4
//this is the hardware SS pin of the AVR - it
//needs to be set to output for the spi-interface to work
//correctly, independently of the CS pin used for the RFM12
//frequency to use
#define FREQ 433000000UL
//use this for datarates >= 2700 Baud
#define DATARATE_VALUE RFM12_DATARATE_CALC_HIGH(9600.0)
//use this for 340 Baud < datarate < 2700 Baud
//#define DATARATE_VALUE RFM12_DATARATE_CALC_LOW(1200.0)
/**** TX BUFFER SIZE
*/
#define RFM12_TX_BUFFER_SIZE 30
/**** RX BUFFER SIZE
* there are going to be 2 Buffers of this size
* (double_buffering)
*/
#define RFM12_RX_BUFFER_SIZE 30
/**** UART DEBUGGING
* en- or disable debugging via uart.
*/
#define RFM12_UART_DEBUG 0
/**** INTERRUPT VECTOR
* set the name for the interrupt vector here
*/
//the Interrupt mask register
//setup the interrupt to trigger on negative edge
#define RFM12_INT_VECT (INT2_vect)
#define RFM12_INT_BIT (INT2)
#define RFM12_INT_MSK GICR
#define RFM12_INT_SETUP() MCUCR |= (1<<ISC01)
#define RFM12_CONFIG_H
#endif