embedded system library for e-puck  1.0.1
A redesigned API library for the e-puck robot platform
 All Data Structures Files Functions Variables Enumerations Enumerator Modules Pages
el_uart.h
Go to the documentation of this file.
1 /*
2 
3 embedded system library for e-puck
4 
5 --------------------------------------------------------------------------------
6 
7 code distribution:
8 https://github.com/jianingchen/epucklib
9 
10 online documentation:
11 http://jianingchen.github.io/epucklib/html/
12 
13 --------------------------------------------------------------------------------
14 
15 This file is released under the terms of the MIT license (see "el.h").
16 
17 */
18 
40 #ifndef EL_UART_H
41 #define EL_UART_H
42 
43 #include "el_common.h"
44 
45 #define EL_UART_1 0
46 #define EL_UART_2 1
47 #define EL_UART_BLUETOOTH EL_UART_1
48 
49 
64 void el_uart_use_reset_code(el_bool k,el_int8 x);
65 
66 
76 void el_uart_send_char(el_index ch,char c);
77 
78 
88 void el_uart_send_string(el_index ch,const char*str);
89 
90 
99 bool el_uart_is_sending(el_index ch);
100 
101 
110 el_uint16 el_uart_get_char_counter(el_index ch);
111 
112 
121 char el_uart_get_char(el_index ch);
122 
123 
130 void el_uart_flush_char(el_index ch);
131 
132 
149 el_uint16 el_uart_get_string(el_index ch,char*buf,el_uint16 buf_size,el_bool return_line);
150 
151 
160 char el_uart_peek_first_char(el_index ch);
161 
162 
171 char el_uart_peek_last_char(el_index ch);
172 
173 
180 void el_uart_erase_last_char(el_index ch);
181 
182 
183 /*
184 --------------------------------------------------------------------------------
185 */
186 
187 
188 #ifdef EL_INCLUDE_LIB_INTERNAL_CONTEXT
189 
190 #define EL_UART_NEWLINE_CRLF
191 
192 #define EL_UART_BAUDRATE 115200
193 #define EL_UART_TX_BUF_DIM 80
194 #define EL_UART_RX_BUF_DIM 64
195 
196 extern volatile el_bool el_uart_reset_code_enable;
197 extern el_uint8 el_uart_reset_code;
198 extern el_uint16 el_uart1_tx_counter;
199 extern char*el_uart1_tx_pointer;
200 extern char el_uart1_tx_buffer[EL_UART_TX_BUF_DIM];
201 extern volatile el_uint8 el_uart1_rx_buf_i;
202 extern volatile el_uint8 el_uart1_rx_buf_o;
203 extern char el_uart1_rx_buffer[EL_UART_RX_BUF_DIM];
204 
205 void el_init_uart();
206 void el_uart1_tx_clear();
207 void el_uart1_tx_issue();
208 void el_uart2_tx_clear();
209 void el_uart2_tx_issue();
210 
211 #endif
212 
213 #endif /* EL_UART_H */
void el_uart_send_char(el_index ch, char c)
Send one byte of data to the serial channel.
el_uint16 el_uart_get_string(el_index ch, char *buf, el_uint16 buf_size, el_bool return_line)
Get a string ended with a null (0 or '\0') or a carriage-return ('\r', (the "Enter" key)...
void el_uart_use_reset_code(el_bool k, el_int8 x)
Setup a value that: upon receiving that value, reset the chip.
void el_uart_send_string(el_index ch, const char *str)
Send a string (an array of char terminated by a null) to the serial channel.
el_uint16 el_uart_get_char_counter(el_index ch)
Check how many bytes are received and buffered in the channel.
char el_uart_peek_first_char(el_index ch)
Check the first byte in the receiving buffer, but does not remove it from the buffer.
char el_uart_peek_last_char(el_index ch)
Check the last byte in the receiving buffer but do not remove it from the buffer. ...
void el_uart_flush_char(el_index ch)
Totally clear up the receiving buffer of a serial channel.
char el_uart_get_char(el_index ch)
Take out one byte from the receiving buffer in order of first-in-first-out.
void el_uart_erase_last_char(el_index ch)
Remove the last byte received in the receiving buffer.
bool el_uart_is_sending(el_index ch)
Check whether the transmission issued in the last sending function is finished.