Fix problems with inverse TXD, etc
authorJelmer Vernooij <jelmer@vernstok.nl>
Tue, 24 Feb 2004 18:35:19 +0000 (19:35 +0100)
committerJelmer Vernooij <jelmer@vernstok.nl>
Tue, 24 Feb 2004 18:35:19 +0000 (19:35 +0100)
TODO
at89ser.c
pins-serial-raw.c
pins-serial.c
pins.c
prog1.c

diff --git a/TODO b/TODO
index 7eb9238910fcb648614e01560ff88ea50e58f93f..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1 +0,0 @@
-- fixes for pins (The TXD set function now sets it to negative, instead of positive), same goes for the CTS pin
index 7000a5a721677449e544bfcaa014f61711b9cd42..9319bdee4639bea05fd938bf3e220705c9454df0 100644 (file)
--- a/at89ser.c
+++ b/at89ser.c
@@ -34,8 +34,8 @@ void SPI_Out(int b)
 {
        int i;
        for(i = 7; i >= 0; i--) {
-               if(b & (1 << i)) SetMOSI();
-               else ClearMOSI();
+               if(b & (1 << i)) ClearMOSI();
+               else SetMOSI();
                waitmicrosec(2);
                SetSCK();
                waitmicrosec(3);
@@ -111,7 +111,7 @@ int activate()
 {
        deactivate();
        ClearSCK();
-       ClearMOSI();
+       SetMOSI();
        SetRST();
        waitmillisec(12);
        
index 9409e0ab2cfe60ae936d435a35c3c520399afc3e..72407c4511016ce7df5e63e5c9f065fc5ea95654 100644 (file)
@@ -40,7 +40,7 @@ static int serport = 0x3f8;
 
 static struct bit bits[] = {
        { 4, 0x02, 0}, /* RTS */
-       { 3, 0x40, 1}, /* TXD */
+       { 3, 0x40, 0}, /* TXD */
        { 6, 0x10, 1}, /* CTS */
        { 6, 0x20, 0}, /* DSR */
        { 4, 0x01, 0},  /* DTR */
index b89557a2ee30d4b4a6d3563b2d7f1dd3d0543175..3d09909645e758fcf602ad5fdb5d8111281b2cc5 100644 (file)
@@ -70,7 +70,7 @@ static void ser_set(int p)
        
        switch(p) {
        case SER_PIN_TXD: 
-               if(ioctl (fd, TIOCCBRK, 0) < 0) perror("ioctl");
+               if(ioctl (fd, TIOCSBRK, 0) < 0) perror("ioctl");
                break;
        case SER_PIN_DTR: status |= TIOCM_DTR; break;
        case SER_PIN_DSR: status |= TIOCM_LE; break;
@@ -91,7 +91,7 @@ static void ser_clear(int p)
        
        switch(p) {
        case SER_PIN_TXD: 
-               if(ioctl (fd, TIOCSBRK, 0) < 0) perror("ioctl"); 
+               if(ioctl (fd, TIOCCBRK, 0) < 0) perror("ioctl"); 
                  break;
        case SER_PIN_DTR: status &=~TIOCM_DTR; break;
        case SER_PIN_DSR: status &=~TIOCM_LE; break;
diff --git a/pins.c b/pins.c
index 946f43d62c8c22f1ebb8faff02c261a2cbce5d57..5bd788651553536281a2a86626d2d4085caebb09 100644 (file)
--- a/pins.c
+++ b/pins.c
@@ -169,7 +169,15 @@ int pins_init()
        int i;
        if(!backend) backend = pins_backends[0];
        for(i = 0; i < num_confsettings; i++) {
-               SetPinVariable(confsettings[i].name, confsettings[i].value);
+               switch(SetPinVariable(confsettings[i].name, confsettings[i].value)) {
+               case 0:break;
+               case -1:
+                          fprintf(stderr, "Unknown PIN '%s'\n", confsettings[i].name);
+                          return -1;
+               case -2:
+                          fprintf(stderr, "Unknown PIN '%s'\n", confsettings[i].value);
+                          return -1;
+               }
        }
 
        return backend->init(location);
diff --git a/prog1.c b/prog1.c
index be3ccbad0859eb48db789465f2ca43a57387f92b..6a235c2ae73aee48283016a4935df54b240dfec8 100644 (file)
--- a/prog1.c
+++ b/prog1.c
@@ -29,7 +29,7 @@
 #include "at89ser.h"
 #include "delays.h"
 
-#define VERSION                "0.6"
+#define VERSION                "0.7"
 
 char progress = 0;