Convert comments according to style guide. Pass through indent but preserve

the 4 spaces indent.
This commit is contained in:
mmdolze
2011-01-06 15:20:52 +00:00
parent 96525e30b7
commit e36cafd6c9
+210 -182
View File
@@ -1,28 +1,34 @@
/** \file server/drivers/sed1520.c /** \file server/drivers/sed1520.c
* LCDd \c sed1520 driver for graphic displays based on the SED1520. * LCDd \c sed1520 driver for graphic displays based on the SED1520.
*
* This is a driver for 122x32 pixel graphic displays based on the SED1520
* controller connected to the parallel port. Check http://www.usblcd.de/lcdproc/
* for where to buy and how to build the hardware. This Controller has no
* built in character generator. Therefore all fonts and pixels are generated
* by this driver.
*
* \todo Convert to 0.5 style hbar / vbar API.
*/ */
////////////////////////////////////////////////////////////////////////// /*-
// This is a driver for 122x32 pixel graphic displays based on the // * (C) 2001 Robin Adams ( robin@adams-online.de )
// SED1520 Controller connected to the parallel port. Check // *
// http://www.usblcd.de/lcdproc/ for where to buy // * The HD44780 font in sed1520fm.c was shamelessly stolen from
// and how to build the hardware. This Controller has no built in // * Michael Reinelt / lcd4linux and is (C) 2000 by him.
// character generator. Therefore all fonts and pixels are generated // *
// by this driver. // * This file is released under the GNU General Public License. Refer to the
// // * COPYING file distributed with this package.
// This driver is based on drv_base.c and hd44780.c. // */
// The HD44780 font in sed1520fm.c was shamelessly stolen from //
// Michael Reinelt / lcd4linux and is (C) 2000 by him. // /*-
// The rest of fontmap.c and this driver is // * Driver history:
// // * Moved the delay timing code by Charles Steinkuehler to timing.h.
// Moved the delay timing code by Charles Steinkuehler to timing.h. // * Guillaume Filion <gfk@logidac.com>, December 2001
// Guillaume Filion <gfk@logidac.com>, December 2001 // */
// //
// (C) 2001 Robin Adams ( robin@adams-online.de ) // #ifdef HAVE_CONFIG_H
// // # include "config.h"
// This driver is released under the GPL. See file COPYING in this // #endif
// package for further details. //
//////////////////////////////////////////////////////////////////////////
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
@@ -32,16 +38,16 @@
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include <time.h> #include <time.h>
#include "lcd.h"
#include "sed1520.h"
#include "report.h"
#include "port.h" #include "port.h"
#include "timing.h" #include "timing.h"
#define uPause timing_uPause
#include "sed1520fm.h" #include "sed1520fm.h"
#ifdef HAVE_CONFIG_H #define uPause timing_uPause
# include "config.h" #define IODELAY 500
#endif
#ifndef DEFAULT_PORT #ifndef DEFAULT_PORT
# define DEFAULT_PORT 0x378 # define DEFAULT_PORT 0x378
@@ -56,16 +62,10 @@
#define WIDTH ((int) (PIXELWIDTH / CELLWIDTH)) /* 20 */ #define WIDTH ((int) (PIXELWIDTH / CELLWIDTH)) /* 20 */
#define HEIGHT ((int) (PIXELHEIGHT / CELLHEIGHT)) /* 4 */ #define HEIGHT ((int) (PIXELHEIGHT / CELLHEIGHT)) /* 4 */
#define A0 0x08 #define A0 0x08 /* nSEL */
#define CS2 0x04 #define CS2 0x04 /* INIT */
#define CS1 0x02 #define CS1 0x02 /* nLF */
#define WR 0x01 #define WR 0x01 /* nSTRB */
#define IODELAY 500
#include "lcd.h"
#include "sed1520.h"
#include "report.h"
/** private data for the \c sed1520 driver */ /** private data for the \c sed1520 driver */
typedef struct sed1520_private_data { typedef struct sed1520_private_data {
@@ -75,33 +75,49 @@ typedef struct sed1520_private_data {
} PrivateData; } PrivateData;
// Vars for the server core /* Vars for the server core */
MODULE_EXPORT char *api_version = API_VERSION; MODULE_EXPORT char *api_version = API_VERSION;
MODULE_EXPORT int stay_in_foreground = 0; MODULE_EXPORT int stay_in_foreground = 0;
MODULE_EXPORT int supports_multiple = 0; MODULE_EXPORT int supports_multiple = 0;
MODULE_EXPORT char *symbol_prefix = "sed1520_"; MODULE_EXPORT char *symbol_prefix = "sed1520_";
///////////////////////////////////////////////////////////////// /**
// writes command value to one or both sed1520 selected by chip * Writes command value to one or both sed1520 selected by chip.
// * \param port Output port base address
* \param value Command byte to write
* \param chip Bitmap of controllers to send value to
*/
void void
writecommand (unsigned int port, int value, int chip) writecommand(unsigned int port, int value, int chip)
{ {
port_out(port, value); port_out(port, value);
/*
* lower WR, rise A0 and CS1 and/or CS2. Take bit inversion of parallel
* port into account.
*/
port_out(port + 2, WR + CS1 - (chip & CS1) + (chip & CS2)); port_out(port + 2, WR + CS1 - (chip & CS1) + (chip & CS2));
/* rise WR */
port_out(port + 2, CS1 - (chip & CS1) + (chip & CS2)); port_out(port + 2, CS1 - (chip & CS1) + (chip & CS2));
uPause(IODELAY); uPause(IODELAY);
/* lower WR again */
port_out(port + 2, WR + CS1 - (chip & CS1) + (chip & CS2)); port_out(port + 2, WR + CS1 - (chip & CS1) + (chip & CS2));
uPause(IODELAY); uPause(IODELAY);
} }
///////////////////////////////////////////////////////////////// /**
// writes data value to one or both sed 1520 selected by chip * Writes data value to one or both sed 1520 selected by chip.
// * \param port Output port base address
* \param value Data byte to write
* \param chip Bitmap of controllers to send value to
*/
void void
writedata (unsigned int port, int value, int chip) writedata(unsigned int port, int value, int chip)
{ {
port_out(port, value); port_out(port, value);
/*
* lower WR and A0, rise CS1 and/or CS2. Take bit inversion of parallel
* port into account.
*/
port_out(port + 2, A0 + WR + CS1 - (chip & CS1) + (chip & CS2)); port_out(port + 2, A0 + WR + CS1 - (chip & CS1) + (chip & CS2));
port_out(port + 2, A0 + CS1 - (chip & CS1) + (chip & CS2)); port_out(port + 2, A0 + CS1 - (chip & CS1) + (chip & CS2));
uPause(IODELAY); uPause(IODELAY);
@@ -109,54 +125,65 @@ writedata (unsigned int port, int value, int chip)
uPause(IODELAY); uPause(IODELAY);
} }
///////////////////////////////////////////////////////////////// /**
// selects a page (=row) on both sed1520s * Selects a page (=row) on both sed1520s.
// * \param port Output port base address
* \param page Page (=row) number (0-3)
*/
void void
selectpage (unsigned int port, int page) selectpage(unsigned int port, int page)
{ {
writecommand(port, 0xB8 + (page & 0x03), CS1 + CS2); writecommand(port, 0xB8 + (page & 0x03), CS1 + CS2);
} }
///////////////////////////////////////////////////////////////// /**
// selects a column on the sed1520s specified by chip * Selects a column on the sed1520s specified by chip.
// * \param port Output port base address
* \param column Select column (segment) in controller (0-79)
* \param chip Bitmap of controllers to send value to
*/
void void
selectcolumn (unsigned int port, int column, int chip) selectcolumn(unsigned int port, int column, int chip)
{ {
writecommand(port, (column & 0x7F), chip); writecommand(port, (column & 0x7F), chip);
} }
///////////////////////////////////////////////////////////////// /**
// draws char z from fontmap to the framebuffer at position * Draws character z from fontmap to the framebuffer at position x,y.
// x,y. These are zero-based textmode positions. * The Fontmap is stored in rows while the framebuffer is stored in columns,
// The Fontmap is stored in rows while the framebuffer is stored * so we need a little conversion.
// in columns, so we need a little conversion. *
// * \param framebuf Pointer to framebuffer
* \param x Character column (zero-based)
* \param y Line (zero-based)
* \param z Character index in fontmap
*/
void void
drawchar2fb (unsigned char *framebuf, int x, int y, unsigned char z) drawchar2fb(unsigned char *framebuf, int x, int y, unsigned char z)
{ {
int i, j; int i, j;
if ((x < 0) || (x >= WIDTH) || (y < 0) || (y >= HEIGHT)) if ((x < 0) || (x >= WIDTH) || (y < 0) || (y >= HEIGHT))
return; return;
/* for each raster column */
for (i = CELLWIDTH; i > 0; i--) { for (i = CELLWIDTH; i > 0; i--) {
int k = 0; int k = 0;
/* gather the bits from the fontmap for each raster row */
for (j = 0; j < CELLHEIGHT; j++) for (j = 0; j < CELLHEIGHT; j++)
k |= ((fontmap[(int) z][j] >> (i-1)) & 0x01) << j; k |= ((fontmap[(int)z][j] >> (i - 1)) & 0x01) << j;
/* And store it in framebuffer pixel column */
framebuf[(y * PIXELWIDTH) + (x * CELLWIDTH) + (CELLWIDTH - i)] = k; framebuf[(y * PIXELWIDTH) + (x * CELLWIDTH) + (CELLWIDTH - i)] = k;
} }
} }
///////////////////////////////////////////////////////////////// /**
// This initialises the stuff. We support supplying port as * API: Initialize the driver.
// a command line argument. */
//
MODULE_EXPORT int MODULE_EXPORT int
sed1520_init (Driver *drvthis) sed1520_init(Driver * drvthis)
{ {
PrivateData *p; PrivateData *p;
@@ -167,53 +194,48 @@ sed1520_init (Driver *drvthis)
if (drvthis->store_private_ptr(drvthis, p)) if (drvthis->store_private_ptr(drvthis, p))
return -1; return -1;
/* Read config file */
/* What port to use */ /* What port to use */
p->port = drvthis->config_get_int(drvthis->name, "Port", 0, DEFAULT_PORT); p->port = drvthis->config_get_int(drvthis->name, "Port", 0, DEFAULT_PORT);
/* End of config file parsing */ /* Initialize timing */
if (timing_init() == -1) { if (timing_init() == -1) {
report(RPT_ERR, "%s: timing_init() failed (%s)", drvthis->name, strerror(errno)); report(RPT_ERR, "%s: timing_init() failed (%s)", drvthis->name, strerror(errno));
return -1; return -1;
} }
// Allocate our framebuffer /* Allocate our framebuffer */
p->framebuf = (unsigned char *) calloc(PIXELWIDTH * HEIGHT, sizeof(unsigned char)); p->framebuf = (unsigned char *) calloc(PIXELWIDTH * HEIGHT, sizeof(unsigned char));
if (p->framebuf == NULL) { if (p->framebuf == NULL) {
report(RPT_ERR, "%s: unable to allocate framebuffer", drvthis->name); report(RPT_ERR, "%s: unable to allocate framebuffer", drvthis->name);
// sed1520_close ();
return -1; return -1;
} }
// clear screen /* Clear screen */
memset(p->framebuf, '\0', PIXELWIDTH * HEIGHT); memset(p->framebuf, '\0', PIXELWIDTH * HEIGHT);
// Initialize the Port and the sed1520s /* Open port */
if (port_access(p->port) || port_access(p->port+2)) { if (port_access(p->port) || port_access(p->port + 2)) {
report(RPT_ERR, "%s: unable to access port 0x%03X", drvthis->name, p->port); report(RPT_ERR, "%s: unable to access port 0x%03X", drvthis->name, p->port);
return -1; return -1;
} }
port_out(p->port,0); /* Initialize display */
port_out(p->port +2, WR + CS2); port_out(p->port, 0);
writecommand(p->port, 0xE2, CS1 + CS2); port_out(p->port + 2, WR + CS2);
writecommand(p->port, 0xAF, CS1 + CS2); writecommand(p->port, 0xE2, CS1 + CS2); /* software reset */
writecommand(p->port, 0xC0, CS1 + CS2); writecommand(p->port, 0xAF, CS1 + CS2); /* display on */
writecommand(p->port, 0xC0, CS1 + CS2); /* display start address */
selectpage(p->port, 3); selectpage(p->port, 3);
report(RPT_DEBUG, "%s: init() done", drvthis->name); report(RPT_DEBUG, "%s: init() done", drvthis->name);
return 0; return 0;
} }
///////////////////////////////////////////////////////////////// /**
// Frees the frambuffer and exits the driver. * API: Frees the frambuffer and exits the driver.
// */
MODULE_EXPORT void MODULE_EXPORT void
sed1520_close (Driver *drvthis) sed1520_close(Driver * drvthis)
{ {
PrivateData *p = drvthis->private_data; PrivateData *p = drvthis->private_data;
@@ -226,103 +248,102 @@ sed1520_close (Driver *drvthis)
drvthis->store_private_ptr(drvthis, NULL); drvthis->store_private_ptr(drvthis, NULL);
} }
///////////////////////////////////////////////////////////////// /**
// Returns the display width * API: Returns the display width
// */
MODULE_EXPORT int MODULE_EXPORT int
sed1520_width (Driver *drvthis) sed1520_width(Driver * drvthis)
{ {
//PrivateData *p = drvthis->private_data;
return WIDTH; return WIDTH;
} }
///////////////////////////////////////////////////////////////// /**
// Returns the display height * API: Returns the display height
// */
MODULE_EXPORT int MODULE_EXPORT int
sed1520_height (Driver *drvthis) sed1520_height(Driver * drvthis)
{ {
//PrivateData *p = drvthis->private_data;
return HEIGHT; return HEIGHT;
} }
///////////////////////////////////////////////////////////////// /**
// Returns the display width * API: Return the width of a character in pixels.
// */
MODULE_EXPORT int MODULE_EXPORT int
sed1520_cellwidth (Driver *drvthis) sed1520_cellwidth(Driver * drvthis)
{ {
//PrivateData *p = drvthis->private_data;
return CELLWIDTH; return CELLWIDTH;
} }
///////////////////////////////////////////////////////////////// /**
// Returns the display height * API: Return the height of a character in pixels.
// */
MODULE_EXPORT int MODULE_EXPORT int
sed1520_cellheight (Driver *drvthis) sed1520_cellheight(Driver * drvthis)
{ {
//PrivateData *p = drvthis->private_data;
return CELLHEIGHT; return CELLHEIGHT;
} }
///////////////////////////////////////////////////////////////// /**
// Clears the LCD screen * API: Clears the LCD screen
// */
MODULE_EXPORT void MODULE_EXPORT void
sed1520_clear (Driver *drvthis) sed1520_clear(Driver * drvthis)
{ {
PrivateData *p = drvthis->private_data; PrivateData *p = drvthis->private_data;
memset(p->framebuf, '\0', PIXELWIDTH * HEIGHT); memset(p->framebuf, '\0', PIXELWIDTH * HEIGHT);
} }
///////////////////////////////////////////////////////////////// /**
// * API: Flushes all output to the lcd. No conversion needed here as
// Flushes all output to the lcd... * framebuffer is prepared by \c drawchar2fb.
// */
MODULE_EXPORT void MODULE_EXPORT void
sed1520_flush (Driver *drvthis) sed1520_flush(Driver * drvthis)
{ {
PrivateData *p = drvthis->private_data; PrivateData *p = drvthis->private_data;
int i, j; int i, j;
for (i = 0; i < HEIGHT; i++) { for (i = 0; i < HEIGHT; i++) {
/* select line */
selectpage(p->port, i); selectpage(p->port, i);
selectcolumn(p->port, 0, CS2) ; /* update left half of display */
for (j = 0; j < PIXELWIDTH/2; j++) selectcolumn(p->port, 0, CS2);
for (j = 0; j < PIXELWIDTH / 2; j++)
writedata(p->port, p->framebuf[j + (i * PIXELWIDTH)], CS2); writedata(p->port, p->framebuf[j + (i * PIXELWIDTH)], CS2);
selectcolumn(p->port, 0, CS1) ; /* update right half of display */
for (j = PIXELWIDTH/2; j < PIXELWIDTH; j++) selectcolumn(p->port, 0, CS1);
for (j = PIXELWIDTH / 2; j < PIXELWIDTH; j++)
writedata(p->port, p->framebuf[j + (i * PIXELWIDTH)], CS1); writedata(p->port, p->framebuf[j + (i * PIXELWIDTH)], CS1);
} }
} }
///////////////////////////////////////////////////////////////// /**
// Prints a string on the lc display, at position (x,y). The * API: Prints a string on the lc display, at position (x,y). The
// upper-left is (1,1), and the lower right should be (20,4). * upper-left is (1,1), and the lower right should be (20,4).
// */
MODULE_EXPORT void MODULE_EXPORT void
sed1520_string (Driver *drvthis, int x, int y, const char string[]) sed1520_string(Driver * drvthis, int x, int y, const char string[])
{ {
PrivateData *p = drvthis->private_data; PrivateData *p = drvthis->private_data;
int i; int i;
x--; // Convert 1-based coords to 0-based x--; /* Convert 1-based coords to 0-based */
y--; y--;
for (i = 0; string[i] != '\0'; i++) for (i = 0; string[i] != '\0'; i++)
drawchar2fb(p->framebuf, x + i, y, string[i]); drawchar2fb(p->framebuf, x + i, y, string[i]);
} }
///////////////////////////////////////////////////////////////// /**
// Writes char c at position x,y into the framebuffer. * API: Writes char c at position x,y into the framebuffer.
// x and y are 1-based textmode coordinates. * x and y are 1-based textmode coordinates.
// */
MODULE_EXPORT void MODULE_EXPORT void
sed1520_chr (Driver *drvthis, int x, int y, char c) sed1520_chr(Driver * drvthis, int x, int y, char c)
{ {
PrivateData *p = drvthis->private_data; PrivateData *p = drvthis->private_data;
@@ -331,43 +352,46 @@ sed1520_chr (Driver *drvthis, int x, int y, char c)
drawchar2fb(p->framebuf, x, y, c); drawchar2fb(p->framebuf, x, y, c);
} }
///////////////////////////////////////////////////////////////// /**
// This function draws a number num into the last 3 rows of the * API: This function draws a number num into the last 3 rows of the
// framebuffer at 1-based position x. It should draw a 4-row font, * framebuffer at 1-based position x. It should draw a 4-row font, but me
// but methinks this would look a little stretched. When * thinks this would look a little stretched. When num=10 a colon is drawn.
// num=10 a colon is drawn. *
// FIXME: make big numbers use less memory * FIXME: make big numbers use less memory
// */
MODULE_EXPORT void MODULE_EXPORT void
sed1520_num (Driver *drvthis, int x, int num) sed1520_num(Driver * drvthis, int x, int num)
{ {
PrivateData *p = drvthis->private_data; PrivateData *p = drvthis->private_data;
int z, c, i, s; int z, c, i, s;
x--; x--;
// return on illegal char or illegal position /* return on illegal char or illegal position */
if ((x >= WIDTH) || (num < 0) || (num > 10)) if ((x >= WIDTH) || (num < 0) || (num > 10))
return; return;
if (num == 10) { // colon if (num == 10) { /* colon */
for (z = 0; z < 3; z++) { // Zeilen a 8 Punkte for (z = 0; z < 3; z++) { /* 3 rows at 8 dots */
for (c = 0; c < 6; c++) { // 6 columns for (c = 0; c < 6; c++) { /* 6 columns */
s = 0; s = 0;
for (i = 0; i < 8; i++) { // 8 bits aus zeilen /* convert font definition to bitmap */
for (i = 0; i < 8; i++) {
s >>= 1; s >>= 1;
if (*(fontbigdp[(z * 8) + i] + c) == '.') if (*(fontbigdp[(z * 8) + i] + c) == '.')
s |= 0x80; s |= 0x80;
} }
/* Draw directly into framebuffer */
if ((x * CELLWIDTH + c >= 0) && (x * CELLWIDTH + c < PIXELWIDTH)) if ((x * CELLWIDTH + c >= 0) && (x * CELLWIDTH + c < PIXELWIDTH))
p->framebuf[((z + 1) * PIXELWIDTH) + (x * CELLWIDTH) + c] = s; p->framebuf[((z + 1) * PIXELWIDTH) + (x * CELLWIDTH) + c] = s;
} }
} }
} }
else { // digits 0 - 9 else { /* digits 0 - 9 */
for (z = 0; z < 3; z++) { // Zeilen a 8 Punkte for (z = 0; z < 3; z++) { /* 3 rows at 8 dots */
for (c = 0; c < 18; c++) { // 18 columns for (c = 0; c < 18; c++) { /* 18 columns */
s = 0; s = 0;
for (i = 0; i < 8; i++) { // 8 bits aus zeilen for (i = 0; i < 8; i++) {
s >>= 1; s >>= 1;
if (*(fontbignum[num][z * 8 + i] + c) == '.') if (*(fontbignum[num][z * 8 + i] + c) == '.')
s |= 0x80; s |= 0x80;
@@ -380,19 +404,18 @@ sed1520_num (Driver *drvthis, int x, int num)
} }
///////////////////////////////////////////////////////////////// /**
// Changes the font of character n to a pattern given by *dat. * API: Changes the font of character n to a pattern given by *dat.
// HD44780 Controllers only posses 8 programmable chars. But * HD44780 Controllers only posses 8 programmable chars. But we store the
// we store the fontmap completely in RAM, so every character * fontmap completely in RAM, so every character can be altered.
// can be altered. !Important: Characters have to be redrawn *
// by drawchar2fb() to show their new shape. Because we use * Important: Characters have to be redrawn by drawchar2fb() to show their
// a non-standard 6x8 font a *dat not calculated from * new shape. Because we use a non-standard 6x8 font a *dat not calculated
// width and height will fail. * from width and height will fail.
// */
MODULE_EXPORT void MODULE_EXPORT void
sed1520_set_char (Driver *drvthis, int n, char *dat) sed1520_set_char(Driver * drvthis, int n, char *dat)
{ {
//PrivateData *p = drvthis->private_data;
int row, col; int row, col;
if (n < 0 || n > 255) if (n < 0 || n > 255)
@@ -411,12 +434,12 @@ sed1520_set_char (Driver *drvthis, int n, char *dat)
} }
///////////////////////////////////////////////////////////////// /*
// Draws a vertical from the bottom up to the last 3 rows of the * Draws a vertical from the bottom up to the last 3 rows of the framebuffer
// framebuffer at 1-based position x. len is given in pixels. * at 1-based position x. len is given in pixels.
// */
MODULE_EXPORT void MODULE_EXPORT void
sed1520_old_vbar (Driver *drvthis, int x, int len) sed1520_old_vbar(Driver * drvthis, int x, int len)
{ {
PrivateData *p = drvthis->private_data; PrivateData *p = drvthis->private_data;
int i, j, k; int i, j, k;
@@ -425,28 +448,31 @@ sed1520_old_vbar (Driver *drvthis, int x, int len)
for (j = 0; j < 3; j++) { for (j = 0; j < 3; j++) {
k = 0; k = 0;
/* Set height of block. Bottom is leftmost bit */
for (i = 0; i < CELLHEIGHT; i++) { for (i = 0; i < CELLHEIGHT; i++) {
if (len > i) if (len > i)
k |= (1 << (CELLHEIGHT-1 - i)); k |= (1 << (CELLHEIGHT - 1 - i));
} }
/* Draw directly into framebuffer starting from bottom */
p->framebuf[((3 - j) * PIXELWIDTH) + (x * CELLWIDTH) + 0] = 0; p->framebuf[((3 - j) * PIXELWIDTH) + (x * CELLWIDTH) + 0] = 0;
p->framebuf[((3 - j) * PIXELWIDTH) + (x * CELLWIDTH) + 1] = 0; p->framebuf[((3 - j) * PIXELWIDTH) + (x * CELLWIDTH) + 1] = 0;
p->framebuf[((3 - j) * PIXELWIDTH) + (x * CELLWIDTH) + 2] = k; p->framebuf[((3 - j) * PIXELWIDTH) + (x * CELLWIDTH) + 2] = k;
p->framebuf[((3 - j) * PIXELWIDTH) + (x * CELLWIDTH) + 3] = k; p->framebuf[((3 - j) * PIXELWIDTH) + (x * CELLWIDTH) + 3] = k;
p->framebuf[((3 - j) * PIXELWIDTH) + (x * CELLWIDTH) + 4] = k; p->framebuf[((3 - j) * PIXELWIDTH) + (x * CELLWIDTH) + 4] = k;
p->framebuf[((3 - j) * PIXELWIDTH) + (x * CELLWIDTH) + 5] = 0; p->framebuf[((3 - j) * PIXELWIDTH) + (x * CELLWIDTH) + 5] = 0;
len -= CELLHEIGHT; len -= CELLHEIGHT;
} }
} }
///////////////////////////////////////////////////////////////// /*
// Draws a horizontal bar from left to right at 1-based position * Draws a horizontal bar from left to right at 1-based position x,y into the
// x,y into the framebuffer. len is given in pixels. * framebuffer. len is given in pixels.
// */
MODULE_EXPORT void MODULE_EXPORT void
sed1520_old_hbar (Driver *drvthis, int x, int y, int len) sed1520_old_hbar(Driver * drvthis, int x, int y, int len)
{ {
PrivateData *p = drvthis->private_data; PrivateData *p = drvthis->private_data;
int i; int i;
@@ -457,19 +483,19 @@ sed1520_old_hbar (Driver *drvthis, int x, int y, int len)
if ((y < 0) || (y >= HEIGHT) || (x < 0) || (len < 0) || ((x + (len / CELLWIDTH)) >= WIDTH)) if ((y < 0) || (y >= HEIGHT) || (x < 0) || (len < 0) || ((x + (len / CELLWIDTH)) >= WIDTH))
return; return;
/* Draw directly into framebuffer. Use 4 dots in the middle (0x3C). */
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
p->framebuf[(y * PIXELWIDTH) + (x * CELLWIDTH) + i] = 0x3C; // set low 6 bits p->framebuf[(y * PIXELWIDTH) + (x * CELLWIDTH) + i] = 0x3C;
} }
///////////////////////////////////////////////////////////////// /**
// Reprogrammes character dest to contain an icon given by * API: Place an icon on the screen.
// which. Calls set_char() to do this. */
//
MODULE_EXPORT int MODULE_EXPORT int
sed1520_icon (Driver *drvthis, int x, int y, int icon) sed1520_icon(Driver * drvthis, int x, int y, int icon)
{ {
//PrivateData *p = drvthis->private_data; static char heart_open[] =
static char heart_open[] = { {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 0, 1, 0, 1, 1, 0, 1, 0, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -477,9 +503,11 @@ sed1520_icon (Driver *drvthis, int x, int y, int icon)
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 1, 1, 0, 0, 0, 1,
1, 1, 0, 1, 1, 1, 1, 0, 1, 1,
1, 1, 1, 1, 1 }; 1, 1, 1, 1, 1
};
static char heart_filled[] = { static char heart_filled[] =
{
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 0, 1, 0, 1, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 0, 1, 0, 1, 0,
@@ -487,7 +515,8 @@ sed1520_icon (Driver *drvthis, int x, int y, int icon)
0, 1, 1, 1, 0, 0, 1, 1, 1, 0,
1, 0, 1, 0, 1, 1, 0, 1, 0, 1,
1, 1, 0, 1, 1, 1, 1, 0, 1, 1,
1, 1, 1, 1, 1 }; 1, 1, 1, 1, 1
};
switch (icon) { switch (icon) {
case ICON_BLOCK_FILLED: case ICON_BLOCK_FILLED:
@@ -506,4 +535,3 @@ sed1520_icon (Driver *drvthis, int x, int y, int icon)
} }
return 0; return 0;
} }