Alarm Sensor Module  0.1
⇒ back to Project Page
rfm12_io.h
Go to the documentation of this file.
1 
34 
35 #ifndef RFM12_IO_H_INCLUDED
36 #define RFM12_IO_H_INCLUDED
37 
38 
39 /******************************************
40  \internal
41  General definitions
42 *******************************************/
43 #define LED_INDICATOR 0 //switches on or off the LED indicator output
44 
45 #define RFM12_TXBUFFER_LENGTH 18 //length of transmit buffer (should be used for custom definition of TX buffer)
46 #define RFM12_RXBUFFER_LENGTH 18 //length of receive buffer (should be used for custom definition of RX buffer)
47 
48 
49 /******************************************
50  \internal
51  Timing definitions
52 *******************************************/
53 #define RFM12_POR_DELAY_MS 200 //Power-On Reset [ms]
54 #define RFM12_RESET_WIDTH_MS 200 //Reset Pulse Width [ms]
55 
56 #define RFM12_COMMAND_TIMEOUT 1000 //number of cycles for timeout (command/data transfer to RFM12 module)
57 
58 
59 /******************************************
60  \internal
61  Control definitions
62 *******************************************/
63 
64 #define RFM12_REGISTER_DATA 0x1 //data i/o: register data
65 #define RFM12_TX_DATA 0x2 //data i/o: transmit data
66 #define RFM12_RX_DATA 0x3 //data i/o: receive data
67 
68 
69 #define RFM12_TRANSMISSION_BURST 1 //burst during transmission enabled [1] or not [0]
70  //during data transmission nSEL will be hold at "Low"
71 
72 /******************************************
73  \internal
74  Command definitions
75 *******************************************/
76 
77 #define RFM12_CONFIG_VALUE 0x80e7 //Configuration Setting Value: EL; EF; 868 MHz; 11,5 pF
78 #define RFM12_CONFIG_TX_OFF_VALUE 0x8067 //Configuration Setting Value: EF; 868 MHz; 11,5 pF
79 #define RFM12_POWERMANAGEMENT_TX_VALUE 0x8239 //Power Management Value: ET; ES; EX; DC
80 #define RFM12_POWERMANAGEMENT_RX_VALUE 0x82c9 //Power Management Value: ER; EBB; ES; EX; DC
81 #define RFM12_POWERMANAGEMENT_SLEEP_VALUE 0x8201 //Power Management Value: DC (switch off all modules)
82 #define RFM12_POWERSETTING_VALUE 0x94cd //Power Setting Value: VDI; Fast; 67 kHz; -6 dB; -71 dB
83 #define RFM12_STATUSREAD_VALUE 0x0000 //Status Read Command
84 #define RFM12_FREQUENCY_VALUE 0xa672 //Frequency Setting Command: 868,25 MHz
85 #define RFM12_DATARATE_VALUE 0xc611 //Data Rate Setting Command: 19200 bps
86 #define RFM12_DATAFILTER_VALUE 0xc2ab //Data Filter Command: AL, Digital Filter, Treshold: 4
87 #define RFM12_FIFOMODE_VALUE 0xca83 //FIFO Mode Command: FIFO IT Level: 8, ff, dr
88 #define RFM12_NOFIFOMODE_VALUE 0xca81 //FIFO Mode Command: FIFO IT Level: 8, dr
89 #define RFM12_AFC_VALUE 0xc4f7 //AFC Command: only receiving; +3/-4; FI; OE; EN
90 #define RFM12_TXCONFIG_VALUE 0x9822 //TX Configuration Setting Value: 45 kHz; -5 dB
91 //#define RFM12_TXCONFIG_VALUE 0x9820 //TX Configuration Setting Value: 45 kHz; -0 dB
92 #define RFM12_PLLSETTING_VALUE 0xcc77 //PLL Setting Value: 30 kHz; -9 dB
93 #define RFM12_WAKEUPTIMER_VALUE 0xE000 //Wakeup Timer Setting Value: not used
94 #define RFM12_LOWDUTYCYCLE_VALUE 0xc800 //Low Duty-Cycle Setting Value: not used
95 #define RFM12_LOWBATDET_VALUE 0xc000 //Low Battery Detector Value: 2,25 V; 1 MHz
96 #define RFM12_FIFOREAD_VALUE 0xb000 //Read RX FIFO Command (High Byte)
97 #define RFM12_SYNCHRONPATTERN_VALUE 0xced4 //Synchron Pattern Command (only for SI4421)
98 
99 
100 /******************************************
101  \internal
102  Error value definitions
103 *******************************************/
104 
105 #define RFM12_RW_HIGH_BYTE_SET_TIMEOUT -1 //timeout during R/W (high byte) setting occured
106 #define RFM12_RW_LOW_BYTE_SET_TIMEOUT -2 //timeout during R/W (low byte) setting occured
107 #define RFM12_CFG_HIGH_BYTE_SET_TIMEOUT -3 //timeout during config (high byte) setting occured
108 #define RFM12_CFG_LOW_BYTE_SET_TIMEOUT -4 //timeout during config (low byte) setting occured
109 #define RFM12_PM_HIGH_BYTE_SET_TIMEOUT -5 //timeout during power management (high byte) setting occured
110 #define RFM12_PM_LOW_BYTE_SET_TIMEOUT -6 //timeout during power management (low byte) setting occured
111 #define RFM12_RDY_NEXT_BYTE_SET_TIMEOUT -7 //timeout during waiting for next byte ready occured
112 #define RFM12_TX_HIGH_BYTE_SET_TIMEOUT -8 //timeout during TX (high byte) setting occured
113 #define RFM12_TX_LOW_BYTE_SET_TIMEOUT -9 //timeout during TX (low byte) setting occured
114 #define RFM12_RX_HIGH_BYTE_SET_TIMEOUT -10 //timeout during RX (high byte) setting occured
115 #define RFM12_RX_LOW_BYTE_SET_TIMEOUT -11 //timeout during RX (low byte) setting occured
116 
117 
118 /******************************************
119  \internal
120  Function definitions
121 *******************************************/
122 
123 int16_t rfm12_data_io(volatile uint16_t *, volatile uint16_t *, uint8_t, uint8_t, uint8_t);
124 uint16_t rfm12_init(uint8_t);
125 void rfm12_pin_init(void);
126 
127 
128 
129 
130 
131 #endif // RFM12_IO_H_INCLUDED
uint16_t rfm12_init(uint8_t)
Definition: rfm12_io.c:538
void rfm12_pin_init(void)
Definition: rfm12_io.c:679
int16_t rfm12_data_io(volatile uint16_t *, volatile uint16_t *, uint8_t, uint8_t, uint8_t)
Definition: rfm12_io.c:78