xmpl_hif.c - Using the Host Interface Functions

Host Interface Library Example

/* $Id: pgXmplHif.html,v 2013/04/09 21:11:54 awachtler Exp $ */
/* Example for use of the HIF functions */

#include "board.h"
#include "hif.h"
#include "xmpl.h"

#define PROMPT() PRINTF("\n\ruracoli[%02d]> ",lc++)

int main(void)
 int inchar;
 const uint32_t br = HIF_DEFAULT_BAUDRATE;
 uint8_t lc = 0;
 uint8_t msg[] = { 0x57, 0x65, 0x6c, 0x63, 0x6f, 0x6d, 0x65, 0x20,
                   0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x77,
                   0x6f, 0x72, 0x6c, 0x64, 0x20, 0x6f, 0x66, 0x20,
                   0xb5, 0x72, 0x61, 0x63, 0x6f, 0x6c, 0x69, 0x21,

    /* setting up UART and adjusting the baudrate */

     * Wait for terminal user pressing a key so there is time to
     * attach a terminal emulator after the virtual serial port has
     * been established within the host OS.
        inchar = hif_getc();
    while (EOF == inchar);

Application Description

The programm dumps at first a view text lines to the host interface, then waiting for input data. All characters received are echoed, except for '\n' and '\r' which where treated as line break, printing out a prompt with the current line number in square brackets.

This is an example screenshot of the terminal window, with the output of tree command, redirected to the HIF.


Screenshot of terminal window.

This documentation for µracoli was generated on Tue Apr 9 2013 by  doxygen 1.7.1