OpenDTU-old/lib/Hoymiles/src/parser/Parser.h
2023-12-12 00:21:14 +01:00

31 lines
635 B
C++

// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <Arduino.h>
#include <cstdint>
#define HOY_SEMAPHORE_TAKE() \
do { \
} while (xSemaphoreTake(_xSemaphore, portMAX_DELAY) != pdPASS)
#define HOY_SEMAPHORE_GIVE() xSemaphoreGive(_xSemaphore)
typedef enum {
CMD_OK,
CMD_NOK,
CMD_PENDING
} LastCommandSuccess;
class Parser {
public:
Parser();
uint32_t getLastUpdate();
void setLastUpdate(const uint32_t lastUpdate);
void beginAppendFragment();
void endAppendFragment();
protected:
SemaphoreHandle_t _xSemaphore;
private:
uint32_t _lastUpdate = 0;
};