22*
33* MIT License
44*
5- * Copyright (c) 2022 awawa-dev
5+ * Copyright (c) 2023 awawa-dev
66*
77* https://github.com/awawa-dev/HyperSerialEsp8266
88*
3030
3131/* *
3232 * @brief my AWA frame protocol definition
33- *
33+ *
3434 */
3535enum class AwaProtocol
3636{
@@ -53,7 +53,7 @@ enum class AwaProtocol
5353
5454/* *
5555 * @brief Contains current state of the incoming frame
56- *
56+ *
5757 */
5858class
5959{
@@ -65,13 +65,13 @@ class
6565 uint16_t fletcher1 = 0 ;
6666 uint16_t fletcher2 = 0 ;
6767
68- public :
68+ public:
6969 ColorDefinition color;
7070
7171 /* *
7272 * @brief Reset statistics for new frame
73- *
74- * @param input
73+ *
74+ * @param input
7575 */
7676 inline void init (byte input)
7777 {
8484
8585 /* *
8686 * @brief get computed CRC
87- *
88- * @return uint8_t
87+ *
88+ * @return uint8_t
8989 */
9090 inline uint8_t getCRC ()
9191 {
9494
9595 /* *
9696 * @brief Get the color count reported by the frame
97- *
98- * @return uint16_t
97+ *
98+ * @return uint16_t
9999 */
100100 inline uint16_t getCount ()
101101 {
@@ -104,8 +104,8 @@ class
104104
105105 /* *
106106 * @brief Get the Fletcher1 total sum
107- *
108- * @return uint16_t
107+ *
108+ * @return uint16_t
109109 */
110110 inline uint16_t getFletcher1 ()
111111 {
@@ -114,8 +114,8 @@ class
114114
115115 /* *
116116 * @brief Get the Fletcher2 total sum
117- *
118- * @return uint16_t
117+ *
118+ * @return uint16_t
119119 */
120120 inline uint16_t getFletcher2 ()
121121 {
@@ -124,8 +124,8 @@ class
124124
125125 /* *
126126 * @brief Get and increase the current Led index
127- *
128- * @return uint16_t
127+ *
128+ * @return uint16_t
129129 */
130130 inline uint16_t getCurrentLedIndex ()
131131 {
@@ -134,8 +134,8 @@ class
134134
135135 /* *
136136 * @brief Set if frame protocol version 2 (contains calibration data)
137- *
138- * @param newVer
137+ *
138+ * @param newVer
139139 */
140140 inline void setProtocolVersion2 (bool newVer)
141141 {
@@ -144,9 +144,9 @@ class
144144
145145 /* *
146146 * @brief Verify if frame protocol version 2 (contains calibration data)
147- *
148- * @return true
149- * @return false
147+ *
148+ * @return true
149+ * @return false
150150 */
151151 inline bool isProtocolVersion2 ()
152152 {
@@ -155,8 +155,8 @@ class
155155
156156 /* *
157157 * @brief Set new AWA frame state
158- *
159- * @param newState
158+ *
159+ * @param newState
160160 */
161161 inline void setState (AwaProtocol newState)
162162 {
@@ -165,18 +165,18 @@ class
165165
166166 /* *
167167 * @brief Get current AWA frame state
168- *
169- * @return AwaProtocol
168+ *
169+ * @return AwaProtocol
170170 */
171171 inline AwaProtocol getState ()
172172 {
173173 return state;
174- }
174+ }
175175
176176 /* *
177177 * @brief Update CRC based on current and previuos input
178- *
179- * @param input
178+ *
179+ * @param input
180180 */
181181 inline void computeCRC (byte input)
182182 {
@@ -186,8 +186,8 @@ class
186186
187187 /* *
188188 * @brief Update Fletcher checksumn for incoming input
189- *
190- * @param input
189+ *
190+ * @param input
191191 */
192192 inline void addFletcher (byte input)
193193 {
@@ -197,23 +197,23 @@ class
197197
198198 /* *
199199 * @brief Check if the calibration data was updated and calculate new one
200- *
201- */
200+ *
201+ */
202202 inline void updateIncomingCalibration ()
203203 {
204204 #ifdef NEOPIXEL_RGBW
205205 if (protocolVersion2)
206206 {
207- calibrationConfig .setParamsAndPrepareCalibration (calibration .gain , calibration .red , calibration .green , calibration .blue );
207+ calibrationConfig.setParamsAndPrepareCalibration (calibration.gain , calibration.red , calibration.green , calibration.blue );
208208 }
209209 #endif
210- }
210+ }
211+
211212
212-
213213 #ifdef NEOPIXEL_RGBW
214214 /* *
215215 * @brief Compute && correct the white channel
216- *
216+ *
217217 */
218218 inline void rgb2rgbw ()
219219 {
@@ -229,7 +229,7 @@ class
229229
230230 /* *
231231 * @brief Incoming calibration data
232- *
232+ *
233233 */
234234 struct
235235 {
@@ -238,7 +238,7 @@ class
238238 uint8_t green = 0 ;
239239 uint8_t blue = 0 ;
240240 } calibration;
241-
241+
242242} frameState;
243243
244244#endif
0 commit comments