Convert font of t6963 driver to 8 byte bitmap.

This commit is contained in:
mmdolze
2011-02-27 12:23:47 +00:00
parent 374281e215
commit d4615059ce
4 changed files with 2143 additions and 2334 deletions
+1
View File
@@ -25,6 +25,7 @@ v.0.5dev (ongoing development)
* Convert set_char of drivers bayrad, lb216, lcterm, mtc_s16209x, wirz-sli * Convert set_char of drivers bayrad, lb216, lcterm, mtc_s16209x, wirz-sli
* CFontzPacket: Fix not using select() even if its available * CFontzPacket: Fix not using select() even if its available
* CFontzPacket: Use cellwidth = 5 on CFA-631 and CFA-635 too * CFontzPacket: Use cellwidth = 5 on CFA-631 and CFA-635 too
* t6963: Convert font to 8 byte bitmap
v0.5.4 v0.5.4
* Update driver includes and LDFLAGS (fixed glk and bayrad binding error) * Update driver includes and LDFLAGS (fixed glk and bayrad binding error)
+23 -23
View File
@@ -186,7 +186,7 @@ t6963_init(Driver * drvthis)
t6963_low_command_word(drvthis, SET_OFFSET_REGISTER, CHARGEN_BASE >> 11); t6963_low_command_word(drvthis, SET_OFFSET_REGISTER, CHARGEN_BASE >> 11);
/* Load font data */ /* Load font data */
t6963_set_nchar(drvthis, 0, fontdata_6x8, 256); t6963_set_nchar(drvthis, 0, 256);
/* Clear display */ /* Clear display */
t6963_clear(drvthis); t6963_clear(drvthis);
@@ -371,46 +371,46 @@ t6963_chr(Driver * drvthis, int x, int y, char c)
} }
/** /**
* Changes the font data of character n. * Load the custom font into LCD. Font data may be modified by the \c set_char
* function on the fly.
*
* \param drvthis Pointer to driver structure. * \param drvthis Pointer to driver structure.
* \param n Index of character in CGRAM to update. * \param n Index of starting character in CGRAM
* \param dat Data (must consist of num*cellwidth*cellheight bytes). * \param num Number of characters to update
* \param num Number of characters stored in data.
*/ */
static void static void
t6963_set_nchar(Driver * drvthis, int n, unsigned char *dat, int num) t6963_set_nchar(Driver *drvthis, int n, int num)
{ {
PrivateData *p = drvthis->private_data; PrivateData *p = drvthis->private_data;
int row, col; int chr, row;
char letter; char letter;
unsigned char mask = (1 << p->cellwidth) - 1;
debug(RPT_DEBUG, "Setting char %d", n); debug(RPT_DEBUG, "Loading font");
if ((!dat) || (n + num > 256)) t6963_low_command_word(drvthis, SET_ADDRESS_POINTER, CHARGEN_BASE + n * p->cellheight);
return;
t6963_low_command_word(drvthis, SET_ADDRESS_POINTER, CHARGEN_BASE + n * 8);
t6963_low_command(drvthis, AUTO_WRITE); t6963_low_command(drvthis, AUTO_WRITE);
for (row = 0; row < p->cellheight * num; row++) { for (chr = 0; chr < num; chr++) {
letter = 0; for (row = 0; row < p->cellheight; row++) {
/* Accumulate data for one pixel row */ letter = fontdata_6x8[chr][row] & mask;
for (col = 0; col < p->cellwidth; col++) { t6963_low_auto_write(drvthis, letter);
letter <<= 1;
letter |= (dat[(row * p->cellwidth) + col] > 0);
} }
t6963_low_auto_write(drvthis, letter);
} }
t6963_low_command(drvthis, AUTO_RESET); t6963_low_command(drvthis, AUTO_RESET);
} }
/** /**
* API: Define a custom character and write it to the LCD. * API: Define a custom character and write it into the font data, possibly
* overwriting an existing character.
*/ */
MODULE_EXPORT void MODULE_EXPORT void
t6963_set_char(Driver * drvthis, int n, char *dat) t6963_set_char(Driver * drvthis, int n, unsigned char *dat)
{ {
t6963_set_nchar(drvthis, n, (unsigned char *)dat, 1); if (!dat || n < 0 || n > 255)
return;
memcpy(fontdata_6x8[n], dat, 8);
t6963_set_nchar(drvthis, n, 1);
} }
/** /**
+2 -2
View File
@@ -97,11 +97,11 @@ MODULE_EXPORT void t6963_vbar (Driver *drvthis, int x, int y, int len, int promi
MODULE_EXPORT void t6963_hbar (Driver *drvthis, int x, int y, int len, int promille, int options); MODULE_EXPORT void t6963_hbar (Driver *drvthis, int x, int y, int len, int promille, int options);
MODULE_EXPORT void t6963_num (Driver *drvthis, int x, int num); MODULE_EXPORT void t6963_num (Driver *drvthis, int x, int num);
MODULE_EXPORT int t6963_icon (Driver *drvthis, int x, int y, int icon); MODULE_EXPORT int t6963_icon (Driver *drvthis, int x, int y, int icon);
MODULE_EXPORT void t6963_set_char (Driver *drvthis, int n, char *dat); MODULE_EXPORT void t6963_set_char (Driver *drvthis, int n, unsigned char *dat);
/* Internal functions */ /* Internal functions */
static void t6963_graphic_clear(Driver *drvthis); static void t6963_graphic_clear(Driver *drvthis);
static void t6963_set_nchar(Driver *drvthis, int n, unsigned char *dat, int num); static void t6963_set_nchar(Driver *drvthis, int n, int num);
static inline int t6963_low_dsp_ready(Driver *drvthis, u8 sta); static inline int t6963_low_dsp_ready(Driver *drvthis, u8 sta);
static void t6963_low_data(Driver *drvthis, u8 byte); static void t6963_low_data(Driver *drvthis, u8 byte);
static void t6963_low_auto_write(Driver *drvthis, u8 byte); static void t6963_low_auto_write(Driver *drvthis, u8 byte);
+2117 -2309
View File
File diff suppressed because it is too large Load Diff