summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-05-17 21:28:08 +0200
committerlonkaars <loek@pipeframe.xyz>2022-05-17 21:28:08 +0200
commit2b75425070662b869c15673623df44e30ce43ebe (patch)
treef0dbb5e840e2747be5966952cb2e3554d034ae72
parent365dcc18fbd98645585cdbe009f537ecdaa90c1a (diff)
code format
-rw-r--r--.clang-tidy1
-rw-r--r--robot/bin.c8
-rw-r--r--robot/bin.h2
-rw-r--r--robot/consts.h1
-rw-r--r--robot/errcatch.c4
-rw-r--r--robot/setup.c6
6 files changed, 10 insertions, 12 deletions
diff --git a/.clang-tidy b/.clang-tidy
index 4c8496f..4dd70ad 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -11,6 +11,7 @@ CheckOptions:
- { key: readability-identifier-naming.GlobalVariableIgnoredRegexp, value: _.* }
- { key: readability-identifier-naming.GlobalVariablePrefix, value: g_w2_ }
- { key: readability-identifier-naming.MacroDefinitionCase, value: UPPER_CASE }
+ - { key: readability-identifier-naming.MacroDefinitionIgnoredRegexp, value: _.* }
- { key: readability-identifier-naming.MacroDefinitionPrefix, value: W2_ }
- { key: readability-identifier-naming.StructCase, value: lower_case }
- { key: readability-identifier-naming.StructPrefix, value: w2_s_ }
diff --git a/robot/bin.c b/robot/bin.c
index 4261b50..4242edc 100644
--- a/robot/bin.c
+++ b/robot/bin.c
@@ -15,14 +15,14 @@
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshift-count-overflow"
uint32_t w2_bin_hton32(uint32_t h32) {
- if(g_w2_endianness == W2_ENDIAN_BIG) return h32;
- return ((h32 & _BYTE_0) << _SHIFT_3B) | ((h32 & _BYTE_1) << _SHIFT_1B)
- | ((h32 & _BYTE_2) >> _SHIFT_1B) | ((h32 & _BYTE_3) >> _SHIFT_3B);
+ if (g_w2_endianness == W2_ENDIAN_BIG) return h32;
+ return ((h32 & _BYTE_0) << _SHIFT_3B) | ((h32 & _BYTE_1) << _SHIFT_1B) |
+ ((h32 & _BYTE_2) >> _SHIFT_1B) | ((h32 & _BYTE_3) >> _SHIFT_3B);
}
#pragma GCC diagnostic pop
uint16_t w2_bin_hton16(uint16_t h16) {
- if(g_w2_endianness == W2_ENDIAN_BIG) return h16;
+ if (g_w2_endianness == W2_ENDIAN_BIG) return h16;
return ((h16 & _BYTE_0) << _SHIFT_1B) | ((h16 & _BYTE_1) >> _SHIFT_1B);
}
diff --git a/robot/bin.h b/robot/bin.h
index 1f21f64..ccde132 100644
--- a/robot/bin.h
+++ b/robot/bin.h
@@ -9,7 +9,6 @@ typedef struct {
extern uint8_t g_w2_endianness;
-
/**
* helper file for binary data
*
@@ -24,4 +23,3 @@ uint16_t w2_bin_hton16(uint16_t h16);
uint32_t w2_bin_ntoh32(uint32_t n32);
/** convert 16-bit value from network (big-endian) to host endian */
uint16_t w2_bin_ntoh16(uint16_t n16);
-
diff --git a/robot/consts.h b/robot/consts.h
index 3558da0..d74d034 100644
--- a/robot/consts.h
+++ b/robot/consts.h
@@ -8,4 +8,3 @@
#define W2_MAX_MODULE_CYCLE_MS (20)
#define W2_SERIAL_BAUD (9600)
#define W2_E_BUFFER_SIZE (16)
-
diff --git a/robot/errcatch.c b/robot/errcatch.c
index 0f97566..1262a38 100644
--- a/robot/errcatch.c
+++ b/robot/errcatch.c
@@ -9,8 +9,8 @@
#include "orangutan_shim.h"
w2_s_error *g_w2_error_buffer[W2_E_BUFFER_SIZE] = {};
-uint8_t g_w2_error_index = 0;
-uint8_t g_w2_error_offset = 0;
+uint8_t g_w2_error_index = 0;
+uint8_t g_w2_error_offset = 0;
void w2_errcatch_main() {
while (g_w2_error_index != g_w2_error_offset) {
diff --git a/robot/setup.c b/robot/setup.c
index bdd5991..d040286 100644
--- a/robot/setup.c
+++ b/robot/setup.c
@@ -1,15 +1,15 @@
#include <stdlib.h>
+#include "bin.h"
#include "consts.h"
#include "halt.h"
#include "modes.h"
#include "orangutan_shim.h"
#include "setup.h"
-#include "bin.h"
// pointers for endianness check
-static const uint16_t _test = 1;
-static const uint8_t* _ptest = (uint8_t*)&_test;
+static const uint16_t _test = 1;
+static const uint8_t *_ptest = (uint8_t *)&_test;
uint8_t g_w2_endianness;
void w2_setup_main() {