Routines to talk to Sure electronics seven segment displays. More...
Go to the source code of this file.
Functions | |
void | sure_7seg_setup () |
Setup ports and pins to communicate to Sure display. | |
void | sure_7seg_write_str (char *data) |
Display ASCII string to 7 segment displays. |
void sure_7seg_setup | ( | ) |
Set up ports and pins as appropriate to communicate via SPI to Sure 7 segment displays
00043 { 00044 spi_setup(); 00045 }
void sure_7seg_write_str | ( | char * | data | ) |
Converts ASCII to the appropriate magic characters to display on a Sure 7 segment display. Only numbers 0-9 and space are implented for now.
To create your own characters, add together: 0x40 -------- | | 0x02 | | 0x20 | 0x01 | |------| | | 0x04 | | 0x10 | | -------- 0x08
00064 { 00065 00066 uns8 count, digit; 00067 char converted[5]; 00068 00069 count = 0; 00070 do { 00071 digit = data[count]; 00072 converted[count] = sure_7seg_convert(digit); 00073 count++; 00074 } while (count < 4); 00075 spi_write_sure(converted[3]); 00076 spi_write_sure(converted[2]); 00077 spi_write_sure(converted[1]); 00078 spi_write_sure(converted[0]); 00079 00080 clear_pin(spi_clk_port, spi_clk_pin); // set to low 00081 set_pin(spi_clk_port, spi_clk_pin); // set to high 00082 00083 }