Initial sanitized SmartSpeaker snapshot
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "wifi_connect.h" // for led_state_t definition
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
uint8_t volume;
|
||||
uint8_t led_state; // Explicit size to avoid enum size mismatch
|
||||
float led_brightness;
|
||||
uint8_t wifi_connected; // Explicit size to avoid bool size mismatch
|
||||
uint8_t websocket_connected; // Explicit size to avoid bool size mismatch
|
||||
uint8_t haptic_intensity; // Haptic PWM intensity (0-100)
|
||||
uint16_t ambient_light; // Analog light value (0-4095)
|
||||
uint8_t touch_active; // Touch sensor input state (0 or 1)
|
||||
} device_state_t;
|
||||
|
||||
/**
|
||||
* @brief Initialize the state manager, locks, and default values.
|
||||
*/
|
||||
void state_manager_init(void);
|
||||
|
||||
/**
|
||||
* @brief Thread-safe query to get a copy of the current system states.
|
||||
*/
|
||||
void state_get_current(device_state_t *out_state);
|
||||
|
||||
/* --- Setter Mutators (Trigger Hooks & Hardware Actions) --- */
|
||||
void state_set_volume(uint8_t volume);
|
||||
void state_set_led(led_state_t state);
|
||||
void state_set_brightness(float brightness);
|
||||
void state_set_wifi_connected(bool connected);
|
||||
void state_set_websocket_connected(bool connected);
|
||||
void state_set_haptic_intensity(uint8_t intensity);
|
||||
void state_set_sensors(uint16_t ambient_light, uint8_t touch_active);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user