/** * Set up horizontal bars. * \param drvthis Pointer to driver structure. */ static void lcterm_init_hbar (Driver *drvthis) { PrivateData *p = (PrivateData *) drvthis->private_data; int i; static unsigned char hbar_char[5][8] = { {0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10}, {0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18}, {0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C}, {0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E}, {0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F} }; if (p->last_ccmode == hbar) /* Work already done */ return; if (p->ccmode != standard) { /* Not supported (yet) */ report(RPT_WARNING, "%s: init_hbar: cannot combine two modes using user-defined characters", drvthis->name); return; } p->ccmode = p->last_ccmode = hbar; for (i = 0; i < 5; i++) lcterm_set_char(drvthis, i + 1, hbar_char[i]); }
/** * Place an icon on the screen. * \param drvthis Pointer to driver structure. * \param x Horizontal character position (column). * \param y Vertical character position (row). * \param icon synbolic value representing the icon. * \retval 0 Icon has been successfully defined/written. * \retval <0 Server core shall define/write the icon. */ MODULE_EXPORT int lcterm_icon (Driver *drvthis, int x, int y, int icon) { static unsigned char heart_open[] = { b__XXXXX, b__X_X_X, b_______, b_______, b_______, b__X___X, b__XX_XX, b__XXXXX }; static unsigned char heart_filled[] = { b__XXXXX, b__X_X_X, b___X_X_, b___XXX_, b___XXX_, b__X_X_X, b__XX_XX, b__XXXXX }; switch (icon) { case ICON_BLOCK_FILLED: lcterm_chr(drvthis, x, y, 255); break; case ICON_HEART_FILLED: lcterm_set_char(drvthis, 0, heart_filled); lcterm_chr(drvthis, x, y, 0); break; case ICON_HEART_OPEN: lcterm_set_char(drvthis, 0, heart_open); lcterm_chr(drvthis, x, y, 0); break; default: return -1; } return 0; }
///////////////////////////////////////////////////////////////// // Sets up for big numbers. // static void lcterm_init_num (Driver *drvthis) { PrivateData *p = (Pr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->last_ccmode == CCMODE_BIGNUM) { /* Work already done */ return; } if (p->ccmode != CCMODE_STANDARD) { /* Not supported (yet) */ report(RPT_WARNING, "%s: init_num: cannot combine two modes using user-defined characters", drvthis->name); return; } p->ccmode = p->last_ccmode = CCMODE_BIGNUM; for (i = 0; i < 8; i++) lcterm_set_char(drvthis, i, bignum_ccs[i]); }
///////////////////////////////////////////////////////////////// // Inits horizontal bars... // static void lcterm_init_hbar (Driver *drvthis) { PrivateData *p = (PrivateData *) drvthis->private_data; static char hbar_1[] = { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, }; static char hbar_2[] = { 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, }; static char hbar_3[] = { 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, }; static char hbar_4[] = { 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, }; static char hbar_5[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; if (p->last_ccmode == CCMODE_HBAR) /* Work already done */ return; if (p->ccmode != CCMODE_STANDARD) { /* Not supported (yet) */ report(RPT_WARNING, "%s: init_hbar: cannot combine two modes using user-defined characters", drvthis->name); return; } p->ccmode = p->last_ccmode = CCMODE_HBAR; lcterm_set_char(drvthis, 1, hbar_1); lcterm_set_char(drvthis, 2, hbar_2); lcterm_set_char(drvthis, 3, hbar_3); lcterm_set_char(drvthis, 4, hbar_4); lcterm_set_char(drvthis, 5, hbar_5); }