14 #ifndef _HSK_ICM7228_H_ 15 #define _HSK_ICM7228_H_ 47 #define ICM7228_FACTORY(prefix, regData, regMode, bitMode, regWrite, bitWrite) \ 54 ubyte xdata prefix##_buffer[8]; \ 61 void prefix##_init(void) { \ 62 memset(prefix##_buffer, 0, sizeof(prefix##_buffer)); \ 64 regMode##_DIR |= 1 << bitMode; \ 65 regWrite##_DIR |= 1 << bitWrite; \ 66 regData##_DIR = 0xff; \ 74 void prefix##_refresh(void) { \ 78 regMode##_DATA |= 1 << bitMode; \ 81 regData##_DATA = 0xB0; \ 82 regWrite##_DATA &= ~(1 << bitWrite); \ 83 regWrite##_DATA |= 1 << bitWrite; \ 86 regMode##_DATA &= ~(1 << bitMode); \ 88 for (i = 0; i < 8; i++) { \ 89 regData##_DATA = prefix##_buffer[i]; \ 90 regWrite##_DATA &= ~(1 << bitWrite); \ 91 regWrite##_DATA |= 1 << bitWrite; \ 107 inline void prefix##_writeString(char const * const str, \ 108 ubyte const pos, ubyte const len) { \ 109 hsk_icm7228_writeString(prefix##_buffer, str, pos, len); \ 126 inline void prefix##_writeDec(uword const value, char const power, \ 127 ubyte const pos, ubyte const len) {\ 128 hsk_icm7228_writeDec(prefix##_buffer, value, power, pos, len); \ 145 inline void prefix##_writeHex(uword const value, char const power, \ 146 ubyte const pos, ubyte const len) {\ 147 hsk_icm7228_writeHex(prefix##_buffer, value, power, pos, len); \ 161 inline void prefix##_illuminate(ubyte const segments, ubyte const pos, \ 163 hsk_icm7228_illuminate(prefix##_buffer, segments, pos, len); \ 191 char const * str, ubyte
pos, ubyte len);
216 char power, ubyte
const pos, ubyte len);
241 char power, ubyte
const pos, ubyte len);
256 ubyte segments, ubyte
pos, ubyte len);
uword buffer[8]
A ring buffer of PWC values.
Definition: hsk_pwc.c:56
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.
Definition: hsk_icm7228.c:60
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.
Definition: hsk_icm7228.c:74
ubyte pos
The current ring position.
Definition: hsk_pwc.c:71
void hsk_icm7228_illuminate(ubyte *const buffer, ubyte segments, ubyte pos, ubyte len)
Illumante the given number of segments.
Definition: hsk_icm7228.c:100
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. ...
Definition: hsk_icm7228.c:87