Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1515 | - | 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(void); |
||
39 | void InitWi232(void); |
||
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 | |||
45 | |||
46 | // Non-volatile Registers |
||
47 | // Name Address Description Default |
||
48 | #define regNVTXCHANNEL 0x00 // Transmit channel setting ## 0 ## |
||
49 | #define regNVRXCHANNEL 0x01 // Receive channel setting ## 0 ## |
||
50 | #define regNVPWRMODE 0x02 // Operating mode settings ## +13 dBm widebandmode ## |
||
51 | #define regNVDATARATE 0x03 // UART data rate ## 2400bps ## |
||
52 | #define regNVNETMODE 0x04 // Network mode (Normal/Slave) ## Normal ## |
||
53 | #define regNVTXTO 0x05 // Transmit wait timeout ## ~16ms ## |
||
54 | #define regNVNETGRP 0x06 // Network group ID ## 0x00 ## |
||
55 | #define regNVUSECRC 0x08 // Enable/Disable CRC ## Enabled ## |
||
56 | #define regNVUARTMTU 0x09 // Minimum transmission unit. ## 64 bytes ## |
||
57 | #define regNVSHOWVER 0x0A // Enable/Disable start-up message ## Enabled ## |
||
58 | #define regNVCSMAMODE 0x0B // Enable/Disable CSMA ## Enabled ## |
||
59 | #define regNVSLPMODE 0x0D // Power state of module ## Awake ## |
||
60 | #define regNVACKONWAKE 0x0E // Send ACK character to host on wake |
||
61 | |||
62 | |||
63 | // Non-volatile Read Only Registers |
||
64 | // Name Address Description |
||
65 | #define regMAC0 0x22 // These registers form the unique 48-bit MAC address. |
||
66 | #define regMAC1 0x23 // MAC |
||
67 | #define regMAC2 0x24 // MAC |
||
68 | #define regOUI0 0x25 // MAC |
||
69 | #define regOUI1 0x26 // MAC |
||
70 | #define regOUI2 0x27 // MAC |
||
71 | |||
72 | #define regDiscover 0x78 // Versionsregister |
||
73 | |||
74 | |||
75 | // Volatile Read/Write Registers |
||
76 | // Name Address Description |
||
77 | #define regTXCHANNEL 0x4B // Transmit channel setting |
||
78 | #define regRXCHANNEL 0x4C // Receive channel setting |
||
79 | #define regPWRMODE 0x4D // Operating mode settings |
||
80 | #define regDATARATE 0x4E // UART data rate |
||
81 | #define regNETMODE 0x4F // Network mode (Normal or Slave) |
||
82 | #define regTXTO 0x50 // Transmit wait timeout |
||
83 | #define regNETGRP 0x51 // Network group ID |
||
84 | #define regUSECRC 0x53 // Enable/Disable CRC |
||
85 | #define regUARTMTU 0x54 // Minimum transmission unit. |
||
86 | #define regSHOWVER 0x55 // Enable/Disable start-up message |
||
87 | #define regCSMAMODE 0x56 // Enable/disable CSMA |
||
88 | #define regSLPMODE 0x58 // Power state of module |
||
89 | #define regACKONWAKE 0x59 // Send ACK character to host on wake |
||
90 | |||
91 | |||
92 | // Wideband Channels |
||
93 | // regNVTXCHAN (0x00) regTXCHAN (0x4B) |
||
94 | // Channel Number Frequency |
||
95 | #define wChan0 0x00 // 868.300 MHz |
||
96 | #define wChan1 0x01 // 868.95 MHz ## MK ## |
||
97 | |||
98 | // Narrowband Channels |
||
99 | // regNVRXCHAN (0x01) regRXCHAN (0x4C) |
||
100 | // Channel Number Frequency |
||
101 | #define nChan0 0x00 // 868.225 MHz |
||
102 | #define nChan1 0x01 // 868.375 MHz ## MK ## |
||
103 | #define nChan2 0x02 // 868.850 MHz |
||
104 | #define nChan3 0x03 // 869.050 MHz |
||
105 | #define nChan4 0x04 // 869.525 MHz |
||
106 | #define nChan5 0x05 // 869.850 MHz |
||
107 | |||
108 | // Power Mode |
||
109 | // regNVPWRMODE (0x02) regPWRMODE (0x4D) |
||
110 | // PM1 PM1 PM0 Mode |
||
111 | #define NbModeN0 0x00 // 0 0 0 Narrowband Mode 0dBm power setting (typical) |
||
112 | #define WbModeP5 0x01 // 0 0 1 Wideband Mode +5dBm power setting (typical) |
||
113 | #define WbModeP10 0x02 // 0 1 0 Wideband Mode +10dBm power setting (typical) |
||
114 | #define WbModeP15 0x03 // 0 1 1 Wideband Mode +15dBm power setting (typical) ## MK ## |
||
115 | #define WbModeN0 0x04 // 1 0 0 Wideband Mode 0dBm power setting (typical) |
||
116 | #define NbModeP5 0x05 // 1 0 1 Narrowband Mode +5dBm power setting (typical) |
||
117 | #define NbModeP10 0x06 // 1 1 0 Narrowband Mode +10dBm power setting (typical) |
||
118 | #define NbModeP15 0x07 // 1 1 1 Narrowband Mode +15dBm power setting (typical) |
||
119 | |||
120 | // Wi232 UART Baudrate |
||
121 | // regNVDATARATE (0x03) regDATARATE (0x4E) |
||
122 | // Baud Rate BR2 BR1 BR0 |
||
123 | #define Wi232_2400 0x00 // 0 0 0* (default 2400) |
||
124 | #define Wi232_9600 0x01 // 0 0 1 |
||
125 | #define Wi232_19200 0x02 // 0 1 0 |
||
126 | #define Wi232_38400 0x03 // 0 1 1 |
||
127 | #define Wi232_57600 0x04 // 1 0 0 ## MK ## |
||
128 | #define Wi232_115200 0x05 // 1 0 1 |
||
129 | #define Wi232_10400 0x06 // 1 1 0 |
||
130 | #define Wi232_31250 0x07 // 1 1 1 |
||
131 | |||
132 | // NetworkMode |
||
133 | // regNVNETMODE (0x04) regNETMODE (0x4F) |
||
134 | #define NetMode_Slave 0x00 // Slavemode |
||
135 | #define NetMode_Normal 0x01 // Normalmode (default) |
||
136 | |||
137 | // Transmit Wait Timeout |
||
138 | // regNVTXTO (0x05) regTXTO (0x50) |
||
139 | #define TWaitTimeFull 0x00 // full Buffer required |
||
140 | #define TWaitTime16 0x10 // 16 ms Delay (default) |
||
141 | |||
142 | // Network Group |
||
143 | // regNVNETGRP (0x06) regNETGRP (0x51) |
||
144 | #define NetWorkGroup 66 // default = 0, valid 0-127 ## MK = 66 ## |
||
145 | |||
146 | // CRC Control |
||
147 | // regNVUSECRC (0x08) regUSECRC (0x53) |
||
148 | #define CRC_Disable 0x00 // no CRC check |
||
149 | #define CRC_Enable 0x01 // CRC check (default) |
||
150 | |||
151 | // UART minimum transmission unit |
||
152 | // regNVUARTMTU (0x09) regUARTMTU (0x54) |
||
153 | #define UartMTU64 64 // default=64, valid 1-144 |
||
154 | |||
155 | // Verbose mode |
||
156 | // regNVSHOWVER (0x0A) |
||
157 | #define ShowVers_Dis 0x00 // do not show Startupmessage ## MK = 66 ## |
||
158 | #define ShowVers_En 0x01 // show Startupmessage (default) |
||
159 | |||
160 | // CSMA enable |
||
161 | // regNVCSMAMODE (0x0B) regCSMAMODE (0x56) |
||
162 | #define CSMA_Dis 0x00 // disable CSMA Carrier-sense multiple access |
||
163 | #define CSMA_En 0x01 // enable CSMA (default) |
||
164 | |||
165 | // Sleep control |
||
166 | // regNVSLPMODE (0x0D) regSLPMODE (0x58) |
||
167 | #define Sleep_Awake 0x00 // Sleepmode = Awake (default) |
||
168 | #define Sleep 0x01 // Sleepmode = Sleep |
||
169 | #define Sleep_Stby 0x02 // Sleepmode = Standby |
||
170 | |||
171 | // ACK on Wake |
||
172 | // regNVACKONWAKE (0x0D) regACKONWAKE (0x59) |
||
173 | #define ACKwake_Dis 0x00 // disable ACK on Wake |
||
174 | #define ACKwake_En 0x01 // enable ACK on Wake (default) |
||
175 | |||
176 | |||
177 | #endif // WI232_H_ |