Llosa de Viango Tollos – tollosVCom.c

Introduction

Features

Getting started

Download


Libraries

  Tollos libraries

  Device libraries

    boards

    microcontrollers

    peripherals


Background

  Sample application

  Troubleshooting

tollosVCom.c – USB Virtual COM port functions

The vcom functions provide character I/O over a USB Virtual COM port.

It is assumed that there is a primary, or only one, USB link so these functions do not specify a device number.
Functions
 vcomGetc   get character from vcom device
 vcomInit   initialize serial vcom device
 vcomPutc   send character to vcom device
 vcomStop   stop the vcom device

vcomGetc – get character from vcom device

int vcomGetc(void);

returns character read from vcom, or −1 if none there or vcom has not been initialized

This function does not block. It returns an int so that errors are distinct, and will also allow extension.

vcomInit – initialize serial vcom device

int vcomInit(void);

returns 0 if OK, negative if interrupt already in use

This does not switch a software connection as this is device-dependent (port, pin, and direction), so the caller should use bitSet to make the connection before calling this.

vcomPutc – send character to vcom device

int vcomPutc(int ch);

ch – character to send

returns 0 if OK, or −1 if vcom has not been initialized, or

−2 if there is a data overrun (bytes have been queued faster

than they could be sent to the host)

This function does not block.

Note that this must not be called from an interrupt handler that has a higher priority than USB.

vcomStop – stop the vcom device

void vcomStop(void);

This does not switch a software connection because this is device-dependent (port, pin, and direction), so the caller should use bitSet to make the connection an input after calling this.

vcomStop has no effect if vcom has not been initialized.

Tollos and these web pages were written by Mike Cowlishaw; Please send me any corrections, suggestions, etc.
All content © Mike Cowlishaw, 2010–2012, except where marked otherwise. All rights reserved. The pages here are for non-commercial use only (see the separate licence for Tollos source code). Privacy policy: the Speleotrove website records no personal information and sets no ‘cookies’. However, statistics, etc. might be recorded by the web hosting service.

This page was last updated on 2010-12-20 by c2wiki.