Project

General

Profile

Revision 271

Added by Kevin Woo almost 14 years ago

Basic return values for parse_card

View differences:

cardreader.c
77 77
        cr_buf_idx++;
78 78
    }
79 79
}
80
void parse_card(void) {
80

  
81
int8_t parse_card(void) {
81 82
    int32_t i = cr_buf_idx - 1;
82 83
    uint8_t start_sentinal = 0;
83 84
    uint8_t byte_idx = 0;
......
110 111
        if (byte_idx == CR_MAX_IDX) {
111 112

  
112 113
            if (!(cr_buf[i]) != (parity % 2)) {
113
                rs485_send_byte('F');
114
                return -1;
114 115
            }
115 116

  
116 117
            rs485_send_byte(cr_dict[byte]);
117 118

  
118 119
            // Stop at the stop sentinal
119 120
            if (cr_dict[byte] == CR_ES) {
120
                return;
121
                return 0;
121 122
            }
122 123

  
123 124
            byte_idx = 0;
......
134 135
        // Goto next bit in cr_buf
135 136
        i--;
136 137
    }
138

  
139
    return -1;
137 140
}

Also available in: Unified diff