various comments added.

This commit is contained in:
Florian Streibelt 2011-10-12 13:16:45 +02:00
parent 5c15a18110
commit 7dc1d5c7ca
1 changed files with 27 additions and 5 deletions

View File

@ -42,30 +42,50 @@ initport (int fd)
return 1;
}
//reset the display to defaults
char display_init[] = { 0x1b, 0x40 };
char display_showtime[] = { 0x1F, 0x54 };
//show or hide the cursor
char display_cursor_off[] = { 0x1f, 0x43, 0x0 };
char display_cursor_on[] = { 0x1f, 0x43, 0x1 };
// blink-command:
// where the last value defines the blink rate,
// with 0=always on, 255=always off
char display_on[] = { 0x1f, 0x45, 0x0 };
char display_off[] = { 0x1f, 0x45, 0xff };
//Modes for new chars:
char display_overwrite[] = { 0x1f, 0x01 };
char display_vscroll[] = { 0x1f, 0x02 };
char display_hscroll[] = { 0x1f, 0x03 };
//clear and cursor home
char display_clear_screen[] = { 0x0c };
// activate timer display in lower right corner.
// actual time has to be set via display_set_timer.
char display_time[] = {0x1f,0x55};
// configures hour and minutes of the internal clock and
// displays the time in the lower right corner.
// turns off when something gets written into the line.
// two bytes have to follow with hour and minute
char display_set_timer[] = { 0x1F, 0x54 };
// various commands for the display:
// send a command sequence from the heap(!) {sizeof used}
// only to be used within the macros presented below!
#define DWC(c) display_write(c,sizeof(c))
//send a null terminated string:
#define SEND_TEXT(t) display_write(t,strlen(t))
//various commands
#define SEND_DISPLAY_INIT DWC(display_init)
#define SEND_CURSOR_OFF DWC(display_cursor_off)
#define SEND_CURSOR_ON DWC(display_cursor_on)
#define SEND_DEFINE_TIMER DWC(display_showtime)
#define SEND_DEFINE_TIMER DWC(display_set_timer)
#define SEND_SHOW_TIMER DWC(display_time)
#define SEND_MODE_OVERWRITE DWC(display_overwrite)
#define SEND_MODE_VSCROLL DWC(display_vscroll)
@ -74,6 +94,7 @@ char display_time[] = {0x1f,0x55};
#define SEND_DISPLAY_ON DWC(display_on)
#define SEND_CLEAR DWC(display_clear_screen);
// internal defines.
#define TIME_BASE 200000
#define TB_TO_SECS(x) (x*1000000/TIME_BASE)
@ -83,8 +104,9 @@ char display_time[] = {0x1f,0x55};
#define DEVICE "/dev/ttyUSB0"
#define PAUSEMSG "Hallo, bitte melde Dich am Barcodereader an, um das Kassensystem zu benutzen *** Angebot: Die Mate heute nur 0.75 *** "
#define PAUSEMSG "Hallo, bitte melde Dich am Barcodereader an, um das Kassensystem zu benutzen *** "
// chars per line in our display:
#define LINELEN 20
void