Contiki-NG
Toggle main menu visibility
Loading...
Searching...
No Matches
usb-serial.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/
3
* Copyright (c) 2020, Alex Stanoev - https://astanoev.com
4
* All rights reserved.
5
*
6
* Redistribution and use in source and binary forms, with or without
7
* modification, are permitted provided that the following conditions
8
* are met:
9
* 1. Redistributions of source code must retain the above copyright
10
* notice, this list of conditions and the following disclaimer.
11
* 2. Redistributions in binary form must reproduce the above copyright
12
* notice, this list of conditions and the following disclaimer in the
13
* documentation and/or other materials provided with the distribution.
14
* 3. Neither the name of the copyright holder nor the names of its
15
* contributors may be used to endorse or promote products derived
16
* from this software without specific prior written permission.
17
*
18
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29
* OF THE POSSIBILITY OF SUCH DAMAGE.
30
*/
31
/**
32
* \addtogroup nrf52840-usb
33
* @{
34
*
35
* \file
36
* Header file for nRF52840's UART-like I/O over USB
37
*/
38
#ifndef USB_SERIAL_H_
39
#define USB_SERIAL_H_
40
41
#include "contiki.h"
42
43
/**
44
* \brief Initialise the Serial-over-USB driver
45
*/
46
void
usb_serial_init
(
void
);
47
48
/**
49
* \brief Write a byte over USB
50
* \param b The byte
51
* \sa usb_serial_flush()
52
*
53
* USB-Serial output is buffered. The buffer is actually submitted to the USB
54
* controller for transmission when:
55
* - It is full or
56
* - The code explicitly calls usb_serial_flush()
57
*/
58
void
usb_serial_writeb
(uint8_t b);
59
60
/**
61
* \brief Set an input hook for bytes received over USB
62
* \param input A pointer to a function to be called when a byte is received
63
*/
64
void
usb_serial_set_input
(
int
(*input)(
unsigned
char
c));
65
66
/**
67
* \brief Immediately transmit the content of Serial-over-USB TX buffers
68
* \sa usb_serial_writeb()
69
*/
70
void
usb_serial_flush
(
void
);
71
72
#endif
/* USB_SERIAL_H_ */
73
74
/** @} */
usb_serial_writeb
void usb_serial_writeb(uint8_t b)
Write a byte over USB.
Definition
usb-serial.c:250
usb_serial_set_input
void usb_serial_set_input(int(*input)(unsigned char c))
Set an input hook for bytes received over USB.
Definition
usb-serial.c:295
usb_serial_flush
void usb_serial_flush()
Immediately transmit the content of Serial-over-USB TX buffers.
Definition
usb-serial.c:234
usb_serial_init
void usb_serial_init()
Initialise the Serial-over-USB process.
Definition
usb-serial.c:301
arch
cpu
nrf52840
usb
usb-serial.h
Generated on
for Contiki-NG by
1.17.0