/* $Id: lookup.c,v 1.1 2004/03/17 04:45:54 jmuelmen Exp $ */ #include <8051.h> #include "ezusb_reg.h" #include "firm.h" #include "surf_mem.h" byte rev_lookup (signed int volt, byte chn) { int i; byte _volt; if (volt - 0x0960 < 0) { _volt = 0; } else _volt = ((volt - 0x0960) >> 4) & 0xff; for (i = 0; i < 0x0100; ++i) if (_vtable[((unsigned int)chn << 8) + i] < _volt) return i; return 0xff; }