Files | Defines | Functions

# HostInterface functions
[IO Library]

Transmitting bytes between a host computer an the AVR.
More...

## 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_AT90USB (21)
#define | HIF_FT245 (20)
#define | HIF_NONE (0)
#define | HIF_PUTS_NEWLINE() hif_puts_p(FLASH_STRING("\n\r"))
#define | HIF_UART_0 (10)
#define | HIF_UART_1 (11)
#define | PRINT(fmt) hif_echo(FLASH_STRING(fmt))
#define | PRINTF(fmt,...) hif_printf(FLASH_STRING(fmt), __VA_ARGS__)
#define | URACOLI_USB_BCD_RELEASE (0x100)
#define | URACOLI_USB_PID (2183)
#define | URACOLI_USB_PRODUCT_NAME L"RZUSBSTICK"
#define | URACOLI_USB_VENDOR_NAME L"URACOLI"
#define | URACOLI_USB_VID (5824)
## 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 uint32_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.

## Detailed Description

Transmitting bytes between a host computer an the AVR.

## Define Documentation

#define DUMP | ( |  | sz,
|  |  | ptr |
| ) |  |  | hif_dump(sz,ptr)

Wrapper macro for hif_dump()

Definition at line 56 of file hif.h.

#define HIF_AT90USB (21)

Identifier for HIF type USB/ATmega1287

Definition at line 89 of file const.h.

#define HIF_FT245 (20)

Identifier for HIF type USB/FT245

Definition at line 88 of file const.h.

#define HIF_NONE (0)

Identifier for no host interface

Definition at line 85 of file const.h.

#define HIF_UART_0 (10)

Identifier for HIF type UART 0

Definition at line 86 of file const.h.

#define HIF_UART_1 (11)

Identifier for HIF type UART 1

Definition at line 87 of file const.h.

#define PRINT | ( |  | fmt | ) | hif_echo(FLASH_STRING(fmt))

Wrapper macro for hif_echo()

Definition at line 54 of file hif.h.

#define PRINTF | ( |  | fmt,
|  |  | ... |
| ) |  |  | hif_printf(FLASH_STRING(fmt), __VA_ARGS__)

Wrapper macro for hif_printf()

Definition at line 52 of file hif.h.

#define URACOLI_USB_PID (2183)

uracoli USB Product ID see also USB_VID_URACOLI

Definition at line 105 of file const.h.

#define URACOLI_USB_VID (5824)

uracoli USB Vendor ID

The pair of the uracoli vendor id, device id are obtained by

- http://www.voti.nl/pids/
- http://www.frank-buss.de/pid.txt

Definition at line 100 of file const.h.

## Function Documentation

void hif_dump | ( | uint16_t | sz,
|  | uint8_t * | d |
| ) |  |  |

Print hexdump of a data array to the interface.

Parameters:

  | 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.

Parameters:

  | 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.

Parameters:

  | data | buffer where the bytes are stored
  | max_size | maximum number of bytes, which can be stored in the buffer.

Returns:
  number of bytes stored in the buffer

unsigned int hif_getc | ( | void |  | ) |

Get a charakter byte from the host interface.

Returns:
  16 bit value, lower byte contains character, high byte contains error code, if 0, no error occured.

void hif_init | ( | const uint32_t | baudrate | ) |

Initialize host interface.

Parameters:

  | baudrate | data rate of the interface in bit/s

void hif_printf | ( | FLASH_STRING_T | fmt,
|  |  | ... |
| ) |  |  |

Print a formated string to the interface.

Parameters:

  | 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.

Parameters:

  | data | pointer to the data array.
  | size | size of the block.

Returns:
  num number of bytes, which was send.

void hif_putc | ( | unsigned char | data | ) |

Send a character to the interface.

Parameters:

  | data | 8 bit value, which is transfered.

void hif_puts | ( | const char * | s | ) |

Send string to the interface.

Parameters:

  | 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.

Parameters:

  | progmem_s | pointer to a null terminated string, which is located in program memory.