Subversion Repositories Projects

Rev

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
 
35
#include "../cpu.h"
36
#include <avr/io.h>
37
#include <avr/pgmspace.h>
38
#include <util/delay.h>
39
#include <stdlib.h>
40
#include <string.h>
41
#include "../lcd/lcd.h"
42
#include "../uart/usart.h"
43
#include "../uart/uart1.h"
44
#include "../main.h"
45
#include "../wi232/Wi232.h"
46
#include "../timer/timer.h"
47
#include "../eeprom/eeprom.h"
48
#include "../setup/setup.h"
49
 
50
 
51
 
52
 
53
 
54
#if defined HWVERSION1_3W || defined HWVERSION3_9 || defined HWVERSION1_2W
55
 
56
uint8_t Wi232_hardware = 0;
57
uint8_t InitErr=0;
58
uint8_t Wi232_Baudrate = 0;             //Merkzelle für aktuelle Baudrate
59
uint8_t Wi232_New_Baudrate = 0;         //Merkzelle für zu setzende Baudrate
60
 
61
 
62
uint16_t SearchWi232(uint8_t Baudrate)      // Suche Wi232 mit entsprechender Baudrate
63
 
64
// Return = 0, Wi232 not found
65
 
66
{
67
  int16_t RegisterWi232;
68
 
69
  SetBaudUart0(Baudrate);
70
  lcd_printpns_at (0, 1, PSTR(" with        Baud"),0);
71
  switch (Baudrate)
72
   {
73
    case  Baud_2400:  lcd_printpns_at (6, 1, PSTR("  2400"),0);break;
74
    case  Baud_9600:  lcd_printpns_at (6, 1, PSTR("  9600"),0);break;
75
    case  Baud_19200: lcd_printpns_at (6, 1, PSTR(" 19200"),0);break;
76
    case  Baud_38400: lcd_printpns_at (6, 1, PSTR(" 38400"),0);break;
77
    case  Baud_57600: lcd_printpns_at (6, 1, PSTR(" 57600"),0);break;
78
    case  Baud_115200:lcd_printpns_at (6, 1, PSTR("115200"),0);break;
79
    break;
80
   }
81
 
82
  RegisterWi232 = ReadWi232(regDiscover);
83
  lcd_print_hex_at(0,2,RegisterWi232,0);
84
  if (RegisterWi232 > 0 && RegisterWi232 < 0xFF)
85
    { Wi232_hardware = 2;
86
      Wi232_Baudrate = Baudrate;
87
    }
88
  return  RegisterWi232;
89
}
90
 
91
 
92
/*************************************************************************
93
Function: discoverWI232()
94
Purpose:  check if Wi232 available
95
Returns:  Version or 0 = timeout
96
 
97
**************************************************************************/
98
void discoverWi232(uint8_t DiscBaudrate)
99
 
100
{
101
 
102
        int16_t RegisterWi232=0;
103
        SwitchToWi232();        /* Serielle Kanäle Wi232 mit USB verbinden*/
104
        set_WI232CMD();
105
        _delay_ms(200);
106
        lcd_cls();
107
        SetBaudUart0( DiscBaudrate);
108
 
109
        lcd_printpns_at (0, 0, PSTR("search Wi.232 Modul"),0);
110
 
111
          {
112
          while (RegisterWi232==0)
113
            {
114
             RegisterWi232=SearchWi232(DiscBaudrate);   if (RegisterWi232 !=0) {Wi232_hardware = 1; continue;}
115
             RegisterWi232=SearchWi232(Baud_2400);   if (RegisterWi232 !=0) continue;
116
             RegisterWi232=SearchWi232(Baud_9600);   if (RegisterWi232 !=0) continue;
117
             RegisterWi232=SearchWi232(Baud_19200);  if (RegisterWi232 !=0) continue;
118
             RegisterWi232=SearchWi232(Baud_38400);  if (RegisterWi232 !=0) continue;
119
             RegisterWi232=SearchWi232(Baud_57600);  if (RegisterWi232 !=0) continue;
120
             RegisterWi232=SearchWi232(Baud_115200); if (RegisterWi232 !=0) continue;
121
            break;
122
            }
123
//        _delay_ms(1000);
124
 
125
        }
126
 
127
        if (RegisterWi232 == 0)
128
        {
129
                lcd_cls();
130
                lcd_printpns_at (0, 0, PSTR("no Wi.232 found"),0);
131
                Wi232_hardware = 0;
132
                _delay_ms(2000);
133
        }
134
 
135
        if (RegisterWi232 == 0xFF)
136
        {
137
                lcd_cls();
138
                lcd_printpns_at (0, 0, PSTR("Wi.232 Sytaxerror   "),0);
139
                set_beep ( 1000, 0x0040, BeepNormal);
140
                _delay_ms(2000);
141
                RegisterWi232 = 0;
142
        }
143
 
144
        if (RegisterWi232 > 0 && RegisterWi232 < 0xFF)
145
        {
146
                lcd_cls();
147
                SetBaudUart0(Wi232_Baudrate);
148
 
149
                if (Wi232_hardware ==1)                 // alles ok , Baudrate Wi232 passt
150
                        lcd_printpns_at (0, 0, PSTR("Wi.232 found "),0);
151
 
152
                if (Wi232_hardware ==2)                 // Wi232 gefunden, aber falsche Baudrate
153
                {
154
                    Config.WiIsSet= false; //wenn hier 2400 gefunden wurde, ist Wi232 nicht initialisiert
155
                        lcd_printpns_at (0, 0, PSTR("Wi.232 wrong Baudrate"),0);
156
                        if (WriteWi232(regNVDATARATE,Config.PKT_Baudrate)!=0) /* NV-Ram auf PKT-Baudrate setzen*/
157
                        {
158
                                lcd_printpns_at (0, 1, PSTR("Error set NV-RAM"),0);
159
                                set_beep ( 1000, 0x0040, BeepNormal);
160
                                _delay_ms(2000);
161
                        }
162
//                      else
163
//                      {
164
////                            _delay_ms(1000);
165
//                              lcd_printpns_at (0, 1, PSTR("NV-RAM is set to "),0);
166
//                              lcd_printpns_at (0, 2, PSTR("given Baudrate"),0);
167
//                              _delay_ms(2000);
168
//                      }
169
 
170
                        if (WriteWi232(regDATARATE,Config.PKT_Baudrate)!=0) /* Ram auf PKT_Baudrate setzen*/
171
                        {
172
                                lcd_printpns_at (0, 3, PSTR("Error set RAM     "),0);
173
                                set_beep ( 1000, 0x0040, BeepNormal);
174
                                _delay_ms(2000);
175
                        }
176
//                      else
177
//                      {
178
////                            _delay_ms(1000);
179
//                              lcd_printpns_at (0, 1, PSTR("RAM is set to "),0);
180
//                              lcd_printpns_at (0, 2, PSTR("given Baudrate"),0);
181
//                              _delay_ms(2000);
182
//                      }
183
 
184
                        SetBaudUart0(Config.PKT_Baudrate);
185
                        Old_Baudrate = Config.PKT_Baudrate;
186
 
187
                }
188
                lcd_cls_line (0,1,21);
189
                lcd_printpns_at (0, 1, PSTR("Version:"),0);
190
                lcd_print_hex_at(9,1,RegisterWi232,0);
191
        }
192
        clr_WI232CMD();
193
}
194
 
195
 
196
/*************************************************************************
197
Function: InitWI232()
198
Purpose:  set Wi232Register for Mikrokopter
199
Returns:  0 = ACK, FF = NAK
200
 
201
**************************************************************************/
202
void InitWi232(uint8_t InitBaudrate)
203
{
204
 
205
uint8_t i = 0;
206
#ifdef HWVERSION3_9
207
        Change_Output(Uart02Wi);  // Verbindung zu Wi232 herstellen
208
#endif
209
 
210
        discoverWi232(Old_Baudrate);  // Check if Wi232 available
211
 
212
        if (Wi232_hardware != 0)
213
        {
214
                lcd_printpns_at (0, 2, PSTR("Init Wi232 wait...."),0);
215
                set_WI232CMD();
216
                _delay_ms(200);
217
                SwitchToWi232();        /* Serielle Kanäle Wi232 mit USB verbinden*/
218
                if (WriteWi232(regNETGRP,126)!=0) /*damit Wi232 nix mehr vom Kopter schickt erstmal Networkgroup ins Nirwana setzen */
219
                        lcd_printpns_at (i++,4,PSTR("."),0);
220
//              InitErr =12;
221
                // Grund:
222
                //If RF packets are received while the CMD line is active,
223
                //they are still processed and presented to the module’s UART for transmission.
224
 
225
                // wenn sich ein EEPROM-Wert ändert wird auch das Ram beschrieben damit die Änderung sofort wirksam wird
226
                if (WriteWi232(regNVTXCHANNEL,Config.WiTXRXChannel)!=0)
227
                        InitErrorWi232(1); /*TX Channel*/
228
                lcd_printpns_at (i++,4,PSTR("."),0);
229
 
230
                if (WriteWi232(regTXCHANNEL,Config.WiTXRXChannel)!=0)
231
                        InitErrorWi232(2);/*TX Channel*/
232
                lcd_printpns_at (i++,4,PSTR("."),0);
233
 
234
                if (WriteWi232(regNVRXCHANNEL,Config.WiTXRXChannel)!=0)
235
                        InitErrorWi232(3);/* RX Channel*/
236
                lcd_printpns_at (i++,4,PSTR("."),0);
237
 
238
                if (WriteWi232(regRXCHANNEL,Config.WiTXRXChannel)!=0)
239
                        InitErrorWi232(4);/* RX Channel*/
240
                lcd_printpns_at (i++,4,PSTR("."),0);
241
 
242
                if (WriteWi232(regNVSLPMODE ,Sleep_Awake)!=0)
243
                        InitErrorWi232(5);/* Sleepmode*/
244
                lcd_printpns_at (i++,4,PSTR("."),0);
245
 
246
                if (WriteWi232(regNVPWRMODE,WbModeP15)!=0)
247
                        InitErrorWi232(6);/* Transceiver Mode/Powermode */
248
                lcd_printpns_at (i++,4,PSTR("."),0);
249
 
250
                if (WriteWi232(regNVTXTO,Config.WiTXTO)!=0)
251
                        InitErrorWi232(7);/* UART Timeout */
252
                lcd_printpns_at (i++,4,PSTR("."),0);
253
 
254
                if (WriteWi232(regTXTO,Config.WiTXTO)!=0)
255
                        InitErrorWi232(8);/* UART Timeout */
256
                lcd_printpns_at (i++,4,PSTR("."),0);
257
 
258
                if (WriteWi232(regNVUARTMTU,Config.WiUartMTU)!=0)
259
                        InitErrorWi232(9);/* UART Buffer*/
260
                lcd_printpns_at (i++,4,PSTR("."),0);
261
 
262
                if (WriteWi232(regUARTMTU,Config.WiUartMTU)!=0)
263
                        InitErrorWi232(10);/* UART Buffer*/
264
                lcd_printpns_at (i++,4,PSTR("."),0);
265
 
266
                if (WriteWi232(regNVNETMODE,Config.WiNetworkMode)!=0)
267
                        InitErrorWi232(11);/* Networkmode*/
268
                lcd_printpns_at (i++,4,PSTR("."),0);
269
 
270
                if (WriteWi232(regNETMODE,Config.WiNetworkMode)!=0)
271
                        InitErrorWi232(12);/* Networkmode*/
272
                lcd_printpns_at (i++,4,PSTR("."),0);
273
 
274
                if (WriteWi232(regNVUSECRC ,CRC_Enable)!=0)
275
                        InitErrorWi232(13);/* CRC*/
276
                lcd_printpns_at (i++,4,PSTR("."),0);
277
 
278
                if (WriteWi232(regNVCSMAMODE,CSMA_En)!=0)
279
                        InitErrorWi232(14);/* CSMA*/
280
                lcd_printpns_at (i++,4,PSTR("."),0);
281
 
282
                if (WriteWi232(regNVNETGRP,Config.WiNetworkGroup)!=0)
283
                        InitErrorWi232(15);/* Networkgroup */
284
                lcd_printpns_at (i++,4,PSTR("."),0);
285
 
286
                if (WriteWi232(regNETGRP,Config.WiNetworkGroup)!=0)
287
                        InitErrorWi232(15);/* Networkgroup */
288
                lcd_printpns_at (i++,4,PSTR("."),0);
289
 
290
                if (WriteWi232(regNVDATARATE,InitBaudrate)!=0)
291
                        InitErrorWi232(16);/* Baudrate*/
292
                lcd_printpns_at (i++,4,PSTR("."),0);
293
                _delay_ms(200);
294
 
295
                if (WriteWi232(regDATARATE,InitBaudrate)!=0)
296
                        InitErrorWi232(17);/* Baudrate*/
297
                lcd_printpns_at (i++,4,PSTR("."),0);
298
 
299
 
300
                clr_WI232CMD();
301
 
302
                if (InitErr !=0)
303
                {
304
                        lcd_printpns_at (0, 2, PSTR("Wi232 InitError  "),0);
305
                        lcd_print_hex(InitErr,0);
306
                        set_beep ( 1000, 0x0040, BeepNormal);
307
                        _delay_ms(2000);
308
                }
309
                else
310
                  {
311
                    lcd_printpns_at (0, 2, PSTR("Wi232 Init ok...."),0);
312
                    WriteWiInitFlag();  // Init merken
313
                    lcd_print_hex(InitBaudrate,0);
314
                  }
315
                SetBaudUart0(InitBaudrate);
316
                _delay_ms(2000);
317
        }
318
}
319
 
320
/*************************************************************************
321
Function: InitErrorWI232()
322
Purpose:  Show Wi232 Error, Value
323
Returns:
324
**************************************************************************/
325
void InitErrorWi232(uint8_t Error)
326
{
327
 
328
        lcd_printpns_at (0, 3, PSTR("Wi232 InitError  "),0);
329
        lcd_print_hex(Error,0);
330
        InitErr=Error;
331
        set_beep ( 500, 0x0040, BeepNormal);
332
        _delay_ms(500);
333
 
334
}
335
 
336
 
337
 
338
 
339
/*************************************************************************
340
Function: WriteWI232()
341
Purpose:  set Register to Wi232, Register, Value
342
Returns:  0 = ACK, FF = NAK
343
ACHTUNG nur für Value <0x80
344
**************************************************************************/
345
int16_t WriteWi232(uint8_t Wi232Register, uint8_t RegisterValue)
346
 
347
{
348
        uint8_t timeout=10;
349
        uint8_t tc=0;
350
        unsigned int v;
351
 
352
        if ( RegisterValue < 0x80 )
353
        {
354
           USART_putc(0xff);
355
           USART_putc(0x02);
356
           USART_putc(Wi232Register);
357
           USART_putc(RegisterValue);
358
        }
359
        else    // RegisterValue >= 0x80
360
          {
361
            USART_putc(0xff);
362
            USART_putc(0x03);
363
            USART_putc(Wi232Register);
364
            USART_putc(0xfe);
365
            USART_putc(RegisterValue - 0x80);
366
          }
367
 
368
 
369
        do
370
        {
371
                v = USART_getc(); /*ACK erwartet*/
372
                _delay_ms(100);
373
                tc ++;
374
        }
375
        while (v==0 && tc!=timeout);
376
 
377
//      lcd_print_hex(v,0);
378
        if (v != 0x06)
379
        {
380
                lcd_printpns_at (0, 2, PSTR("Wi.232 NAK"),0);
381
                set_beep ( 1000, 0x0040, BeepNormal);
382
                _delay_ms(2000);
383
                return 0xFF;
384
        }
385
 
386
        if (v==0x06)
387
                return 0;
388
 
389
        return 0xFF;
390
}
391
 
392
 
393
/*************************************************************************
394
Function: ReadWI232()
395
Purpose:  send Readcommand to Wi232,
396
Returns:  Registervalue, 0 = timeout 0xFF = Syntaxerror
397
 
398
**************************************************************************/
399
int16_t ReadWi232(uint16_t Wi232Register)
400
 
401
{
402
        uint8_t timeout=10;
403
        uint8_t tc=0;
404
 
405
 
406
        unsigned int v;
407
 
408
        v = USART_getc(); /*Zeichen löschen*/
409
        USART_putc(0xff);
410
        USART_putc(0x02);
411
        USART_putc(0xfe);
412
        USART_putc(Wi232Register);
413
        _delay_ms(50);
414
//      lcd_printpns_at (0, 2, PSTR("read Wi232"),0);
415
 
416
 
417
        do
418
        {
419
                v = USART_getc(); /*ACK erwartet*/
420
                _delay_ms(100);
421
                tc ++;
422
        }
423
        while (v==0 && tc!=timeout);
424
 
425
        if (tc == timeout)
426
                return 0; /* Timeout*/
427
 
428
        if (v != 0x06)
429
                return 0xFF; /* Syntaxerror*/
430
 
431
//      lcd_print_hex(v,0);
432
//      v = USART_getc(); /*Register*/
433
//      lcd_print_hex(v,0);
434
//      v = USART_getc(); /*Value*/
435
//      lcd_print_hex(v,0);
436
 
437
        return v;
438
 
439
}
440
 
441
 
442
 
443
///*************************************************************************
444
//Function: EscapeString()
445
//Purpose:
446
//Returns:
447
//Quelle: Radiotronix Wi.232 Manual
448
//**************************************************************************/
449
//
450
//
451
//int EscapeString(char *src, char src_len, char *dest)
452
//{
453
//      // The following function copies and encodes the first
454
//      // src_len characters from *src into *dest. This
455
//      // encoding is necessary for Wi.232 command formats.
456
//      // The resulting string is null terminated. The size
457
//      // of this string is the function return value.
458
//      // ---------------------------------------------------
459
//      uint8_t src_idx, dest_idx;
460
//      // Save space for the command header and size bytes
461
//      // ------------------------------------------------
462
//      dest_idx = 2;
463
//      // Loop through source string and copy/encode
464
//      // ------------------------------------------
465
//      for (src_idx = 0; src_idx < src_len; src_idx++)
466
//      {
467
//              if (src[src_idx] > 127)
468
//              {
469
//                      dest[dest_idx++] = 0xFE;
470
//              }
471
//              dest[dest_idx++] = (src[src_idx] & 0x7F);
472
//      }
473
//      // Add null terminator
474
//      // -------------------
475
//      dest[dest_idx] = 0;
476
//      // Add command header
477
//      // ------------------
478
//      dest[0] = 0xFF;
479
//      dest[1] = dest_idx-2;
480
//
481
//      // Return escape string size
482
//      // -------------------------
483
//      return dest_idx;
484
//}
485
 
486
 
487
//#if defined HWVERSION1_3W || defined HWVERSION3_9
488
///*************************************************************************
489
//Function: Wi232USB()
490
//Purpose:  Connect Wi232 Programmmode to PKT USB,
491
//Returns:
492
//
493
//**************************************************************************/
494
//void Wi232_USB(void)
495
//
496
//
497
//{
498
//      unsigned int c0,c1;
499
//
500
//      if (Wi232_hardware==1)
501
//      {
502
////            USART_Init (UART_BAUD_SELECT(57600,F_CPU));
503
////            uart1_init( UART_BAUD_SELECT(57600,F_CPU) );
504
////            USART_Init (UART_BAUD_SELECT(2400,F_CPU));
505
////            uart1_init( UART_BAUD_SELECT(2400,F_CPU) );
506
//      }
507
//
508
//      if (Wi232_hardware==2)
509
//      {
510
//              USART_Init (UART_BAUD_SELECT(2400,F_CPU));
511
//              uart1_init( UART_BAUD_SELECT(2400,F_CPU) );
512
//      }
513
//
514
//      lcd_cls ();
515
////    SwitchToWi232();        /* Serielle Kanäle Wi232 mit USB verbinden*/
516
//
517
//      set_WI232CMD();
518
//
519
//      lcd_printpns_at (0, 0, PSTR("Wi.232 Konfiguration "),0);
520
//      lcd_printpns_at (0, 1, PSTR("PC mit USB verbinden"),0);
521
//      lcd_printpns_at (0, 2, PSTR("Wi.232"),0);
522
//      lcd_printpns_at (0, 3, PSTR("Programm starten"),0);
523
//      lcd_printpns_at (17, 7, PSTR("Exit"),0);
524
//
525
//      c1 = 0;
526
//
527
//      for(;;)
528
//      {
529
//              c0 = uart1_getc(); /* from USB*/
530
//              if ( c0 & UART_NO_DATA )
531
//              {
532
//                      c1 = USART_getc();
533
//
534
//                      if (c1 == 0)
535
//                      {}
536
//                      else
537
//                      {
538
////                            lcd_print_hex(c1,0);
539
//                              uart1_putc (c1);          /*to USB*/;
540
//                      }
541
//              }
542
//              else
543
//              {
544
//                      USART_putc(c0 ); /* to Wi232*/
545
////                    lcd_print_hex(c0,0);
546
////                    _delay_ms(1);
547
//              }
548
//
549
//              if ((get_key_press (1 << KEY_ENTER)))
550
//              {
551
//                      clr_WI232CMD();
552
////                    uart1_init( UART_BAUD_SELECT(57600,F_CPU) );
553
////                    USART_Init( UART_BAUD_SELECT(57600,F_CPU) );
554
////                    SwitchToFC();
555
//                      return;
556
//              }
557
//
558
//      }
559
//}
560
///*************************************************************************
561
//Function: Wi232_FC()
562
//Purpose:  Connect Wi232 to PKT USB, Transparent
563
//Returns:
564
//
565
//**************************************************************************/
566
//void Wi232_FC(void)
567
//
568
//
569
//{
570
//      unsigned int c0,c1;
571
//
572
//
573
////    USART_Init (UART_BAUD_SELECT(PKT_Baudrate,F_CPU));
574
////    uart1_init( UART_BAUD_SELECT(PKT_Baudrate,F_CPU) );
575
//      SetBaudUart0(Config.PKT_Baudrate);
576
//      SetBaudUart1(Config.PKT_Baudrate);
577
//
578
//
579
//      lcd_cls ();
580
////    SwitchToWi232();        /* Serielle Kanäle Wi232 mit USB verbinden*/
581
//
582
//
583
//      lcd_printpns_at (0, 0, PSTR("Wi.232 to FC "),0);
584
//      lcd_printpns_at (0, 1, PSTR("PC mit USB verbinden"),0);
585
//      lcd_printpns_at (0, 2, PSTR("und Mikrokoptertool"),0);
586
//      lcd_printpns_at (0, 3, PSTR("starten"),0);
587
//      lcd_printpns_at (17, 7, PSTR("Exit"),0);
588
//
589
//      c1 = 0;
590
//
591
//      for(;;)
592
//      {
593
//              c0 = uart1_getc(); /* from USB*/
594
//              if ( c0 & UART_NO_DATA )
595
//              {
596
//                      c1 = USART_getc();
597
//                      if (c1 == 0)
598
//                      {}
599
//                      else
600
//                      {
601
////                            lcd_print_hex(c1,0);
602
//                              uart1_putc (c1);          /*to USB*/;
603
//
604
//                      }
605
//              }
606
//              else
607
//              {
608
//                      USART_putc(c0 ); /* to Wi232*/
609
////                    lcd_print_hex(c0,0);
610
////                    _delay_ms(1);
611
//              }
612
//
613
//              if ((get_key_press (1 << KEY_ENTER)))
614
//              {
615
//                      return;
616
//              }
617
//      }
618
//}
619
 
620
 
621
#endif