Functions | |
uns8 | hc4led_convert (uns8 digit) |
void | hc4led_setup () |
void | hc4led_write_str (char *data) |
uns8 hc4led_convert | ( | uns8 | digit | ) |
00043 { 00044 switch (digit) { 00045 case ' ': return 0; 00046 case '0': return 126; 00047 case '1': return 24; 00048 case '2': return 109; 00049 case '3': return 61; 00050 case '4': return 27; 00051 case '5': return 55; 00052 case '6': return 115; 00053 case '7': return 28; 00054 case '8': return 127; 00055 case '9': return 31+32; 00056 case '\'': return 15; 00057 } 00058 }
void hc4led_setup | ( | ) |
void hc4led_write_str | ( | char * | data | ) |
00060 { 00061 00062 uns8 count, digit; 00063 char converted[5]; 00064 00065 count = 4; 00066 do { 00067 digit = data[count-1]; 00068 converted[count-1] = hc4led_convert(digit); 00069 count--; 00070 } while (count > 0); 00071 count = 4; 00072 do { 00073 digit = converted[count-1]; 00074 spi_write(digit); 00075 count--; 00076 } while (count > 0); 00077 00078 }