Filter results by

Older Versions

Older API versions are available as a download. To view, extract the file and open the index.html file in a web browser.

artik_serial.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2017 Samsung Electronics All Rights Reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing,
12  * software distributed under the License is distributed on an
13  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
14  * either express or implied. See the License for the specific
15  * language governing permissions and limitations under the License.
16  *
17  */
18 
19 #ifndef __ARTIK_SERIAL_H__
20 #define __ARTIK_SERIAL_H__
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 #include "artik_error.h"
27 #include "artik_types.h"
28 
46 #define MAX_NAME_LEN 64
47 
54 typedef void *artik_serial_handle;
55 
56 
67 typedef void (*artik_serial_callback)(void *user_data,
68  unsigned char *buf, int len);
69 
75 typedef enum {
76  ARTIK_SERIAL_BAUD_4800,
77  ARTIK_SERIAL_BAUD_9600,
78  ARTIK_SERIAL_BAUD_14400,
79  ARTIK_SERIAL_BAUD_19200,
80  ARTIK_SERIAL_BAUD_38400,
81  ARTIK_SERIAL_BAUD_57600,
82  ARTIK_SERIAL_BAUD_115200,
83  ARTIK_SERIAL_BAUD_230400,
84  ARTIK_SERIAL_BAUD_460800,
85  ARTIK_SERIAL_BAUD_500000,
86  ARTIK_SERIAL_BAUD_576000,
87  ARTIK_SERIAL_BAUD_921600,
88  ARTIK_SERIAL_BAUD_1000000,
89  ARTIK_SERIAL_BAUD_1152000,
90  ARTIK_SERIAL_BAUD_1500000,
91  ARTIK_SERIAL_BAUD_2000000,
92  ARTIK_SERIAL_BAUD_2500000,
93  ARTIK_SERIAL_BAUD_3000000,
94  ARTIK_SERIAL_BAUD_3500000,
95  ARTIK_SERIAL_BAUD_4000000,
96  ARTIK_SERIAL_BAUD_NUM
98 
104 typedef enum {
105  ARTIK_SERIAL_PARITY_NONE,
106  ARTIK_SERIAL_PARITY_ODD,
107  ARTIK_SERIAL_PARITY_EVEN
109 
115 typedef enum {
116  ARTIK_SERIAL_DATA_7BIT,
117  ARTIK_SERIAL_DATA_8BIT
119 
125 typedef enum {
126  ARTIK_SERIAL_STOP_1BIT,
127  ARTIK_SERIAL_STOP_2BIT
129 
135 typedef enum {
136  ARTIK_SERIAL_FLOWCTRL_NONE,
137  ARTIK_SERIAL_FLOWCTRL_HARD,
138  ARTIK_SERIAL_FLOWCTRL_SOFT
140 
147 typedef struct {
151  unsigned int port_num;
155  char *name;
159  artik_serial_baudrate_t baudrate;
163  artik_serial_parity_t parity;
167  artik_serial_data_bits_t data_bits;
171  artik_serial_stop_bits_t stop_bits;
175  artik_serial_flowcontrol_t flowctrl;
179  void *data_user;
180 
182 
190 typedef struct {
201  artik_error(*request) (artik_serial_handle * handle,
202  artik_serial_config * config);
213  artik_error(*release) (artik_serial_handle handle);
231  artik_error(*read) (artik_serial_handle handle,
232  unsigned char *buf, int *len);
249  artik_error(*write) (artik_serial_handle handle,
250  unsigned char *const msg, int *len);
266  artik_error(*set_received_callback) (artik_serial_handle handle,
267  artik_serial_callback callback, void *user_data);
280  artik_error(*unset_received_callback) (artik_serial_handle handle);
281 
283 
284 extern artik_serial_module serial_module;
285 
286 #ifdef __cplusplus
287 }
288 #endif
289 #endif /* __ARTIK_SERIAL_H__ */
artik_serial_parity_t parity
Parity of the SERIAL module.
Definition: artik_serial.h:163
SERIAL configuration structure.
Definition: artik_serial.h:147
artik_serial_flowcontrol_t flowctrl
Control of the SERIAL module.
Definition: artik_serial.h:175
Custom types.
SERIAL module operations.
Definition: artik_serial.h:190
char * name
Friendly name for the SERIAL module.
Definition: artik_serial.h:155
artik_serial_data_bits_t
SERIAL data bit length type.
Definition: artik_serial.h:115
artik_serial_baudrate_t baudrate
Baudrate of the SERIAL module.
Definition: artik_serial.h:159
artik_serial_stop_bits_t stop_bits
Stop bit of the SERIAL module.
Definition: artik_serial.h:171
artik_serial_parity_t
SERIAL parity type.
Definition: artik_serial.h:104
void * artik_serial_handle
SERIAL handle type.
Definition: artik_serial.h:54
int artik_error
Error type.
Definition: artik_error.h:35
artik_serial_stop_bits_t
SERIAL bit stop type.
Definition: artik_serial.h:125
artik_serial_flowcontrol_t
SERIAL control type.
Definition: artik_serial.h:135
artik_serial_baudrate_t
SERIAL baudrate type.
Definition: artik_serial.h:75
void(* artik_serial_callback)(void *user_data, unsigned char *buf, int len)
SERIAL callback type.
Definition: artik_serial.h:67
void * data_user
Pointer to data for internal use by the API.
Definition: artik_serial.h:179
unsigned int port_num
Port number of the SERIAL in use.
Definition: artik_serial.h:151
Error codes.
artik_serial_data_bits_t data_bits
Data bit length of the SERIAL module.
Definition: artik_serial.h:167
Last updated on: