Revision 279
Cardreader code cleanup
cardreader.c | ||
---|---|---|
142 | 142 |
} |
143 | 143 |
|
144 | 144 |
// Read data in on the downtick of the clock |
145 |
if ((!(PIND & CR_CLK))) { |
|
146 |
if (cr_buf_idx < CR_BUF_SIZE) { |
|
145 |
if ((!(PIND & CR_CLK)) && (cr_buf_idx < CR_BUF_SIZE)) { |
|
147 | 146 |
// Read data from card reader and flip since ours inverts |
148 | 147 |
cr_buf[cr_buf_idx] = !(PIND & CR_DATA); |
149 | 148 |
cr_buf_idx++; |
150 |
} else { |
|
151 |
toggle_led(LED_RED, ON); |
|
152 |
} |
|
153 | 149 |
} |
154 | 150 |
} |
Also available in: Unified diff