Programmer’s Guide |
Baud rate inaccuracy
Divisor = 921600/Target Baud Rate. (Only Integer part) ENUM = 8 * (921600/Targer - Divisor) ( Round up or down)
Inaccuracy = (Target Baud Rate – 921600/(Divisor + (ENUM/8))) * 100% E.g.,
To calculate 500000 bps Divisor = 1, ENUM = 7, Inaccuracy = 1.7%
*The Inaccuracy should less than 2% for work reliably.
Special Note
1.If the target baud rate 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.
LCM
typedef struct lcm_xy { | - | 15 | ||||
int | x; // | col | value, | the arrange is 0 | ||
int | y; // | raw | value, | the arrange is 0 | - | 7 |
} lcm_xy_t;
Examples
int ioctl(fd, IOCTL_LCM_GOTO_XY, lcm_xy_t *pos);
Move the cursor position to x(col),y(raw) position. The argument 3 is the new position value.
int ioctl(fd, IOCTL_LCM_CLS, NULL);
Clears the LCM display.
int ioctl(fd, IOCTL_LCM_CLEAN_LINE, NULL);
To change one line to all spaces in the current row, and move the cursor to the 0 column of this row.
int ioctl(fd, IOCTL_LCM_GET_XY, lcm_xy_t *pos);
Get the current cursor position. The value will be returned in argument 3.
int ioctl(fd, IOCTL_LCM_BACK_LIGH_ON, NULL);
Turns the LCM back light on.
int ioctl(fd, IOCTL_LCM_BACK_LIGHT_OFF, NULL);
Turns the LCM back light off.
KeyPad
The device node is /dev/keypad. The key value is defined in moxadevice.h.
int ioctl(fd, IOCTL_KEYPAD_HAS_PRESS, int *flag);
Checks how many keys have been pressed. Argument 3 returns the number of pressed keys. 0 means no keys were pressed.
int ioctl(fd, IOCTL_KEYPAD_GET_KEY, int *key);
Gets the value of the last key that was pressed. This functions only reads one key value for each function call. The value of the key value is returned in argument 3.