Demo HCI Implementation for WiMOD-LR Devices
V2.0.3
SerialBuffer.h
Go to the documentation of this file.
1
/*
2
* SerialBuffer.h
3
*
4
* Created on: Mar 5, 2019
5
*/
6
7
//------------------------------------------------------------------------------
37
//------------------------------------------------------------------------------
38
39
40
#ifndef _UTILS_SERIALBUFFER_H_
41
#define _UTILS_SERIALBUFFER_H_
42
43
//------------------------------------------------------------------------------
44
// Section Includes Files
45
//------------------------------------------------------------------------------
46
47
#include <stdint.h>
48
#include <stdbool.h>
49
50
//------------------------------------------------------------------------------
51
// Section Defines
52
//------------------------------------------------------------------------------
53
54
#define SERIAL_BUFFER_SIZE 32 // must be 2^x!!
55
#define SERIAL_BUFFER_MASK ( SERIAL_BUFFER_SIZE - 1 )
56
57
#if ( SERIAL_BUFFER_SIZE & SERIAL_BUFFER_MASK )
58
#error Buffer size is not a power of 2
59
#endif
60
61
//------------------------------------------------------------------------------
62
// Section Macros
63
//------------------------------------------------------------------------------
64
65
66
//------------------------------------------------------------------------------
67
// Section Typedefs
68
//------------------------------------------------------------------------------
69
70
//------------------------------------------------------------------------------
71
//
72
// Section Prototypes
73
//
74
//------------------------------------------------------------------------------
75
76
77
class
SerialBuffer
{
78
public
:
79
SerialBuffer
(
void
);
80
81
bool
isFreeSpaceAvailable(
void
);
82
bool
putByte(uint8_t data);
83
bool
isDataAvailable(
void
);
84
uint8_t getByte(
void
);
85
uint16_t getNbrAvailBytes(
void
);
86
protected
:
87
private
:
88
uint8_t Buffer[SERIAL_BUFFER_SIZE];
89
uint16_t Head;
90
uint16_t Tail;
91
uint16_t pendingBytes;
92
93
};
94
95
#endif
/* _UTILS_SERIALBUFFER_H_ */
SerialBuffer.h
SerialBuffer
Definition:
SerialBuffer.h:77
utils
SerialBuffer.h
Generated on Tue Dec 12 2023 11:11:33 for Demo HCI Implementation for WiMOD-LR Devices by
1.8.17