Lazuli
serial.h
Go to the documentation of this file.
1 /*
2  * SPDX-License-Identifier: GPL-3.0-only
3  * This file is part of Lazuli.
4  */
5 
18 #ifndef LAZULI_SERIAL_H
19 #define LAZULI_SERIAL_H
20 
21 #include <Lazuli/common.h>
22 
24 
35 
40 
45 
50 };
51 
62  __LZ_SERIAL_STOP_BITS_ENUM_BEGIN = -1,
63 
70 
75 
82  __LZ_SERIAL_STOP_BITS_ENUM_END
83 
85 };
86 
97  __LZ_SERIAL_PARITY_BIT_ENUM_BEGIN = -1,
98 
105 
110 
115 
122  __LZ_SERIAL_PARITY_BIT_ENUM_END
123 
125 };
126 
137  __LZ_SERIAL_SIZE_ENUM_BEGIN = -1,
138 
145 
150 
155 
160 
167  __LZ_SERIAL_SIZE_ENUM_END
168 
170 };
171 
182  __LZ_SERIAL_SPEED_ENUM_BEGIN = -1,
183 
190 
195 
200 
205 
212  __LZ_SERIAL_SPEED_ENUM_END
213 
215 };
216 
222 typedef struct {
226  enum Lz_SerialEnableFlags enableFlags;
227 
231  enum Lz_SerialStopBits stopBits;
232 
236  enum Lz_SerialParityBit parityBit;
237 
241  enum Lz_SerialSize size;
242 
246  enum Lz_SerialSpeed speed;
248 
258 void
259 Lz_Serial_GetConfiguration(Lz_SerialConfiguration * const serialConfiguration);
260 
275 void
276 Lz_Serial_SetConfiguration(Lz_SerialConfiguration * const serialConfiguration);
277 
279 
280 #endif /* LAZULI_SERIAL_H */
Enable serial transmission.
Definition: serial.h:39
Use 6-bit character size on serial line.
Definition: serial.h:149
Use a 4800 baud rate on the serial line.
Definition: serial.h:194
#define _EXTERN_C_DECL_BEGIN
Open C++ header file declarations.
Definition: common.h:37
Use a 19200 baud rate on the serial line.
Definition: serial.h:204
Enable serial reception.
Definition: serial.h:44
Use 8-bit character size on serial line.
Definition: serial.h:159
Disable both serial transmission and reception.
Definition: serial.h:34
Use 5-bit character size on serial line.
Definition: serial.h:144
#define POSITION(X)
Define a constant bit at position X, starting from index 0.
Definition: common.h:174
Lz_SerialSize
Define the size of the character used on serial line.
Definition: serial.h:130
Lz_SerialParityBit
Define the kind of parity bit to use on serial line.
Definition: serial.h:90
Use 2 stop bits.
Definition: serial.h:74
void Lz_Serial_GetConfiguration(Lz_SerialConfiguration *const serialConfiguration)
Retrieve the configuration of the serial line.
Definition: serial.c:20
Lz_SerialEnableFlags
Define flags for enabling/disabling serial transmission/reception.
Definition: serial.h:30
Use a 2400 baud rate on the serial line.
Definition: serial.h:189
Use no parity bit.
Definition: serial.h:104
Use 1 stop bit.
Definition: serial.h:69
Use 7-bit character size on serial line.
Definition: serial.h:154
Enable both serial transmission and reception.
Definition: serial.h:49
Use even parity bit.
Definition: serial.h:109
Lz_SerialSpeed
Define the baud rate of the serial line.
Definition: serial.h:175
Use odd parity bit.
Definition: serial.h:114
Use a 9600 baud rate on the serial line.
Definition: serial.h:199
Represents the configuration of a serial interface.
Definition: serial.h:222
void Lz_Serial_SetConfiguration(Lz_SerialConfiguration *const serialConfiguration)
Set the configuration of the serial line.
Definition: serial.c:32
Lz_SerialStopBits
Define the number of stop bits to use on serial line.
Definition: serial.h:55
Basic type definitions and useful macros.
#define _EXTERN_C_DECL_END
Close C++ header file declarations.
Definition: common.h:42