Updated Hörmann_door to completely use namespaces. Makes code a bit cleaner

This commit is contained in:
2025-10-07 00:50:49 +02:00
parent 3ef68a9539
commit 9d3930af59
6 changed files with 48 additions and 37 deletions

View File

@@ -1,12 +1,6 @@
#ifndef __hciemulator_h
#define __hciemulator_h
#ifdef USE_ESP_IDF
//#include <cstdint>
//#include <functional>
//#include <algorithm>
#endif
#include "esphome/components/uart/uart.h"
#define LL_OFF 0
@@ -32,6 +26,9 @@
#define T1_5 750
#define T3_5 4800 //
namespace esphome {
namespace hoermann_door {
static const char *const TAG = "HCIEmulator";
enum DoorState : uint8_t
@@ -81,7 +78,7 @@ class HCIEmulator
public:
typedef std::function<void(const SHCIState &)> callback_function_t;
HCIEmulator(esphome::InternalGPIOPin* pin, esphome::uart::UARTComponent* uart);
HCIEmulator(InternalGPIOPin* pin, uart::UARTComponent* uart);
void poll();
@@ -94,7 +91,7 @@ public:
const SHCIState &getState()
{
if (esphome::micros() - m_recvTime > 2000000)
if (micros() - m_recvTime > 2000000)
{
// 2 sec without statusmessage
m_state.valid = false;
@@ -104,7 +101,7 @@ public:
unsigned long getMessageAge()
{
return esphome::micros() - m_recvTime;
return micros() - m_recvTime;
}
int getLogLevel();
@@ -124,8 +121,8 @@ protected:
private:
callback_function_t m_statusCallback;
esphome::InternalGPIOPin* m_pin;
esphome::uart::UARTComponent* m_port;
InternalGPIOPin* m_pin;
uart::UARTComponent* m_port;
SHCIState m_state;
StateMachine m_statemachine;
@@ -147,4 +144,7 @@ private:
bool m_skipFrame;
};
}
}
#endif