diff crc_wrapper.cpp @ 11:6fba58c4964b

Minor changes done by automatic style checker
author Ideenmodellierer
date Mon, 12 Jan 2026 13:57:24 +0000
parents 115cfa4a3239
children
line wrap: on
line diff
--- a/crc_wrapper.cpp	Mon Jan 12 13:55:38 2026 +0000
+++ b/crc_wrapper.cpp	Mon Jan 12 13:57:24 2026 +0000
@@ -4,15 +4,13 @@
 #include "crcmodel.h"
 }
 
-
 CrcWrapper::CrcWrapper(QObject *parent)
     : QObject(parent)
 {}
 
-
 void CrcWrapper::init(p_cm_t p_cm)
 {
-   cm_ini(p_cm);
+    cm_ini(p_cm);
 }
 
 void CrcWrapper::cm_next(p_cm_t p_cm, int ch)
@@ -22,44 +20,39 @@
 
 uint32_t CrcWrapper::CRC_CalcBlockCRC(uint32_t *buffer, uint32_t words)
 {
-    cm_t        crc_model;
-    uint32_t      word_to_do;
-    uint8_t       byte_to_do;
-    int         i;
+    cm_t crc_model;
+    uint32_t word_to_do;
+    uint8_t byte_to_do;
+    int i;
 
     // Values for the STM32F generator.
 
-    crc_model.cm_width = 32;            // 32-bit CRC
-    crc_model.cm_poly  = 0x04C11DB7;    // CRC-32 polynomial
-    crc_model.cm_init  = 0xFFFFFFFF;    // CRC initialized to 1's
-    crc_model.cm_refin = FALSE;         // CRC calculated MSB first
-    crc_model.cm_refot = FALSE;         // Final result is not bit-reversed
-    crc_model.cm_xorot = 0x00000000;    // Final result XOR'ed with this
+    crc_model.cm_width = 32;         // 32-bit CRC
+    crc_model.cm_poly = 0x04C11DB7;  // CRC-32 polynomial
+    crc_model.cm_init = 0xFFFFFFFF;  // CRC initialized to 1's
+    crc_model.cm_refin = FALSE;      // CRC calculated MSB first
+    crc_model.cm_refot = FALSE;      // Final result is not bit-reversed
+    crc_model.cm_xorot = 0x00000000; // Final result XOR'ed with this
 
     cm_ini(&crc_model);
 
-    while (words--)
-    {
+    while (words--) {
         // The STM32F10x hardware does 32-bit words at a time!!!
 
         word_to_do = *buffer++;
 
         // Do all bytes in the 32-bit word.
 
-        for (i = 0; i < sizeof(word_to_do); i++)
-        {
+        for (i = 0; i < sizeof(word_to_do); i++) {
             // We calculate a *byte* at a time. If the CRC is MSB first we
             // do the next MS byte and vica-versa.
 
-            if (crc_model.cm_refin == FALSE)
-            {
+            if (crc_model.cm_refin == FALSE) {
                 // MSB first. Do the next MS byte.
 
                 byte_to_do = (uint8_t) ((word_to_do & 0xFF000000) >> 24);
                 word_to_do <<= 8;
-            }
-            else
-            {
+            } else {
                 // LSB first. Do the next LS byte.
 
                 byte_to_do = (uint8_t) (word_to_do & 0x000000FF);
@@ -74,4 +67,3 @@
 
     return (cm_crc(&crc_model));
 }
-