Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1920 | - | 1 | /***************************************************************************** |
2 | * Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
||
3 | * Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
||
4 | * Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
||
5 | * Copyright (C) 2011 Harald Bongartz * |
||
6 | * * |
||
7 | * This program is free software; you can redistribute it and/or modify * |
||
8 | * it under the terms of the GNU General Public License as published by * |
||
9 | * the Free Software Foundation; either version 2 of the License. * |
||
10 | * * |
||
11 | * This program is distributed in the hope that it will be useful, * |
||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
||
14 | * GNU General Public License for more details. * |
||
15 | * * |
||
16 | * You should have received a copy of the GNU General Public License * |
||
17 | * along with this program; if not, write to the * |
||
18 | * Free Software Foundation, Inc., * |
||
19 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
||
20 | * * |
||
21 | * * |
||
22 | * Credits to: * |
||
23 | * Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
||
24 | * http://www.mikrokopter.de * |
||
25 | * Gregor "killagreg" Stobrawa for his version of the MK code * |
||
26 | * Thomas Kaiser "thkais" for the original project. See * |
||
27 | * http://www.ft-fanpage.de/mikrokopter/ * |
||
28 | * http://forum.mikrokopter.de/topic-4061-1.html * |
||
29 | * Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
||
30 | * http://www.mylifesucks.de/oss/c-osd/ * |
||
31 | * Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
||
32 | *****************************************************************************/ |
||
33 | |||
34 | #ifndef WI232_H_ |
||
35 | #define WI232_H_ |
||
36 | |||
37 | |||
38 | void discoverWi232(uint8_t Baudrate); |
||
39 | void InitWi232(uint8_t Baudrate); |
||
40 | int16_t WriteWi232(uint8_t Wi232Register, uint8_t RegisterValue); |
||
41 | int16_t ReadWi232(uint16_t Wi232Register); |
||
42 | void InitErrorWi232(uint8_t Error); |
||
43 | extern uint8_t Wi232_hardware; |
||
44 | extern uint8_t Wi232_New_Baudrate; //Merkzelle für zu setzende Baudrate |
||
45 | |||
46 | |||
47 | // Non-volatile Registers |
||
48 | // Name Address Description Default |
||
49 | #define regNVTXCHANNEL 0x00 // Transmit channel setting ## 0 ## |
||
50 | #define regNVRXCHANNEL 0x01 // Receive channel setting ## 0 ## |
||
51 | #define regNVPWRMODE 0x02 // Operating mode settings ## +13 dBm widebandmode ## |
||
52 | #define regNVDATARATE 0x03 // UART data rate ## 2400bps ## |
||
53 | #define regNVNETMODE 0x04 // Network mode (Normal/Slave) ## Normal ## |
||
54 | #define regNVTXTO 0x05 // Transmit wait timeout ## ~16ms ## |
||
55 | #define regNVNETGRP 0x06 // Network group ID ## 0x00 ## |
||
56 | #define regNVUSECRC 0x08 // Enable/Disable CRC ## Enabled ## |
||
57 | #define regNVUARTMTU 0x09 // Minimum transmission unit. ## 64 bytes ## |
||
58 | #define regNVSHOWVER 0x0A // Enable/Disable start-up message ## Enabled ## |
||
59 | #define regNVCSMAMODE 0x0B // Enable/Disable CSMA ## Enabled ## |
||
60 | #define regNVSLPMODE 0x0D // Power state of module ## Awake ## |
||
61 | #define regNVACKONWAKE 0x0E // Send ACK character to host on wake |
||
62 | |||
63 | |||
64 | // Non-volatile Read Only Registers |
||
65 | // Name Address Description |
||
66 | #define regMAC0 0x22 // These registers form the unique 48-bit MAC address. |
||
67 | #define regMAC1 0x23 // MAC |
||
68 | #define regMAC2 0x24 // MAC |
||
69 | #define regOUI0 0x25 // MAC |
||
70 | #define regOUI1 0x26 // MAC |
||
71 | #define regOUI2 0x27 // MAC |
||
72 | |||
73 | #define regDiscover 0x78 // Versionsregister |
||
74 | |||
75 | |||
76 | // Volatile Read/Write Registers |
||
77 | // Name Address Description |
||
78 | #define regTXCHANNEL 0x4B // Transmit channel setting |
||
79 | #define regRXCHANNEL 0x4C // Receive channel setting |
||
80 | #define regPWRMODE 0x4D // Operating mode settings |
||
81 | #define regDATARATE 0x4E // UART data rate |
||
82 | #define regNETMODE 0x4F // Network mode (Normal or Slave) |
||
83 | #define regTXTO 0x50 // Transmit wait timeout |
||
84 | #define regNETGRP 0x51 // Network group ID |
||
85 | #define regUSECRC 0x53 // Enable/Disable CRC |
||
86 | #define regUARTMTU 0x54 // Minimum transmission unit. |
||
87 | #define regSHOWVER 0x55 // Enable/Disable start-up message |
||
88 | #define regCSMAMODE 0x56 // Enable/disable CSMA |
||
89 | #define regSLPMODE 0x58 // Power state of module |
||
90 | #define regACKONWAKE 0x59 // Send ACK character to host on wake |
||
91 | |||
92 | |||
93 | // Wideband Channels |
||
94 | // regNVTXCHAN (0x00) regTXCHAN (0x4B) |
||
95 | // Channel Number Frequency |
||
96 | #define wChan0 0x00 // 868.300 MHz |
||
97 | #define wChan1 0x01 // 868.95 MHz ## MK ## |
||
98 | |||
99 | // Narrowband Channels |
||
100 | // regNVRXCHAN (0x01) regRXCHAN (0x4C) |
||
101 | // Channel Number Frequency |
||
102 | #define nChan0 0x00 // 868.225 MHz |
||
103 | #define nChan1 0x01 // 868.375 MHz ## MK ## |
||
104 | #define nChan2 0x02 // 868.850 MHz |
||
105 | #define nChan3 0x03 // 869.050 MHz |
||
106 | #define nChan4 0x04 // 869.525 MHz |
||
107 | #define nChan5 0x05 // 869.850 MHz |
||
108 | |||
109 | // Power Mode |
||
110 | // regNVPWRMODE (0x02) regPWRMODE (0x4D) |
||
111 | // PM1 PM1 PM0 Mode |
||
112 | #define NbModeN0 0x00 // 0 0 0 Narrowband Mode 0dBm power setting (typical) |
||
113 | #define WbModeP5 0x01 // 0 0 1 Wideband Mode +5dBm power setting (typical) |
||
114 | #define WbModeP10 0x02 // 0 1 0 Wideband Mode +10dBm power setting (typical) |
||
115 | #define WbModeP15 0x03 // 0 1 1 Wideband Mode +15dBm power setting (typical) ## MK ## |
||
116 | #define WbModeN0 0x04 // 1 0 0 Wideband Mode 0dBm power setting (typical) |
||
117 | #define NbModeP5 0x05 // 1 0 1 Narrowband Mode +5dBm power setting (typical) |
||
118 | #define NbModeP10 0x06 // 1 1 0 Narrowband Mode +10dBm power setting (typical) |
||
119 | #define NbModeP15 0x07 // 1 1 1 Narrowband Mode +15dBm power setting (typical) |
||
120 | |||
121 | // Wi232 UART Baudrate |
||
122 | // regNVDATARATE (0x03) regDATARATE (0x4E) |
||
123 | // Baud Rate BR2 BR1 BR0 |
||
124 | #define Wi232_2400 Baud_2400 // 0 0 0* (default 2400) |
||
125 | #define Wi232_9600 Baud_9600 // 0 0 1 |
||
126 | #define Wi232_19200 Baud_19200 // 0 1 0 |
||
127 | #define Wi232_38400 Baud_38400 // 0 1 1 |
||
128 | #define Wi232_57600 Baud_57600 // 1 0 0 ## MK ## |
||
129 | #define Wi232_115200 Baud_115200 // 1 0 1 |
||
130 | #define Wi232_10400 0x06 // 1 1 0 |
||
131 | #define Wi232_31250 0x07 // 1 1 1 |
||
132 | |||
133 | // NetworkMode |
||
134 | // regNVNETMODE (0x04) regNETMODE (0x4F) |
||
135 | #define NetMode_Slave 0x00 // Slavemode |
||
136 | #define NetMode_Normal 0x01 // Normalmode (default) |
||
137 | |||
138 | // Transmit Wait Timeout |
||
139 | // regNVTXTO (0x05) regTXTO (0x50) |
||
140 | #define TWaitTimeFull 0x00 // full Buffer required |
||
141 | #define TWaitTime16 0x10 // 16 ms Delay (default) |
||
142 | |||
143 | // Network Group |
||
144 | // regNVNETGRP (0x06) regNETGRP (0x51) |
||
145 | #define NetWorkGroup 66 // default = 0, valid 0-127 ## MK = 66 ## |
||
146 | |||
147 | // CRC Control |
||
148 | // regNVUSECRC (0x08) regUSECRC (0x53) |
||
149 | #define CRC_Disable 0x00 // no CRC check |
||
150 | #define CRC_Enable 0x01 // CRC check (default) |
||
151 | |||
152 | // UART minimum transmission unit |
||
153 | // regNVUARTMTU (0x09) regUARTMTU (0x54) |
||
154 | #define UartMTU64 64 // default=64, valid 1-144 |
||
155 | |||
156 | // Verbose mode |
||
157 | // regNVSHOWVER (0x0A) |
||
158 | #define ShowVers_Dis 0x00 // do not show Startupmessage ## MK = 66 ## |
||
159 | #define ShowVers_En 0x01 // show Startupmessage (default) |
||
160 | |||
161 | // CSMA enable |
||
162 | // regNVCSMAMODE (0x0B) regCSMAMODE (0x56) |
||
163 | #define CSMA_Dis 0x00 // disable CSMA Carrier-sense multiple access |
||
164 | #define CSMA_En 0x01 // enable CSMA (default) |
||
165 | |||
166 | // Sleep control |
||
167 | // regNVSLPMODE (0x0D) regSLPMODE (0x58) |
||
168 | #define Sleep_Awake 0x00 // Sleepmode = Awake (default) |
||
169 | #define Sleep 0x01 // Sleepmode = Sleep |
||
170 | #define Sleep_Stby 0x02 // Sleepmode = Standby |
||
171 | |||
172 | // ACK on Wake |
||
173 | // regNVACKONWAKE (0x0D) regACKONWAKE (0x59) |
||
174 | #define ACKwake_Dis 0x00 // disable ACK on Wake |
||
175 | #define ACKwake_En 0x01 // enable ACK on Wake (default) |
||
176 | |||
177 | |||
178 | #endif // WI232_H_ |