- coding style harmonization

- check onsistency between Size & vSpan
This commit is contained in:
marschap
2007-04-04 13:52:38 +00:00
parent 3e616e4192
commit 0f0af0f381
19 changed files with 437 additions and 439 deletions
+3 -2
View File
@@ -17,17 +17,18 @@
# include "hd44780-serialLpt.h" # include "hd44780-serialLpt.h"
# include "hd44780-winamp.h" # include "hd44780-winamp.h"
#endif #endif
#include "hd44780-serial.h"
#include "hd44780-lis2.h"
#ifdef HAVE_LIBUSB #ifdef HAVE_LIBUSB
# include "hd44780-bwct-usb.h" # include "hd44780-bwct-usb.h"
# include "hd44780-lcd2usb.h" # include "hd44780-lcd2usb.h"
#endif #endif
#include "hd44780-serial.h"
#include "hd44780-lis2.h"
#ifdef HAVE_I2C #ifdef HAVE_I2C
# include "hd44780-i2c.h" # include "hd44780-i2c.h"
#endif #endif
// add new connection type header files here // add new connection type header files here
static const ConnectionMapping connectionMapping[] = { static const ConnectionMapping connectionMapping[] = {
// connectionType enumerator // connectionType enumerator
// string to identify connection on command line // string to identify connection on command line
+7 -14
View File
@@ -157,29 +157,25 @@ int rowNum = 0;
void lis2_HD44780_senddata(PrivateData *p, unsigned char displayID, unsigned char flags, unsigned char ch) void lis2_HD44780_senddata(PrivateData *p, unsigned char displayID, unsigned char flags, unsigned char ch)
{ {
if (flags == RS_DATA) { if (flags == RS_DATA) {
if (mode == SETCHAR) if (mode == SETCHAR) {
{
writeChar(p->fd, 0); writeChar(p->fd, 0);
writeChar(p->fd, 171); writeChar(p->fd, 171);
writeChar(p->fd, charNum); writeChar(p->fd, charNum);
writeChar(p->fd, rowNum); writeChar(p->fd, rowNum);
writeChar(p->fd, ch); writeChar(p->fd, ch);
rowNum = rowNum + 1; rowNum++;
if (rowNum==p->cellheight) if (rowNum == p->cellheight) {
{
mode = 0; mode = 0;
rowNum = 0; rowNum = 0;
} }
} }
else else {
{ if (ch < 7) ch++;
if (ch<7) ch=ch+1;
write(p->fd, &ch, 1); write(p->fd, &ch, 1);
} }
} }
else { else {
if ((ch & POSITION)!=0) if ((ch & POSITION) != 0) {
{
int x = 0; int x = 0;
int y = 0; int y = 0;
int pos = 0; int pos = 0;
@@ -201,8 +197,7 @@ void lis2_HD44780_senddata (PrivateData *p, unsigned char displayID, unsigned ch
writeChar(p->fd, 167); writeChar(p->fd, 167);
} }
else if ((ch & SETCHAR)!=0) else if ((ch & SETCHAR) != 0) {
{
mode = SETCHAR; mode = SETCHAR;
charNum = ((ch & ~SETCHAR)/8) + 1; charNum = ((ch & ~SETCHAR)/8) + 1;
if (charNum == 8) charNum = 7; if (charNum == 8) charNum = 7;
@@ -223,5 +218,3 @@ unsigned char lis2_HD44780_scankeypad (PrivateData *p)
} }
+5 -1
View File
@@ -204,7 +204,6 @@ HD44780_init (Driver *drvthis)
} }
// default case for when spans aren't indicated // default case for when spans aren't indicated
// - add a sanity check against p->height ??
if (p->numLines == 0) { if (p->numLines == 0) {
if ((p->spanList = (int *) calloc(sizeof(int), p->height)) != NULL) { if ((p->spanList = (int *) calloc(sizeof(int), p->height)) != NULL) {
int i; int i;
@@ -215,6 +214,11 @@ HD44780_init (Driver *drvthis)
} else } else
report(RPT_ERR, "%s: error allocing", drvthis->name); report(RPT_ERR, "%s: error allocing", drvthis->name);
} }
else {
// sanity check against p->height
if (p->numLines != p->height)
report(RPT_ERR, "%s: height in Size does not match vSpan", drvthis->name);
}
if (p->numDisplays == 0) { if (p->numDisplays == 0) {
if (((p->dispVOffset = (int *) calloc(1, sizeof(int))) != NULL) && if (((p->dispVOffset = (int *) calloc(1, sizeof(int))) != NULL) &&
((p->dispSizes = (int *) calloc(1, sizeof(int))) != NULL)) { ((p->dispSizes = (int *) calloc(1, sizeof(int))) != NULL)) {