Contiki 2.5
Main Page
Related Pages
Modules
Data Structures
Files
Examples
File List
Globals
platform
msb430
dev
rs232.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2005, Swedish Institute of Computer Science
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 Institute nor the names of its contributors
14
* may be used to endorse or promote products derived from this software
15
* without specific prior written permission.
16
*
17
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
18
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
21
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27
* SUCH DAMAGE.
28
*
29
* This file is part of the Contiki operating system.
30
*
31
* @(#)$Id: rs232.h,v 1.6 2009/06/29 12:46:50 nvt-se Exp $
32
*/
33
34
/** \addtogroup esb
35
* @{ */
36
37
/**
38
* \defgroup esbrs232 ESB RS232
39
*
40
* @{
41
*/
42
43
/**
44
* \file
45
* Header file for MSP430 RS232 driver.
46
* \author Adam Dunkels <adam@sics.se>
47
*
48
*/
49
#ifndef __RS232_H__
50
#define __RS232_H__
51
52
#include "dev/msb430-uart1.h"
53
54
enum
rs232_speed {
55
RS232_9600 = 0,
56
RS232_19200 = 1,
57
RS232_38400 = 2,
58
RS232_57600 = 3,
59
RS232_115200 = 4
60
};
61
62
/**
63
* \brief Initialize the RS232 module
64
*
65
* This function is called from the boot up code to
66
* initalize the RS232 module.
67
*/
68
void
rs232_init
(
void
);
69
70
/**
71
* \brief Set an input handler for incoming RS232 data
72
* \param f A pointer to a byte input handler
73
*
74
* This function sets the input handler for incoming RS232
75
* data. The input handler function is called for every
76
* incoming data byte. The function is called from the
77
* RS232 interrupt handler, so care must be taken when
78
* implementing the input handler to avoid race
79
* conditions.
80
*
81
* The return value of the input handler affects the sleep
82
* mode of the CPU: if the input handler returns non-zero
83
* (true), the CPU is awakened to let other processing
84
* take place. If the input handler returns zero, the CPU
85
* is kept sleeping.
86
*/
87
void
rs232_set_input
(uart_handler_t f);
88
89
/**
90
* \brief Configure the speed of the RS232 hardware
91
* \param speed The speed
92
*
93
* This function configures the speed of the RS232
94
* hardware. The allowed parameters are RS232_9600,
95
* RS232_19200, RS232_38400, RS232_57600, and RS232_115200.
96
*/
97
void
rs232_set_speed
(
enum
rs232_speed speed);
98
99
/**
100
* \brief Print a text string on RS232
101
* \param str A pointer to the string that is to be printed
102
*
103
* This function prints a string to RS232. The string must
104
* be terminated by a null byte. The RS232 module must be
105
* correctly initalized and configured for this function
106
* to work.
107
*/
108
void
rs232_print
(
char
*text);
109
110
/**
111
* \brief Print a character on RS232
112
* \param c The character to be printed
113
*
114
* This function prints a character to RS232. The RS232
115
* module must be correctly initalized and configured for
116
* this function to work.
117
*/
118
void
rs232_send
(
char
c);
119
120
#endif
/* __RS232_H__ */
121
122
/** @} */
123
/** @} */
Generated on Fri Aug 30 2013 12:34:08 for Contiki 2.5 by
1.8.3.1