RockBLOCK 9704 C Library
Doxygen documentation for the RockBLOCK 9704 C Library.
serial.h
Go to the documentation of this file.
1 #ifndef SERIAL_H
2 #define SERIAL_H
3 
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7 
8 #include <stdio.h>
9 #include <stdint.h>
10 #include <stdbool.h>
11 
12 #if defined(_WIN32)
13 #include <io.h>
14 #define access _access
15 #else
16 #include <unistd.h>
17 #endif
18 
19 #define SERIAL_PORT_LENGTH 50U // Should be more than enough, don't want to use PATH_MAX as it will be wasteful
20 
21 // Callback functions which will link to the serial interface
22 typedef bool(*serialInitFunc)();
23 typedef bool(*serialDeInitFunc)();
24 typedef int(*serialReadFunc)(char * bytes, const uint16_t length);
25 typedef int(*serialWriteFunc)(const char * data, const uint16_t length);
26 typedef int(*serialPeekFunc)(void);
27 
28 typedef struct
29 {
35  char serialPort[SERIAL_PORT_LENGTH];
36  uint32_t serialBaud;
38 
40 {
43 };
44 
45 #ifdef __cplusplus
46 }
47 #endif
48 
49 #endif
#define SERIAL_PORT_LENGTH
Definition: serial.h:19
int(* serialWriteFunc)(const char *data, const uint16_t length)
Definition: serial.h:25
int(* serialReadFunc)(char *bytes, const uint16_t length)
Definition: serial.h:24
int(* serialPeekFunc)(void)
Definition: serial.h:26
serialState
Definition: serial.h:40
@ OPEN
Definition: serial.h:42
@ CLOSED
Definition: serial.h:41
bool(* serialDeInitFunc)()
Definition: serial.h:23
bool(* serialInitFunc)()
Definition: serial.h:22
Definition: serial.h:29
serialWriteFunc serialWrite
Definition: serial.h:33
serialPeekFunc serialPeek
Definition: serial.h:34
serialDeInitFunc serialDeInit
Definition: serial.h:31
serialReadFunc serialRead
Definition: serial.h:32
serialInitFunc serialInit
Definition: serial.h:30
uint32_t serialBaud
Definition: serial.h:36