Revision 272

trunk/cardbox/cardreader.h (revision 272)
7 7
#include "main.h"
8 8
#include "rs485_int.h"
9 9

  
10
#define CR_ERR_BAD_PARITY   -1
11
#define CR_ERR_NO_START     -2
12
#define CR_ERR_NO_STOP      -3
13

  
10 14
typedef enum {
11 15
    CR_NONE,
12 16
    CR_GOOD,
13 17
    CR_BAD
14 18
} cr_flag_t;
15 19

  
16
typedef enum {
17
    CR_IDLE,
18
    CR_SS,
19
    CR_DATA
20
} cr_state_t;
21

  
22 20
extern volatile cr_flag_t cr_flag;
23 21
extern volatile uint8_t read_card;
24 22
extern volatile uint8_t cr_buf[512];
trunk/cardbox/cardreader.c (revision 272)
100 100
        }
101 101

  
102 102
        i--;
103

  
104
        if (i == 0) {
105
            return CR_ERR_NO_START;
106
        }
103 107
    }
104 108

  
105 109
    byte = 0;
......
111 115
        if (byte_idx == CR_MAX_IDX) {
112 116

  
113 117
            if (!(cr_buf[i]) != (parity % 2)) {
114
                return -1;
118
                return CR_ERR_BAD_PARITY;
115 119
            }
116 120

  
117 121
            rs485_send_byte(cr_dict[byte]);
......
136 140
        i--;
137 141
    }
138 142

  
139
    return -1;
143
    return CR_ERR_NO_STOP;
140 144
}

Also available in: Unified diff