Revision 6ca98a3f toolbox/main.c

View differences:

toolbox/main.c
18 18
};
19 19

  
20 20
static enum toolstate_t toolstate = TS_INIT;
21
static char coils;
22
static char current_user[RFID_SERNO_SIZE];
21
static uint8_t coils;
22
static uint8_t current_user[RFID_SERNO_SIZE];
23 23

  
24 24
static inline void set_coil(char coil, char bit) {
25
  coils |= (bit << coil);
25
  coils = (coils & ~(1 << coil)) | (bit << coil);
26 26
}
27 27
static inline char get_coil(char coil) {
28 28
  return (coils >> coil) & 1;
......
170 170
  switch (addr) {
171 171

  
172 172
    case MB_INP_SERNOL:
173
      // TODO check that these (and the ones in SERNOH) are in the right order
174 173
      *reg_buf++ = current_user[0];
175 174
      *reg_buf++ = current_user[1];
176 175
      n_regs--;
......
224 223
  rfid_start_read();
225 224
  while (1) {
226 225
    if (rfid_poll()) {
226
      rfid_get_serno(current_user);
227 227
      rfid_start_read();
228 228
    }
229
    rfid_get_serno(current_user);
230 229
    //tool_main();
231 230
    eMBPoll();
232 231
    _delay_ms(50);

Also available in: Unified diff