chore: onewire

This commit is contained in:
2024-11-11 01:31:19 +06:00
parent 39f7755477
commit 8fe50deeed
16 changed files with 1180 additions and 66 deletions

View File

@@ -2,10 +2,13 @@
#define MQTT_HANDLER_H
#include <DHCP/dhcp.h>
#include <stdbool.h>
#include "ch32v003fun.h"
#include "w5500.h"
#define MAX_PAYLOAD_LENGTH 256
// Options structure for client identification
typedef struct {
char* clientid;
@@ -20,14 +23,20 @@ typedef struct {
ch32_mqtt_options_t opts;
uint32_t last_reconnect;
uint32_t last_yield;
uint8_t is_connected;
bool is_connected;
char base_topic[64];
} mqtt_state_t;
extern char nodes_list[MAX_PAYLOAD_LENGTH];
void mqtt_init(mqtt_state_t* state);
void mqtt_process(mqtt_state_t* state);
void message_arrived(MessageData* md);
void publish_value(MQTTClient* client, const char* device_name,
const char* property, uint16_t value);
void publish_retained(MQTTClient* client, const char* topic,
const char* payload);
void publish_message(MQTTClient* client, const char* payload,
const char* topic);
#endif