42 #include <avr/pgmspace.h>
49 #define FLASH_STRING_T PGM_P
50 #define FLASH_STRING(x) PSTR(x)
52 #if HIF_TYPE != HIF_NONE || defined DOXYGEN
54 # define PRINTF(fmt, ...) hif_printf(FLASH_STRING(fmt), __VA_ARGS__)
56 # define PRINT(fmt) hif_echo(FLASH_STRING(fmt))
58 # define DUMP(sz,ptr) hif_dump(sz,ptr)
59 # define HIF_PUTS_NEWLINE() hif_puts_p(FLASH_STRING("\n\r"))
61 # define PRINTF(fmt, ...)
64 # define HIF_PUTS_NEWLINE()
75 void hif_init(
const uint32_t baudrate);
100 uint8_t
hif_put_blk(
unsigned char *data, uint8_t size);
131 void hif_dump(uint16_t sz, uint8_t *d);
147 uint8_t
hif_get_blk(
unsigned char *data, uint8_t max_size);
164 uint8_t argc = 0, nextarg = 1;
166 while((*txtline !=0) && (argc < maxargs))
177 argv[argc] = txtline;
202 if (c ==
'\n' || c ==
'\r')
207 else if (c ==
'-' && scale == 0)
211 else if (
'0' <= c || c >=
'9' )
217 rv = 10 * rv + (c -
'0');
249 buf[idx++] = (char) tmp & 0xff;
254 while( (tmp !=
'\n') && (tmp !=
'\r') && (idx < 7) );
255 return (uint16_t)strtol(buf, NULL, base);
static uint16_t hif_get_number(int8_t base)
void hif_puts_p(const char *progmem_s)
Send a programm memory 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.
int hif_putc(int c)
Send a character to the interface.
void hif_printf(FLASH_STRING_T fmt,...)
Print a formated string to the interface.
void hif_puts(const char *s)
Send string to the interface.
static int hif_split_args(char *txtline, int maxargs, char **argv)
Split a null terminated string.
void hif_init(const uint32_t baudrate)
Initialize host interface.
uint8_t hif_put_blk(unsigned char *data, uint8_t size)
Send a block of characters to the interface.
int hif_getc(void)
Get a charakter byte from the host interface.
static int hif_get_dec_number(void)
Read a decimal number with hif_getc()
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.