hsk-libs-dev
270
High Speed Karlsruhe XC878 library collection
|
HSK ICM7228 8-Digit LED Display Decoder Driver implementation. More...
Macros | |
#define | ILLUMINATE_OFFSET 16 |
The offset for illuminating a number of segments. More... | |
Functions | |
void | hsk_icm7228_writeString (ubyte *const buffer, char const *str, ubyte pos, ubyte len) |
Convert an ASCII string to 7 segment encoding and store it in an xdata buffer. More... | |
void | hsk_icm7228_writeDec (ubyte *const buffer, uword value, char power, ubyte const pos, ubyte len) |
Write a 7 segment encoded, right aligned decimal number into an xdata buffer. More... | |
void | hsk_icm7228_writeHex (ubyte *const buffer, uword value, char power, ubyte const pos, ubyte len) |
Write a 7 segment encoded, right aligned hexadecimal number into an xdata buffer. More... | |
void | hsk_icm7228_illuminate (ubyte *const buffer, ubyte segments, ubyte pos, ubyte len) |
Illumante the given number of segments. More... | |
Variables | |
static const ubyte | codepage [] |
This is a codepage to translate 7bit ASCII characters into corresponding 7 segment display patterns. More... | |
HSK ICM7228 8-Digit LED Display Decoder Driver implementation.
This file implements the static functions of the ICM7228 display decoder driver.
#define ILLUMINATE_OFFSET 16 |
The offset for illuminating a number of segments.
void hsk_icm7228_illuminate | ( | ubyte *const | buffer, |
ubyte | segments, | ||
ubyte | pos, | ||
ubyte | len | ||
) |
Illumante the given number of segments.
buffer | The target buffer for the encoded string |
segments | The number of segments to illuminate |
pos | The target position in the buffer |
len | The number of digits available to encode the number |
void hsk_icm7228_writeDec | ( | ubyte *const | buffer, |
uword | value, | ||
char | power, | ||
ubyte const | pos, | ||
ubyte | len | ||
) |
Write a 7 segment encoded, right aligned decimal number into an xdata buffer.
The power parameter controlls the placing of the '.' by 10 to the power. E.g. value = 12, power = -1 and len = 3 would result in the encoding of " 1.2". If power = 0, no dot is drawn. If the power is positive (typically 1), the resulting string would be filled with '0' characters. I.e. the previous example with power = 1 would result in an encoding of "012".
buffer | The target buffer for the encoded string |
value | The number to encode |
power | The 10 base power of the number to encode |
pos | The target position in the buffer |
len | The number of digits available to encode the number |
void hsk_icm7228_writeHex | ( | ubyte *const | buffer, |
uword | value, | ||
char | power, | ||
ubyte const | pos, | ||
ubyte | len | ||
) |
Write a 7 segment encoded, right aligned hexadecimal number into an xdata buffer.
The power parameter controlls the placing of the '.' by 16 to the power. E.g. value = 0x1A, power = -1 and len = 3 would result in the encoding of " 1.A". If power = 0, no dot is drawn. If the power is positive (typically 1), the resulting string would be filled with '0' characters. I.e. the previous example with power = 1 would result in an encoding of "01A".
buffer | The target buffer for the encoded string |
value | The number to encode |
power | The 16 base power of the number to encode |
pos | The target position in the buffer |
len | The number of digits available to encode the number |
void hsk_icm7228_writeString | ( | ubyte *const | buffer, |
char const * | str, | ||
ubyte | pos, | ||
ubyte | len | ||
) |
Convert an ASCII string to 7 segment encoding and store it in an xdata buffer.
This function is usually invoked through the <prefix>_writeString() function created by ICM7228_FACTORY.
The function will write into the buffer until it has been filled with len characters or it encounters a 0 character reading from str. If the character '.' is encountered it is merged with the previous character, unless that character is a '.' itself. Thus a single dot does not use additional buffer space. The 7 character string "foo ..." would result in 6 encoded bytes. Thus the proper len value for that string would be 6.
buffer | The target buffer for the encoded string |
str | The buffer to read the ASCII string from |
pos | The position in the buffer to write the encoded string to |
len | The target length of the encoded string |
|
static |
This is a codepage to translate 7bit ASCII characters into corresponding 7 segment display patterns.
The ASCII character can be used to receive the desired 7 segment code. E.g. codepage['A'] retrieves the letter 'A' from the table.
Some letters like 'X' are badly recognisable, others cannot be well represented at all. E.g. the letters 'M' and 'W' are identical to the letters 'N' and 'U'.
Capitals and small characters are identical. Characters without proper encoding are filled with 0x00, which leaves only the '.' of a 7 segment display active.
The 6 characters beyond 0-9 return "ABCDEF", which permits for easier display of HEX digits.
The first 16 characters from index 0 return the characters "0123456789ABCDEF" as well.