Files | |
file | hif.h |
Interface for HostInterface functions. | |
Defines | |
#define | DUMP(sz, ptr) hif_dump(sz,ptr) |
#define | FLASH_STRING(x) PSTR(x) |
#define | FLASH_STRING_T PGM_P |
#define | HIF_PUTS_NEWLINE() hif_puts_p(FLASH_STRING("\n\r")) |
#define | PRINT(fmt) hif_echo(FLASH_STRING(fmt)) |
#define | PRINTF(fmt,...) hif_printf(FLASH_STRING(fmt), __VA_ARGS__) |
Functions | |
void | hif_dump (uint16_t sz, uint8_t *d) |
Print hexdump of a data array to the interface. | |
void | hif_echo (FLASH_STRING_T str) |
Print a string to the interface. | |
uint8_t | hif_get_blk (unsigned char *data, uint8_t max_size) |
Get a block of bytes from the host interface. | |
unsigned int | hif_getc (void) |
Get a charakter byte from the host interface. | |
void | hif_init (const uint16_t baudrate) |
Initialize host interface. | |
void | hif_printf (FLASH_STRING_T fmt,...) |
Print a formated string to the interface. | |
uint8_t | hif_put_blk (unsigned char *data, uint8_t size) |
Send a block of characters to the interface. | |
void | hif_putc (unsigned char data) |
Send a character to the interface. | |
void | hif_puts (const char *s) |
Send string to the interface. | |
void | hif_puts_p (const char *progmem_s) |
Send a programm memory string to the interface. | |
static int | hif_split_args (char *txtline, int maxargs, char **argv) |
Split a null terminated string. |
#define DUMP | ( | sz, | |||
ptr | ) | hif_dump(sz,ptr) |
Wrapper macro for hif_dump()
#define PRINT | ( | fmt | ) | hif_echo(FLASH_STRING(fmt)) |
Wrapper macro for hif_echo()
#define PRINTF | ( | fmt, | |||
... | ) | hif_printf(FLASH_STRING(fmt), __VA_ARGS__) |
Wrapper macro for hif_printf()
void hif_dump | ( | uint16_t | sz, | |
uint8_t * | d | |||
) |
Print hexdump of a data array to the interface.
sz | number of bytes, that will be dumped. | |
d | pointer to the data array, that will be dumped. |
void hif_echo | ( | FLASH_STRING_T | str | ) |
Print a string to the interface.
str | string, which is located in flash memory |
uint8_t hif_get_blk | ( | unsigned char * | data, | |
uint8_t | max_size | |||
) |
Get a block of bytes from the host interface.
data | buffer where the bytes are stored | |
max_size | maximum number of bytes, which can be stored in the buffer. |
unsigned int hif_getc | ( | void | ) |
Get a charakter byte from the host interface.
void hif_init | ( | const uint16_t | baudrate | ) |
Initialize host interface.
baudrate | data rate of the interface in bit/s |
void hif_printf | ( | FLASH_STRING_T | fmt, | |
... | ||||
) |
Print a formated string to the interface.
fmt | format string, which is located in flash memory | |
... | variable argument list |
uint8_t hif_put_blk | ( | unsigned char * | data, | |
uint8_t | size | |||
) |
Send a block of characters to the interface.
data | pointer to the data array. | |
size | size of the block. |
void hif_putc | ( | unsigned char | data | ) |
Send a character to the interface.
data | 8 bit value, which is transfered. |
void hif_puts | ( | const char * | s | ) |
Send string to the interface.
s | pointer to a null terminated string, which is located in RAM. |
void hif_puts_p | ( | const char * | progmem_s | ) |
Send a programm memory string to the interface.
progmem_s | pointer to a null terminated string, which is located in program memory. |
static int hif_split_args | ( | char * | txtline, | |
int | maxargs, | |||
char ** | argv | |||
) | [static] |
Split a null terminated string.
This function creates argc,argv style data from a null terminated string. The splitting is done on the base of spaces (ASCII 32).
txtline | string to split | |
maxargs | maximum number of arguments to split |
argv | array of pointers, that store the arguments |