Ligne 12 : |
Ligne 12 : |
| Then the following functions are available: | | Then the following functions are available: |
| | | |
− | == serialOpen == | + | === serialOpen === |
| int serialOpen (char *device, int baud) ; | | int serialOpen (char *device, int baud) ; |
| | | |
| This opens and initialises the serial device and sets the baud rate. It sets the port into “raw” mode (character at a time and no translations), and sets the read timeout to 10 seconds. The return value is the file descriptor or -1 for any error, in which case errno will be set as appropriate. | | This opens and initialises the serial device and sets the baud rate. It sets the port into “raw” mode (character at a time and no translations), and sets the read timeout to 10 seconds. The return value is the file descriptor or -1 for any error, in which case errno will be set as appropriate. |
| | | |
− | == serialClose == | + | === serialClose === |
| void serialClose (int fd) ; | | void serialClose (int fd) ; |
| | | |
| Closes the device identified by the file descriptor given. | | Closes the device identified by the file descriptor given. |
| | | |
− | == serialPutChar== | + | === serialPutChar === |
| void serialPutchar (int fd, unsigned char c) ; | | void serialPutchar (int fd, unsigned char c) ; |
| | | |
| Sends the single byte to the serial device identified by the given file descriptor. | | Sends the single byte to the serial device identified by the given file descriptor. |
| | | |
− | == serialPuts == | + | === serialPuts === |
| void serialPuts (int fd, char *s) ; | | void serialPuts (int fd, char *s) ; |
| | | |
| Sends the nul-terminated string to the serial device identified by the given file descriptor. | | Sends the nul-terminated string to the serial device identified by the given file descriptor. |
| | | |
− | == serialPrintf == | + | === serialPrintf === |
| void serialPrintf (int fd, char *message, …) ; | | void serialPrintf (int fd, char *message, …) ; |
| | | |
| Emulates the system printf function to the serial device. | | Emulates the system printf function to the serial device. |
| | | |
− | == serialDataAvail == | + | === serialDataAvail === |
| int serialDataAvail (int fd) ; | | int serialDataAvail (int fd) ; |
| | | |
| Returns the number of characters available for reading, or -1 for any error condition, in which case errno will be set appropriately. | | Returns the number of characters available for reading, or -1 for any error condition, in which case errno will be set appropriately. |
| | | |
− | == serialGetChar == | + | === serialGetChar === |
| int serialGetchar (int fd) ; | | int serialGetchar (int fd) ; |
| | | |
| Returns the next character available on the serial device. This call will block for up to 10 seconds if no data is available (when it will return -1) | | Returns the next character available on the serial device. This call will block for up to 10 seconds if no data is available (when it will return -1) |
| | | |
− | == serialFlush == | + | === serialFlush === |
| void serialFlush(int fd); | | void serialFlush(int fd); |
| | | |