Contiki-NG
cc26xx-uart.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. Neither the name of the copyright holder nor the names of its
14 * contributors may be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28 * OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30/**
31 * \addtogroup cc26xx
32 * @{
33 *
34 * \defgroup cc26xx-uart CC13xx/CC26xx UARTs
35 *
36 * Driver for the CC13xx/CC26xx UART controller
37 * @{
38 *
39 * \file
40 * Header file for the CC13xx/CC26xx UART driver
41 */
42#ifndef CC26XX_UART_H_
43#define CC26XX_UART_H_
44
45#include <stdint.h>
46/*---------------------------------------------------------------------------*/
47/** \name UART functions
48 * @{
49 */
50
51/**
52 * \brief Initialises the UART controller, configures I/O control
53 * and interrupts
54 */
55void cc26xx_uart_init();
56
57/**
58 * \brief Sends a single character down the UART
59 * \param b The character to transmit
60 */
61void cc26xx_uart_write_byte(uint8_t b);
62
63/**
64 * \brief Assigns a callback to be called when the UART receives a byte
65 * \param input A pointer to the function
66 *
67 * If \e input is NULL, the UART driver will assume that RX functionality is
68 * not required and it will be disabled. It will also disable the module's
69 * clocks under sleep and deep sleep and allow the SERIAL PD to be powered off.
70 *
71 * If \e input is not NULL, the UART driver will assume that RX is in fact
72 * required and it will be enabled. The module's clocks will be enabled under
73 * sleep and deep sleep and the driver will not allow the SERIAL PD to turn
74 * off during deep sleep, so that the UART can still receive bytes.
75 *
76 * \note This has a significant impact on overall energy consumption, so you
77 * should only enabled UART RX input when it's actually required.
78 */
79void cc26xx_uart_set_input(int (*input)(unsigned char c));
80
81/**
82 * \brief Returns the UART busy status
83 * \return UART_IDLE or UART_BUSY
84 *
85 * ti_lib_uart_busy() will access UART registers. It is our responsibility
86 * to first make sure the UART is accessible before calling it. Hence this
87 * wrapper.
88 *
89 * Return values are defined in CC26xxware's uart.h
90 */
91uint8_t cc26xx_uart_busy(void);
92/** @} */
93/*---------------------------------------------------------------------------*/
94#endif /* CC26XX_UART_H_ */
95
96/**
97 * @}
98 * @}
99 */
void cc26xx_uart_init()
Initialises the UART controller, configures I/O control and interrupts.
Definition: cc26xx-uart.c:265
void cc26xx_uart_set_input(int(*input)(unsigned char c))
Assigns a callback to be called when the UART receives a byte.
Definition: cc26xx-uart.c:310
void cc26xx_uart_write_byte(uint8_t c)
Sends a single character down the UART.
Definition: cc26xx-uart.c:295
uint8_t cc26xx_uart_busy(void)
Returns the UART busy status.
Definition: cc26xx-uart.c:344
static void input(void)
Process a received 6lowpan packet.
Definition: sicslowpan.c:1833