osd-contiki/platform/cc2530dk/dev/usb-serial.h
George Oikonomou 2cc74c5fd4 cc2530dk: Added a 'Serial over USB' platform process
This is based on a usb-test example by Philippe Retornaz. It has
been moved to platform and modified accordingly. With this in place:

- putchar() can work over USB. So we can use things like
  printf, slip output
- USB input can be redirected to slip or serial input

The example itself is no longer needed in the source tree

See Pull Request #18
2012-11-01 17:41:53 +00:00

57 lines
2.2 KiB
C

/*
* Copyright (c) 2012, George Oikonomou (oikonomou@users.sourceforge.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This file is part of the Contiki operating system.
*/
/**
* \file
* Header file for cc2531's UART-like I/O over USB
*
* With it in place, putchar can be redirected to the USB and USB
* incoming traffic can be handled as input
*
* \author
* George Oikonomou - <oikonomou@users.sourceforge.net>
*/
#ifndef USB_SERIAL_H_
#define USB_SERIAL_H_
#include "contiki.h"
void usb_serial_init(void);
void usb_serial_writeb(uint8_t);
void usb_serial_set_input(int (*input)(unsigned char c));
#if USB_SERIAL_CONF_BUFFERED
void usb_serial_flush(void);
#else
#define usb_serial_flush()
#endif
#endif /* USB_SERIAL_H_ */