First Test env
This commit is contained in:
17
RotaxMonitor/src/utils.h
Normal file
17
RotaxMonitor/src/utils.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <string>
|
||||
|
||||
std::string printBits(uint32_t value) {
|
||||
std::string result;
|
||||
for (int i = 31; i >= 0; i--) {
|
||||
// ottieni il singolo bit
|
||||
result += ((value >> i) & 1) ? '1' : '0';
|
||||
// aggiungi uno spazio ogni 8 bit, tranne dopo l'ultimo
|
||||
if (i % 8 == 0 && i != 0) {
|
||||
result += ' ';
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
Reference in New Issue
Block a user