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. |
Low level functions for USB input and output.
uint8_t hex_digit | ( | uint8_t | value | ) |
Determine a hexadecimal digit.
Determines a hexadecimal digit in ASCII code.
value | the value of the digit (0<=value<=15) |
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.
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.
c | the received character. This will be set if a character has been received. |
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.
References usb_fd, usb_getc(), and usb_putc().
Referenced by dragonfly_init().
int usb_putc | ( | char | c | ) |
Print a character to USB.
Sends a character over USB.
c | the character to send |
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.
value | the value to print |
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.
value | the value to print |
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.
value | the integer to print |
References usb_putc().
int usb_puts | ( | char * | s | ) |
Print a string to USB.
Sends a sequence of characters over USB.
s | the string to send |
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.
s | the string to send |
References usb_putc().