USB Input / Output
Functions for USB input / output. More...
Defines | |
| #define | USB_BAUD 115200 |
| the USB baud rate | |
Functions | |
| void | usb_init (void) |
| Initialize the USB. | |
| int | usb_putc (char c) |
| Print a character to USB. | |
| int | usb_getc (void) |
| Read a character from USB. | |
| int | usb_getc_nb (char *c) |
| Read a character from USB without blocking. | |
| int | usb_puts (char *s) |
| Print a string to USB. | |
| void | usb_puts_P (PGM_P s) |
| Print a string from program space to USB. | |
| int | usb_puti (int value) |
| Print an integer to USB. | |
| uint8_t | hex_digit (uint8_t value) |
| Determine a hexadecimal digit. | |
| void | usb_puth16 (uint16_t value) |
| Print a fixed width hexadecimal representation to USB. | |
| void | usb_puth8 (uint8_t value) |
| Print a fixed width hexadecimal representation to USB. | |
Detailed Description
Functions for USB input / output.
Low level functions for USB input and output.
Function Documentation
| uint8_t hex_digit | ( | uint8_t | value | ) |
Determine a hexadecimal digit.
Determines a hexadecimal digit in ASCII code.
- Parameters:
-
value the value of the digit (0<=value<=15)
- Returns:
- the hexadecimal digit in ASCII code, or '?' if the input is invalid.
Definition at line 316 of file serial.c.
Referenced by usb_puth16(), and usb_puth8().
| int usb_getc | ( | void | ) |
Read a character from USB.
Returns the first character in the buffer received from USB. This function blocks execution until a character has been received. xbee_init must be called before this function may be used.
- Returns:
- the first character in the usb buffer
- See also:
- usb_init, usb_getc_nb
Definition at line 193 of file serial.c.
Referenced by usb_init().
| int usb_getc_nb | ( | char * | c | ) |
Read a character from USB without blocking.
Non blocking version of usb_getc. If a character is present in the buffer, it is returned, otherwise -1 is returned immediately. usb_init must be called before this function can be used.
- Parameters:
-
c the received character. This will be set if a character has been received.
- Returns:
- -1 if no character is available, 0 otherwise
| void usb_init | ( | void | ) |
Initialize the USB.
Initializes communication over the USB serial port. This must be called before any other usb function may be used.
Definition at line 60 of file serial.c.
References usb_getc(), and usb_putc().
| int usb_putc | ( | char | c | ) |
Print a character to USB.
Sends a character over USB.
- Parameters:
-
c the character to send
- Returns:
- 0 for success, nonzero for failure
Definition at line 129 of file serial.c.
Referenced by usb_init(), usb_puth16(), usb_puth8(), usb_puti(), usb_puts(), and usb_puts_P().
| void usb_puth16 | ( | uint16_t | value | ) |
Print a fixed width hexadecimal representation to USB.
Prints a fixed width hexadecimal representation of an unsigned 16 bit integer in ASCII code to USB. usb_init must be called before this function can be used.
- Parameters:
-
value the value to print
Definition at line 333 of file serial.c.
References hex_digit(), and usb_putc().
| void usb_puth8 | ( | uint8_t | value | ) |
Print a fixed width hexadecimal representation to USB.
Prints a fixed width hexadecimal representation of an unsigned 8 bit integer in ASCII code to USB. usb_init must be called before this function can be used.
- Parameters:
-
value the value to print
- See also:
- usb_init, usb_puti, usb_puts, usb_puth16, hex_digit
Definition at line 350 of file serial.c.
References hex_digit(), and usb_putc().
| int usb_puti | ( | int | value | ) |
Print an integer to USB.
Prints an integer, converted to ASCII, to usb. usb_init must be called before this function can be used.
- Parameters:
-
value the integer to print
- Returns:
- 0 if successful, nonzero otherwise
Definition at line 284 of file serial.c.
References usb_putc().
| int usb_puts | ( | char * | s | ) |
Print a string to USB.
Sends a sequence of characters over USB.
- Parameters:
-
s the string to send
- Returns:
- 0 for success, nonzero for failure
Definition at line 159 of file serial.c.
References usb_putc().
| void usb_puts_P | ( | PGM_P | s | ) |
Print a string from program space to USB.
Sends a sequence of characters from program space over USB.
- Parameters:
-
s the string to send
Definition at line 173 of file serial.c.
References usb_putc().
Generated on Wed Feb 8 00:00:08 2012 for libdragonfly by
1.6.1