Revision 280
| trunk/cardbox/cardbox.c (revision 280) | ||
|---|---|---|
| 179 | 179 |
if (cr_flag != CR_NONE) {
|
| 180 | 180 |
read_card = 0; |
| 181 | 181 |
if ((cret = parse_card(cbuf, &clen)) < 0) {
|
| 182 |
switch (cret) {
|
|
| 183 |
case CR_ERR_BAD_PARITY: |
|
| 184 |
toggle_led(LED_GREEN, ON); |
|
| 185 |
break; |
|
| 186 |
case CR_ERR_NO_START: |
|
| 187 |
toggle_led(LED_YELLOW, ON); |
|
| 188 |
break; |
|
| 189 |
case CR_ERR_NO_STOP: |
|
| 190 |
toggle_led(LED_RED, ON); |
|
| 191 |
break; |
|
| 182 |
for(c=0;c < 4;c++) {
|
|
| 183 |
toggle_led(LED_RED,ON); |
|
| 184 |
_delay_ms(250); |
|
| 185 |
toggle_led(LED_RED,OFF); |
|
| 186 |
_delay_ms(250); |
|
| 192 | 187 |
} |
| 193 |
rs485_send_byte('F');
|
|
| 188 |
|
|
| 194 | 189 |
} else {
|
| 195 | 190 |
for (c = 0; c < clen; c++) {
|
| 196 | 191 |
rs485_send_byte(cbuf[c]); |
| trunk/cardbox/cardbox.h (revision 280) | ||
|---|---|---|
| 1 |
#ifndef __CARDBOX_H__ |
|
| 2 |
#define __CARDBOX_H__ |
|
| 3 |
|
|
| 4 |
#include <util/delay.h> |
|
| 5 |
#include "rs485_int.h" |
|
| 6 |
#include <avr/interrupt.h> |
|
| 7 |
#include <avr/io.h> |
|
| 8 |
|
|
| 9 |
#include <tooltron.h> |
|
| 10 |
#include "timer.h" |
|
| 11 |
#include "packet.h" |
|
| 12 |
#include "cardreader.h" |
|
| 13 |
|
|
| 14 |
/***** LED definitions *****/ |
|
| 15 |
#define LEDPORT PORTC |
|
| 16 |
#define LEDDDR DDRC |
|
| 17 |
#define LED_RED (_BV(PC5)) |
|
| 18 |
#define LED_YELLOW (_BV(PC4)) |
|
| 19 |
#define LED_GREEN (_BV(PC3)) |
|
| 20 |
|
|
| 21 |
void toggle_led(uint8_t which, uint8_t state); |
|
| 22 |
|
|
| 23 |
#endif |
|
| trunk/cardbox/Makefile (revision 280) | ||
|---|---|---|
| 56 | 56 |
|
| 57 | 57 |
|
| 58 | 58 |
# Target file name (without extension). |
| 59 |
TARGET = main |
|
| 59 |
TARGET = cardbox |
|
| 60 | 60 |
|
| 61 | 61 |
|
| 62 | 62 |
# List C source files here. (C dependencies are automatically generated.) |
| 63 |
SRC = $(wildcard *.c) timer.c |
|
| 63 |
SRC = $(wildcard *.c) |
|
| 64 | 64 |
#$(TARGET).c |
| 65 | 65 |
|
| 66 | 66 |
|
Also available in: Unified diff