Contiki-NG
Toggle main menu visibility
Loading...
Searching...
No Matches
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
*/
32
33
34
/**
35
* \file
36
* Header file for COOJA RS232 driver.
37
* \author Adam Dunkels <adam@sics.se>
38
*
39
*/
40
#ifndef RS232_H_
41
#define RS232_H_
42
43
44
#define RS232_19200 1
45
#define RS232_38400 2
46
#define RS232_57600 3
47
#define RS232_115200 4
48
49
/**
50
* \brief Initialize the RS232 module
51
*
52
* This function is called from the boot up code to
53
* initalize the RS232 module.
54
*/
55
void
rs232_init
(
void
);
56
57
/**
58
* \brief Set an input handler for incoming RS232 data
59
* \param f A pointer to a byte input handler
60
*
61
* This function sets the input handler for incoming RS232
62
* data. The input handler function is called for every
63
* incoming data byte. The function is called from the
64
* RS232 interrupt handler, so care must be taken when
65
* implementing the input handler to avoid race
66
* conditions.
67
*
68
* The return value of the input handler affects the sleep
69
* mode of the CPU: if the input handler returns non-zero
70
* (true), the CPU is awakened to let other processing
71
* take place. If the input handler returns zero, the CPU
72
* is kept sleeping.
73
*/
74
void
rs232_set_input
(
int
(* f)(
unsigned
char
));
75
76
/**
77
* \brief Configure the speed of the RS232 hardware
78
* \param speed The speed
79
*
80
* This function configures the speed of the RS232
81
* hardware. The allowed parameters are RS232_19200,
82
* RS232_38400, RS232_57600, and RS232_115200.
83
*/
84
void
rs232_set_speed
(
unsigned
char
speed);
85
86
/**
87
* \brief Print a text string on RS232
88
* \param text A pointer to the string that is to be printed
89
*
90
* This function prints a string to RS232. The string must
91
* be terminated by a null byte. The RS232 module must be
92
* correctly initalized and configured for this function
93
* to work.
94
*/
95
void
rs232_print
(
char
*text);
96
97
/**
98
* \brief Print a character on RS232
99
* \param c The character to be printed
100
*
101
* This function prints a character to RS232. The RS232
102
* module must be correctly initalized and configured for
103
* this function to work.
104
*/
105
void
rs232_send
(
char
c);
106
107
#endif
/* RS232_H_ */
108
rs232_send
void rs232_send(char c)
Print a character on RS232.
Definition
rs232.c:59
rs232_set_input
void rs232_set_input(int(*f)(unsigned char))
Set an input handler for incoming RS232 data.
Definition
rs232.c:54
rs232_print
void rs232_print(char *text)
Print a text string on RS232.
Definition
rs232.c:64
rs232_set_speed
void rs232_set_speed(unsigned char speed)
Configure the speed of the RS232 hardware.
Definition
rs232.c:51
rs232_init
void rs232_init(void)
Initialize the RS232 module.
Definition
rs232.c:49
arch
platform
cooja
dev
rs232.h
Generated on
for Contiki-NG by
1.17.0