Revision 1942
Updated barcode code to use the new line sensor, and to work better.
analog.c | ||
---|---|---|
295 | 295 |
|
296 | 296 |
|
297 | 297 |
/** Returns the 10 bit value from the line sensors **/ |
298 |
unsigned int read_line(int which) { |
|
298 |
unsigned int read_line(int which) |
|
299 |
{ |
|
299 | 300 |
int adc_h; |
300 | 301 |
int adc_l; |
301 | 302 |
|
... | ... | |
304 | 305 |
|
305 | 306 |
ADMUX = ADMUX_OPT + AN1; |
306 | 307 |
|
307 |
which = ((which&1)<<2) + ((which&2)) + ((which&4)>>2);
|
|
308 |
which = ((which&1)<<2) + ((which&2)) + ((which&4)>>2); |
|
308 | 309 |
|
309 | 310 |
// mask so only proper bits are possible. |
310 | 311 |
PORTD = (PORTD & 0x1F) | ((which & 0x07) << 5); |
Also available in: Unified diff