![Advantech EKI-1121L User Manual Download Page 46](http://html1.mh-extra.com/html/advantech/eki-1121l/eki-1121l_user-manual_2858303046.webp)
EKI-1121L/1122L/1124L User Manual
40
Then, use the following instructions to set the termios structure, followed by the
tcsetattr function to set the new configuration.
switch(gMode) {
case MODE_RS232:
PortTermios.c_iflag &= ~IRS422;
PortTermios.c_iflag &= ~IRS485;
break;
case MODE_RS422:
PortTermios.c_iflag |= IRS422;
PortTermios.c_iflag &= ~IRS485;
break;
case MODE_RS485:
PortTermios.c_iflag &= ~IRS422;
PortTermios.c_iflag |= IRS485;
break;
}
//Set the new serial port interface type
tcsetattr(portHandle, TCSANOW, &PortTermios);
For a complete example of serial port configuration, please see the provided seria-
lecho.c example.
4.3.2
RTC APIs
To access a RTC device, you simply open the corresponding device file.
4.3.3
LED APIs
To access a LED device, you simply open the corresponding device file.
Developing in C, you will first need to include the <stdio.h> <sys/types.h> <sys/
ioctl.h> <unistd.h> and "ledman.h" header file to use the required functions.
Then, use the following program to set the command, followed by the ioctl function to
control leds.
if(flag)
{
flag = 0;
cmd = LEDMAN_CMD_ON;
/*your action*/
}
Peripheral
Device File
Real Time Clock
/dev/rtc
Peripheral
Device File
LED Indicator
/dev/led
Summary of Contents for EKI-1121L
Page 1: ...User Manual EKI 1121L EKI 1122L EKI 1124L 1 2 4 port Programmable Serial Device Servers...
Page 7: ...Chapter 1 1 Introduction...
Page 10: ...EKI 1121L 1122L 1124L User Manual 4...
Page 11: ...Chapter 2 2 Getting Started...
Page 23: ...Chapter 3 3 Installation and Configuration...
Page 42: ...EKI 1121L 1122L 1124L User Manual 36...
Page 43: ...Chapter 4 4 Development Guide...
Page 48: ...EKI 1121L 1122L 1124L User Manual 42...
Page 49: ...Chapter 5 5 Troubleshooting...
Page 51: ...Appendix A A Restore the Platform Kernel...
Page 53: ...Appendix B B Erase JFFS2 File System...
Page 55: ...Appendix C C Command Collection...
Page 59: ...53 EKI 1121L 1122L 1124L User Manual Appendix C Command Collection...