Subversion Repositories Projects

Rev

Rev 783 | Rev 826 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 783 Rev 800
Line 16... Line 16...
16
 *   along with this program; if not, write to the                          *
16
 *   along with this program; if not, write to the                          *
17
 *   Free Software Foundation, Inc.,                                        *
17
 *   Free Software Foundation, Inc.,                                        *
18
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.              *
18
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.              *
19
 ****************************************************************************/
19
 ****************************************************************************/
Line -... Line 20...
-
 
20
 
20
 
21
#include "main.h"
21
#include <avr/io.h>
22
#include <avr/io.h>
22
#include <avr/interrupt.h>
23
#include <avr/interrupt.h>
23
#include <util/delay.h>
-
 
24
#include "main.h"
24
#include <util/delay.h>
Line 25... Line 25...
25
#include "usart1.h"
25
#include "usart1.h"
Line 26... Line 26...
26
 
26
 
Line 209... Line 209...
209
        if (len--) rxd_buffer[ptrOut++] = z;
209
        if (len--) rxd_buffer[ptrOut++] = z;
210
        else break;
210
        else break;
211
    }
211
    }
212
    pRxData = &rxd_buffer[3];
212
    pRxData = &rxd_buffer[3];
213
    RxDataLen = ptrOut - 3;
213
    RxDataLen = ptrOut - 3;
214
}
214
}
215
 
-
 
216
 
215
 
217
/**
216
/**
218
 * Request Data through usart1 until a answer is received
217
 * Request Data through usart1 until a answer is received
219
 */
218
 */
220
void usart1_request_blocking(unsigned char answer, const char* message) {
219
void usart1_request_blocking(unsigned char answer, const char* message) {
221
        rxd_buffer[2] = answer + 1;    
220
    rxd_buffer[2] = answer + 1;
222
        while (rxd_buffer[2] != answer) {
221
    while (rxd_buffer[2] != answer) {
223
                rxd_buffer_locked = 0;                 
222
        rxd_buffer_locked = 0;
224
                usart1_EnableTXD();
223
        usart1_EnableTXD();
225
                usart1_puts_pgm(message);                              
224
        usart1_puts_pgm(message);
226
                usart1_DisableTXD();
225
        usart1_DisableTXD();
227
                static uint8_t wait = 0;
226
        static uint8_t wait = 0;
228
                wait = 0;
227
        wait = 0;
229
                while (rxd_buffer_locked == 0 && wait < 150) {
228
        while (rxd_buffer_locked == 0 && wait < 150) {
230
                        wait++;
229
            wait++;
231
                        _delay_ms(10);
230
            _delay_ms(10);
232
                }                      
231
        }
233
        }              
232
    }
234
        Decode64();
233
    Decode64();
235
}
234
}
236
 
235
 
237
/**
236
/**
238
 * Request UART Redirect from NC to itself
237
 * Request UART Redirect from NC to itself
239
 */
238
 */
240
void usart1_request_nc_uart(void) {
239
void usart1_request_nc_uart(void) {
241
        usart1_EnableTXD();
240
    usart1_EnableTXD();
242
        usart1_putc(0x1B);
241
    usart1_putc(0x1B);
243
        usart1_putc(0x1B);
242
    usart1_putc(0x1B);
244
        usart1_putc(0x55);
243
    usart1_putc(0x55);
245
        usart1_putc(0xAA);
244
    usart1_putc(0xAA);
246
        usart1_putc(0x00);
245
    usart1_putc(0x00);
247
        usart1_DisableTXD();
246
    usart1_DisableTXD();
248
}
247
}
249
 
248
 
Line 250... Line 249...
250
 
249
 
251
/**
250
/**
252
 * request Data through USART in special MK format by adding checksum and
251
 * request Data through USART in special MK format by adding checksum and
253
 * encode data in modified Base64
252
 * encode data in modified Base64