Subversion Repositories Projects

Rev

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

Rev 738 Rev 761
Line 87... Line 87...
87
    while (*s) {
87
    while (*s) {
88
        usart1_putc(*s);
88
        usart1_putc(*s);
89
        s++;
89
        s++;
90
    }
90
    }
91
}*/
91
}*/
92
 
-
 
93
 
92
 
94
/**
93
/**
95
 * send a PGM<string> throught usart1
94
 * send a PGM<string> throught usart1
96
 */
95
 */
97
void usart1_puts_pgm(const char* string) {
96
void usart1_puts_pgm(const char* string) {
98
        while (pgm_read_byte(string) != 0x00)
97
    while (pgm_read_byte(string) != 0x00)
99
                usart1_putc(pgm_read_byte(string++));
98
        usart1_putc(pgm_read_byte(string++));
100
}
99
}
Line 101... Line 100...
101
 
100
 
102
/**
101
/**
103
 * transmit interrupt handler
102
 * transmit interrupt handler
104
 * unused
103
 * unused
Line 121... Line 120...
121
    static uint8_t c1 = 0;
120
    static uint8_t c1 = 0;
122
    static uint8_t c2 = 0;
121
    static uint8_t c2 = 0;
123
    static uint8_t usart_rx_ok = 0;
122
    static uint8_t usart_rx_ok = 0;
124
    uint8_t crc1, crc2;
123
    uint8_t crc1, crc2;
125
    // the rxd buffer is unlocked
124
    // the rxd buffer is unlocked
126
    if (usart_rx_ok == 0) {
125
    if (usart_rx_ok == 0) {
127
                // if ((c2 == '#') && (c1 == 'b' || c1 == 'c') && (c == 'D' || c == 'V' || c == 'O')) {
126
        // if ((c2 == '#') && (c1 == 'b' || c1 == 'c') && (c == 'D' || c == 'V' || c == 'O')) {
-
 
127
 
128
        if ((c2 == '#') && (c1 == 'b' || c1 == 'c') &&
128
        if ((c2 == '#') && (c1 == 'b' || c1 == 'c') &&
129
                        #if FCONLY
129
#if FCONLY
130
                                (c == 'V' || c == 'D')) { // version and debug
130
            (c == 'V' || c == 'D')) { // version and debug
131
                        #else
131
#else
132
                                (c == 'V' || c == 'O')) { // version and OSD
132
            (c == 'V' || c == 'O')) { // version and OSD
133
                        #endif
133
#endif
134
            usart_rx_ok = 1;
134
                usart_rx_ok = 1;
135
            rxd_buffer[ptr_rxd_buffer++] = c2;
135
                rxd_buffer[ptr_rxd_buffer++] = c2;
136
            crc = c2;
136
                crc = c2;
137
            rxd_buffer[ptr_rxd_buffer++] = c1;
137
                rxd_buffer[ptr_rxd_buffer++] = c1;
138
            crc += c1;
138
                crc += c1;
139
            rxd_buffer[ptr_rxd_buffer++] = c;
139
                rxd_buffer[ptr_rxd_buffer++] = c;
140
            crc += c;
140
                crc += c;
141
            c2 = 0;
141
                c2 = 0;
142
            c1 = 0;
142
                c1 = 0;
143
            LED1_ON
143
                LED1_ON
144
            LED2_OFF
144
                LED2_OFF
145
        } else {
145
            } else {
146
            c2 = c1;
146
            c2 = c1;
147
            c1 = c;
147
            c1 = c;
148
        }
148
        }
149
    } else if (ptr_rxd_buffer < RXD_BUFFER_LEN) { // collect incomming bytes
149
    } else if (ptr_rxd_buffer < RXD_BUFFER_LEN) { // collect incomming bytes
150
        if (c != '\r') { // no termination character
150
        if (c != '\r') { // no termination character