Project

General

Profile

Statistics
| Revision:

root / trunk / cardbox / cardreader.h @ 279

History | View | Annotate | Download (556 Bytes)

1
#ifndef __CARDREADER_H__
2
#define __CARDREADER_H__
3

    
4
#include <avr/io.h>
5
#include <avr/interrupt.h>
6
#include <stdint.h>
7
#include "cardbox.h"
8

    
9
// Error values
10
#define CR_ERR_BAD_PARITY   -1
11
#define CR_ERR_NO_START     -2
12
#define CR_ERR_NO_STOP      -3
13

    
14
// How big the buffer is to read in bits of the card to
15
#define CR_BUF_SIZE 800
16

    
17
typedef enum {
18
    CR_NONE,
19
    CR_GOOD,
20
    CR_BAD
21
} cr_flag_t;
22

    
23
extern volatile cr_flag_t cr_flag;
24
extern volatile uint8_t read_card;
25

    
26
void card_reader_setup(void);
27
int8_t  parse_card(uint8_t *buf, uint8_t *buflen);
28
#endif