Permalink
Browse files

Update Commit

- added support for baudrate up to 921600
- added maximum port count support
- fixed mingw build issue...
  • Loading branch information...
1 parent 19a07a3 commit 58f49441555caebd134133583b33e8812580973a @azman committed Nov 9, 2012
Showing with 63 additions and 26 deletions.
  1. +11 −0 CHANGELOG
  2. +1 −1 VERSION
  3. +2 −2 makefile
  4. +29 −10 src/my1comlib.c
  5. +11 −1 src/my1comlib.h
  6. +9 −12 src/my1termu.c
View
@@ -1,4 +1,15 @@
**************
+my1termu-1.3.2
+**************
+
+Update:
+- added support for baudrate up to 921600! (my1termu)
+- increase max port count to 32!
+
+Bugfix:
+- makefile setting for mingw has issues (cannot build)
+
+**************
my1termu-1.3.1
**************
View
@@ -1 +1 @@
-1.3.1
+1.3.2
View
@@ -3,10 +3,10 @@
PROJECT = my1termu
CONSBIN = $(PROJECT)
CONSPRO = $(CONSBIN)
-CONSOBJ = my1cons.o my1comlib.o my1comport.o $(CONSPRO).o
+CONSOBJ = my1cons.o my1comlib.o my1comport.o $(CONSBIN).o
TESTBIN = my1console
TESTPRO = $(TESTBIN)
-TESTOBJ = my1cons.o $(TESTPRO).o
+TESTOBJ = my1cons.o $(TESTBIN).o
PACKDIR = $(PROJECT)-$(shell cat VERSION)
PACKDAT = README TODO CHANGELOG VERSION
View
@@ -50,6 +50,7 @@ void initialize_serial(ASerialPort_t* aPort)
aPort->mTIO.c_cflag |= CS8; /* set 8-bit char */
aPort->mTIO.c_cflag |= CLOCAL; /* ignore modem control */
aPort->mTIO.c_cflag |= CREAD; /* enable receiver */
+ aPort->mTIO.c_cflag |= CRTSCTS; /* enable receiver */
#endif
}
/*----------------------------------------------------------------------------*/
@@ -206,19 +207,28 @@ int set_serialconfig(ASerialPort_t* aPort, ASerialConf_t* aConfig)
#ifdef DO_MINGW
switch(aConfig->mBaudRate)
{
- case 1:
+ case MY1BAUD19200:
aPort->mDCB.BaudRate = 19200;
break;
- case 2:
+ case MY1BAUD38400:
aPort->mDCB.BaudRate = 38400;
break;
- case 3:
+ case MY1BAUD57600:
aPort->mDCB.BaudRate = 57600;
break;
- case 4:
+ case MY1BAUD115200:
aPort->mDCB.BaudRate = 115200;
break;
- case 0:
+ case MY1BAUD230400:
+ aPort->mDCB.BaudRate = 230400;
+ break;
+ case MY1BAUD460800:
+ aPort->mDCB.BaudRate = 460800;
+ break;
+ case MY1BAUD921600:
+ aPort->mDCB.BaudRate = 921600;
+ break;
+ case MY1BAUD9600:
default:
aPort->mDCB.BaudRate = 9600;
break;
@@ -234,19 +244,28 @@ int set_serialconfig(ASerialPort_t* aPort, ASerialConf_t* aConfig)
tcflag_t cSizeFlag, cParityOpt;
switch(aConfig->mBaudRate)
{
- case 1:
+ case MY1BAUD19200:
cBaudRate = B19200;
break;
- case 2:
+ case MY1BAUD38400:
cBaudRate = B38400;
break;
- case 3:
+ case MY1BAUD57600:
cBaudRate = B57600;
break;
- case 4:
+ case MY1BAUD115200:
cBaudRate = B115200;
break;
- case 0:
+ case MY1BAUD230400:
+ cBaudRate = B230400;
+ break;
+ case MY1BAUD460800:
+ cBaudRate = B460800;
+ break;
+ case MY1BAUD921600:
+ cBaudRate = B921600;
+ break;
+ case MY1BAUD9600:
default:
cBaudRate = B9600;
break;
View
@@ -2,7 +2,7 @@
#ifndef __MY1COMLIBH
#define __MY1COMLIBH
/*----------------------------------------------------------------------------*/
-#define MAX_COM_PORT 16
+#define MAX_COM_PORT 32
#define MAX_COM_CHAR 16
/*----------------------------------------------------------------------------*/
#ifdef DO_MINGW
@@ -15,6 +15,16 @@
/*----------------------------------------------------------------------------*/
#define INVALID_PORT_INDEX -1
/*----------------------------------------------------------------------------*/
+#define MY1BAUD9600 0
+#define MY1BAUD19200 1
+#define MY1BAUD38400 2
+/** THESE ARE NON-POSIX? */
+#define MY1BAUD57600 3
+#define MY1BAUD115200 4
+#define MY1BAUD230400 5
+#define MY1BAUD460800 6
+#define MY1BAUD921600 7
+/*----------------------------------------------------------------------------*/
typedef unsigned char byte_t;
/*----------------------------------------------------------------------------*/
typedef struct __ASerialConf
View
@@ -127,12 +127,6 @@ int main(int argc, char* argv[])
printf("Cannot get baud rate!\n");
return ERROR_PARAM_BAUD;
}
- else if(test!=9600&&test!=19200&&test!=38400&&
- test!=57600&&test!=115200)
- {
- printf("Invalid baudrate! (%d)\n", test);
- return ERROR_PARAM_BAUD;
- }
baudrate = test;
}
else if(!strcmp(argv[loop],"--tty"))
@@ -205,12 +199,15 @@ int main(int argc, char* argv[])
get_serialconfig(&cPort,&cConfig);
switch(baudrate)
{
- default:
- case 9600: cConfig.mBaudRate = 0; break;
- case 19200: cConfig.mBaudRate = 1; break;
- case 38400: cConfig.mBaudRate = 2; break;
- case 57600: cConfig.mBaudRate = 3; break;
- case 115200: cConfig.mBaudRate = 4; break;
+ default: printf("Invalid baudrate (%d)! Using default!\n", test);
+ case 9600: cConfig.mBaudRate = MY1BAUD9600; break;
+ case 19200: cConfig.mBaudRate = MY1BAUD19200; break;
+ case 38400: cConfig.mBaudRate = MY1BAUD38400; break;
+ case 57600: cConfig.mBaudRate = MY1BAUD57600; break;
+ case 115200: cConfig.mBaudRate = MY1BAUD115200; break;
+ case 230400: cConfig.mBaudRate = MY1BAUD230400; break;
+ case 460800: cConfig.mBaudRate = MY1BAUD460800; break;
+ case 921600: cConfig.mBaudRate = MY1BAUD921600; break;
}
set_serialconfig(&cPort,&cConfig);
}

0 comments on commit 58f4944

Please sign in to comment.