AFBR-S50 API Reference Manual v1.5.6
AFBR-S50 Time-of-Flight Sensor SDK for Embedded Software
Loading...
Searching...
No Matches
sci_internal_types.h
Go to the documentation of this file.
1/*************************************************************************/
38#ifndef SCI_INTERNAL_TYPES_H
39#define SCI_INTERNAL_TYPES_H
40
41/*!***************************************************************************
42 * @addtogroup sci
43 * @{
44 *****************************************************************************/
45
46#include <stddef.h>
47#include <stdint.h>
48#include <stdbool.h>
49
51#ifndef SCI_FRAME_SIZE
52#define SCI_FRAME_SIZE 64
53#endif
54
56#ifndef SCI_FRAME_BUF_RX_CT
57#define SCI_FRAME_BUF_RX_CT 32
58#endif
59
61#ifndef SCI_FRAME_BUF_TX_CT
62#define SCI_FRAME_BUF_TX_CT 32
63#endif
64
66#ifndef SCI_TX_TIMEOUT_MSEC
67#define SCI_TX_TIMEOUT_MSEC 1000
68#endif
69
71#define SCI_FRAME_BUF_CT (SCI_FRAME_BUF_RX_CT + SCI_FRAME_BUF_TX_CT)
72
73/*!*****************************************************************************
74 * @brief Data buffer for outgoing frames.
75 * @details A frame needs to be initialize with an data buffer and read/write
76 * pointers equal to zero.
77 * Status of the frame can be determined by the following conditions:
78 * - Idle: WrPtr == 0 && RdPtr == 0
79 * - Write/Read: WrPtr != 0 (|| RdPtr == 0)
80 * .
81 * The total amount of stored data is given by (size_t)(WrPtr - Buffer)
82 * The amount that is still to read is given by (size_t)(WrPtr - RdPtr)
83 *
84 * \code
85 * Idle:
86 * Buffer: 0000000000000000
87 * Write: | (0x00)
88 * Read: | (0x00)
89 *
90 *
91 * Write:
92 * Buffer: xxxxxxxx00000000
93 * Write: |
94 * Read: | (&Buffer)
95 *
96 *
97 * Read:
98 * Buffer: 0000xxxxxxxx0000
99 * Write: |
100 * Read: |
101 *
102 * (0 = empty; x = full)
103 * \endcode
104 *
105 * In order to accomplish flexible frame length, the frames might link
106 * to another frame which will be sent right after the current one has
107 * completely sent.
108 ******************************************************************************/
109typedef struct sci_frame_t
110{
112 uint8_t * WrPtr;
113
115 uint8_t * RdPtr;
116
118 uint8_t * Buffer;
119
122
124
126typedef struct sci_frame_queue_t
127{
130
133
135 volatile size_t Load;
136
138 size_t Size;
139
141
143#endif // SCI_INTERNAL_TYPES_H
Definition sci_internal_types.h:127
size_t Size
Definition sci_internal_types.h:138
sci_frame_t * Buff
Definition sci_internal_types.h:129
sci_frame_t * Head
Definition sci_internal_types.h:132
volatile size_t Load
Definition sci_internal_types.h:135
Data buffer for outgoing frames.
Definition sci_internal_types.h:110
uint8_t * WrPtr
Definition sci_internal_types.h:112
uint8_t * RdPtr
Definition sci_internal_types.h:115
uint8_t * Buffer
Definition sci_internal_types.h:118
struct sci_frame_t * Next
Definition sci_internal_types.h:121