chore: onewire
This commit is contained in:
46
include/onewire_temp.h
Normal file
46
include/onewire_temp.h
Normal file
@@ -0,0 +1,46 @@
|
||||
#ifndef ONEWIRE_TEMP_H
|
||||
#define ONEWIRE_TEMP_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "mqtt_handler.h"
|
||||
|
||||
#define ONEWIRE_MAX_SENSORS 16
|
||||
#define ONEWIRE_TEMP_INVALID -999.0f
|
||||
|
||||
typedef enum {
|
||||
ONEWIRE_STATE_READY,
|
||||
ONEWIRE_STATE_CONVERTING,
|
||||
ONEWIRE_STATE_READ
|
||||
} onewire_state_t;
|
||||
|
||||
// Initialize OneWire temperature system
|
||||
void onewire_temp_init(void);
|
||||
|
||||
// Process all sensors (call regularly)
|
||||
void onewire_temp_process(void);
|
||||
|
||||
// Start parallel conversion on all sensors
|
||||
void onewire_temp_start_parallel(void);
|
||||
|
||||
// Set parallel conversion mode
|
||||
void onewire_temp_set_parallel(bool enable);
|
||||
|
||||
// Get temperature for sensor index
|
||||
float onewire_temp_get(uint8_t index);
|
||||
|
||||
// Get total number of discovered sensors
|
||||
uint8_t onewire_temp_count(void);
|
||||
|
||||
// Get sensor address
|
||||
const uint8_t* onewire_temp_address(uint8_t index);
|
||||
|
||||
// Check if sensor is valid
|
||||
bool onewire_temp_valid(uint8_t index);
|
||||
|
||||
// MQTT
|
||||
void onewire_temp_publish_discovery(MQTTClient* client, const char* node_id);
|
||||
void onewire_temp_publish_values(MQTTClient* client, const char* node_id);
|
||||
|
||||
#endif // ONEWIRE_TEMP_H
|
||||
Reference in New Issue
Block a user