diff options
-rw-r--r-- | drv_MatrixOrbital.c | 47 | ||||
-rw-r--r-- | drv_PICGraphic.c | 2 | ||||
-rw-r--r-- | drv_USBHUB.c | 4 | ||||
-rw-r--r-- | drv_ula200.c | 4 | ||||
-rw-r--r-- | udelay.h | 6 |
5 files changed, 50 insertions, 13 deletions
diff --git a/drv_MatrixOrbital.c b/drv_MatrixOrbital.c index a503923..4cfb88c 100644 --- a/drv_MatrixOrbital.c +++ b/drv_MatrixOrbital.c @@ -58,6 +58,8 @@ static char Name[] = "MatrixOrbital"; static int Model; static int Protocol; +static char dispBuffer[2][16]; + typedef struct { int type; char *name; @@ -98,6 +100,7 @@ static MODEL Models[] = { {0x36, "LK202-24-USB", 2, 20, 8, 8, 2}, {0x38, "LK204-24-USB", 4, 20, 8, 8, 2}, {0x39, "VK204-24-USB", 4, 20, 8, 8, 2}, + {0x40, "DE-LD011", 2, 16, 0, 0, 3}, /* Sure electronics USB LCD board Rev.I */ {0xff, "Unknown", -1, -1, 0, 0, 0} }; @@ -108,6 +111,8 @@ static MODEL Models[] = { static void drv_MO_clear(void) { + int i, j; + switch (Protocol) { case 1: drv_generic_serial_write("\014", 1); /* Clear Screen */ @@ -115,6 +120,19 @@ static void drv_MO_clear(void) case 2: drv_generic_serial_write("\376\130", 2); /* Clear Screen */ break; + + case 3: + /* Sure electronics USB LCD board - clear buffer */ + for (i = 0; i < 2; i++) { + for (j = 0; j < 16; j++) { + dispBuffer[i][j] = ' '; + } + } + + drv_MO_write(1, 1, dispBuffer[0], 16); + drv_MO_write(1, 2, dispBuffer[1], 16); + + break; } } @@ -123,11 +141,18 @@ static void drv_MO_write(const int row, const int col, const char *data, const i { char cmd[5] = "\376Gyx"; - cmd[2] = (char) col + 1; - cmd[3] = (char) row + 1; - drv_generic_serial_write(cmd, 4); - - drv_generic_serial_write(data, len); + if (Models[Model].protocol == 3) { // Sure electronics USB LCD board - full line output + cmd[2] = (char) 1; + cmd[3] = (char) row + 1; + strncpy(&(dispBuffer[row][col]), data, len); + drv_generic_serial_write(cmd, 4); + drv_generic_serial_write(dispBuffer[row], 16); + } else { + cmd[2] = (char) col + 1; + cmd[3] = (char) row + 1; + drv_generic_serial_write(cmd, 4); + drv_generic_serial_write(data, len); + } } @@ -302,6 +327,14 @@ static int drv_MO_start(const char *section, const int quiet) Model = -1; } + if (Models[i].protocol == 3) { // Sure electronics USB LCD board - full line output + int i, j; + for (i = 0; i < 2; i++) { // Clear buffer + for (j = 0; j < 16; j++) { + dispBuffer[i][j] = ' '; + } + } + } if (drv_generic_serial_open(section, Name, 0) < 0) return -1; @@ -544,11 +577,15 @@ int drv_MO_quit(const int quiet) /* clear display */ drv_MO_clear(); + usleep(300000); + /* say goodbye... */ if (!quiet) { drv_generic_text_greet("goodbye!", NULL); } + usleep(300000); + drv_generic_serial_close(); return (0); diff --git a/drv_PICGraphic.c b/drv_PICGraphic.c index c33973d..8586eb6 100644 --- a/drv_PICGraphic.c +++ b/drv_PICGraphic.c @@ -203,7 +203,7 @@ static void drv_PICGraphic_blit(const int row, const int col, const int height, delayDone = 0; int row8, height8; row8 = 8 * (row / 8); - height8 = 8 * (height / 8) + !!(height % 8); + height8 = 8 * (height / 8) + ! !(height % 8); info("sending blit"); cmd[0] = 'b'; cmd[1] = row8; diff --git a/drv_USBHUB.c b/drv_USBHUB.c index 7422b4a..f82558a 100644 --- a/drv_USBHUB.c +++ b/drv_USBHUB.c @@ -37,9 +37,9 @@ #include "config.h" #ifdef HAVE_USB_H -# include <usb.h> +#include <usb.h> #else -# error The USB-HUB driver only makes sense with USB support +#error The USB-HUB driver only makes sense with USB support #endif #include "debug.h" diff --git a/drv_ula200.c b/drv_ula200.c index 345f571..d34c8e0 100644 --- a/drv_ula200.c +++ b/drv_ula200.c @@ -124,10 +124,10 @@ static struct ftdi_context *Ftdi = NULL; /* define TRUE and FALSE for better code readability if not already defined */ #ifndef TRUE -# define TRUE 1 +#define TRUE 1 #endif #ifndef FALSE -# define FALSE 0 +#define FALSE 0 #endif @@ -31,14 +31,14 @@ /* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */ static inline void rep_nop(void) { -# if defined(__i386) || defined(__i386__) || defined(__AMD64__) || defined(__x86_64__) || defined(__amd64__) +#if defined(__i386) || defined(__i386__) || defined(__AMD64__) || defined(__x86_64__) || defined(__amd64__) /* intel or amd64 arch, the "rep" and "nop" opcodes are available */ __asm__ __volatile__("rep; nop"); -# else +#else /* other Arch, maybe add core cooldown code here, too. */ do { } while (0); -# endif +#endif } void udelay_init(void); |