Changed RS485 interface to allow lower/upper case for Win32.
This commit is contained in:
@@ -47,9 +47,9 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
#include "mstp.h"
|
#include "mstp.h"
|
||||||
#include "dlmstp.h"
|
#include "dlmstp.h"
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#define STRICT 1
|
#define STRICT 1
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
@@ -83,6 +83,20 @@ static DWORD RS485_DTRControl = DTR_CONTROL_DISABLE;
|
|||||||
RTS_CONTROL_HANDSHAKE, RTS_CONTROL_TOGGLE */
|
RTS_CONTROL_HANDSHAKE, RTS_CONTROL_TOGGLE */
|
||||||
static DWORD RS485_RTSControl = RTS_CONTROL_DISABLE;
|
static DWORD RS485_RTSControl = RTS_CONTROL_DISABLE;
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* DESCRIPTION: Change the characters in a string to uppercase
|
||||||
|
* RETURN: nothing
|
||||||
|
* ALGORITHM: none
|
||||||
|
* NOTES: none
|
||||||
|
*****************************************************************************/
|
||||||
|
void strupper(char *str)
|
||||||
|
{
|
||||||
|
char *p;
|
||||||
|
for (p = str; *p != '\0'; ++p) {
|
||||||
|
*p = toupper(*p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* DESCRIPTION: Initializes the RS485 hardware and variables, and starts in
|
* DESCRIPTION: Initializes the RS485 hardware and variables, and starts in
|
||||||
* receive mode.
|
* receive mode.
|
||||||
@@ -97,6 +111,7 @@ void RS485_Set_Interface(
|
|||||||
for CreateFile. The syntax also works for COM ports 1-9. */
|
for CreateFile. The syntax also works for COM ports 1-9. */
|
||||||
/* http://support.microsoft.com/kb/115831 */
|
/* http://support.microsoft.com/kb/115831 */
|
||||||
if (ifname) {
|
if (ifname) {
|
||||||
|
strupper(ifname);
|
||||||
if (strncmp("COM", ifname, 3) == 0) {
|
if (strncmp("COM", ifname, 3) == 0) {
|
||||||
if (strlen(ifname) > 3) {
|
if (strlen(ifname) > 3) {
|
||||||
sprintf(RS485_Port_Name, "\\\\.\\COM%i", atoi(ifname + 3));
|
sprintf(RS485_Port_Name, "\\\\.\\COM%i", atoi(ifname + 3));
|
||||||
|
|||||||
Reference in New Issue
Block a user