URL
https://opencores.org/ocsvn/or1k/or1k/trunk
Subversion Repositories or1k
[/] [or1k/] [tags/] [first/] [mp3/] [sw/] [mad-xess/] [led.c] - Rev 769
Go to most recent revision | Compare with Previous | Blame | View Log
#ifdef HAVE_CONFIG_H # include "config.h" #else # define EMBED #endif #ifdef EMBED /* LED numbers "0123456789AbCdEF " */ char numbers[17] = { 0x77, 0x12, 0x5D, 0x5B, 0x3A, 0x6F, 0x72, 0x7F, 0x7B, 0x2F, 0x65, 0x1F, 0x6D, 0x6C, 0x00 }; /* Converts number 0..99 to hex. E.g. 17 to 0x17. */ unsigned char dec_to_hex(char x) { return (x / 10) * 16 + x % 10; } #define BARGRAPH_BITS 10 /* Returns bitmask for bargraph, based on current progress. */ unsigned short progress(int done, int total) { int x = (BARGRAPH_BITS * done + BARGRAPH_BITS / 2) / total; if (x < 0) x = 0; if (x > BARGRAPH_BITS) x = BARGRAPH_BITS; return (1 << x) - 1; } #endif
Go to most recent revision | Compare with Previous | Blame | View Log