User`s manual

ThinkCore IA241/240 Linux User’s Manual Programmer’s Guide
6-8
Special Note
1. If the target baudrate is not a special baudrate (e.g. 50, 75, 110, 134, 150, 200, 300, 600, 1200,
1800, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600), the termios
cflag will be set to the same flag.
2. If you use stty to get the serial information, you will get speed equal to 0.
DI/DO
int
set_dout_state(int doport, int state)
Description
Set the digital output state to high or low.
Input
int doport - the digital output port number. It is 0 to 3.
int state - the output state, high or low. You can use define DIO_HIGH or DIO_LOW.
Output
OK will be zero.
int get_din_state(int doport, int *state)
Description
Get the digital input current state at now.
Input
int diport - the digital input port number. It is 0 to 3.
int *state - To save the digital input state at now.
Output
OK will be zero.
int get_dout_state(int doport, int *state)
Description
Get the digital output current state at now.
Input
int doport - the digital output port number. It is 0 to 3.
int *state - To save the digital output state at now.
Output
OK will be zero.
int set_din_event(int diport, void (*func)(int diport), int mode, long int duration)
Description
Set the callback function for digital input port when the state is changed from high to low, low to
high or any sate changed.
Input
int diport - the digital output port number. It is 0 to 3.
void (*func)(int diport) - The call back function point. It will be called when the set event
happens.
int mode - Set the kind event. High to low, low to high or both.
long int duration - We know the digital signal sometime is not reliable. You can the duration time