hsk-libs-dev
270
High Speed Karlsruhe XC878 library collection
|
HSK ICM7228 8-Digit LED Display Decoder Driver generator. More...
#include <string.h>
Go to the source code of this file.
Macros | |
#define | ICM7228_FACTORY(prefix, regData, regMode, bitMode, regWrite, bitWrite) |
Generate an ICM7228 driver instance. 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... | |
HSK ICM7228 8-Digit LED Display Decoder Driver generator.
This file is a code generating facility, that offers preprocessor macros that produce code for the Intersil ICM7228 display decoder.
Generating code in this fashion avoids the hard coding of I/O registers and bits and even allows the use of multiple ICM7228 ICs.
#define ICM7228_FACTORY | ( | prefix, | |
regData, | |||
regMode, | |||
bitMode, | |||
regWrite, | |||
bitWrite | |||
) |
Generate an ICM7228 driver instance.
This creates functions to use a connect ICM7228 IC.
prefix | A prefix for the names of generated functions |
regData | The register that is connected to the data input |
regMode | The register that is connected to the mode pin |
bitMode | The bit of the regMode register that is connected to the mode pin |
regWrite | The register that is connected to the write pin |
bitWrite | The bit of the regWrite register that is connected to the write pin |
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 |