2.3 User Defined Functions: userFnc.h

The user must implement the following functions and these functions will typically interface to a serial port to read a character or transmit a message, and depend on the platform where the USI Host runs.


    /**@brief Open communication port (parameters are defined in PrjCfg.h) 
      @param port_type: Port Type (UART_TYPE, USART_TYPE, COM_TYPE)
      @param commPort: Physical Communication Port
      @param speed:Communication speed
      @return 0 on success.
    */
    int8_t addUsi_Open(uint8_t port_type, uint8_t port, uint32_t bauds);

    /**@brief Transmit a message through the interface
      @param port: port number configured in PrjCfg.h
      @param msg: buffer holding the message
      @param msglen:buffer length
      @return the number of bytes written.
    */
    uint16_t addUsi_TxMsg(uint8_t port, uint8_t *msg, uint16_t msglen);
    
    /**@brief Read char from port
      @param port: port number configured in PrjCfg.h
      @param c: pointer to a character       
      @return 0 if a charater has been read, otherwise -1.
    */
    int8_t addUsi_RxChar(uint8_t port, uint8_t *c);