Files
iroBotAMOLED_Test/main/emotion-engine/emotion_manager.h
Neil Arora 4d68a788ad Add shake emotion with persistent state and calibration
Introduces a new shake emotion animation with a shake-stop transition, including embedded Lottie animation data and a state machine for emotion transitions. Adds a non-volatile storage (NVS) driver for persistent state management, including first-boot detection, boot count, and IMU calibration storage. Updates emotion manager and related headers to support new shake emotion states, and integrates new UI components for calibration and loading animations.
2026-01-24 20:02:04 +05:30

87 lines
2.2 KiB
C

/**
* @file emotion_manager.h
* @brief Central emotion coordination system
*
* This module manages all emotion-related animations and coordinates
* transitions between emotional states. It provides a unified interface
* for triggering emotions from various sources (shake, touch, etc.).
*/
#ifndef EMOTION_MANAGER_H
#define EMOTION_MANAGER_H
#include <stdbool.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
// ----------------------------------------------------------------------------
// Type Definitions
// ----------------------------------------------------------------------------
/**
* @brief Supported emotion types
*/
typedef enum {
EMOTION_IDLE = 0, // Default idle state with blink
EMOTION_BLINK, // Single blink animation
EMOTION_SHAKING, // Currently being shaken
EMOTION_SHAKE_STOPPING, // Transition from shaking to idle
EMOTION_SURPRISED, // Surprised expression
EMOTION_SAD, // Sad expression
EMOTION_ANGRY, // Angry expression
EMOTION_COUNT
} EmotionType;
// ----------------------------------------------------------------------------
// Public API
// ----------------------------------------------------------------------------
/**
* @brief Initialize the emotion engine
*
* Sets up all emotion animations and prepares the system.
* Must be called after display driver initialization.
*
* @return true on success, false on failure
*/
bool emotionManagerInit(void);
/**
* @brief Start the emotion engine with default state
*
* Begins the idle animation with natural blinking.
* Call this after splash screen is complete.
*/
void emotionManagerStart(void);
/**
* @brief Trigger a specific emotion
*
* Plays the specified emotion animation. The system will
* automatically return to idle state after the animation completes.
*
* @param emotion The emotion to trigger
*/
void emotionManagerSetEmotion(EmotionType emotion);
/**
* @brief Get the currently active emotion
*
* @return The current emotion type
*/
EmotionType emotionManagerGetCurrent(void);
/**
* @brief Stop all emotions and cleanup
*/
void emotionManagerStop(void);
#ifdef __cplusplus
}
#endif
#endif // EMOTION_MANAGER_H