Refactor project structure and update display logic

Reorganized source files into new directories for config, drivers, sensors, emotion engine, and UI. Removed legacy assets and code related to previous eye animation implementation. Added new display and touch drivers, emotion manager, shake detector, and UI components. Updated CMake project name to 'irobot_display'.
This commit is contained in:
2026-01-24 15:21:50 +05:30
parent 2c731c72e3
commit 8aeaed8a15
69 changed files with 2650 additions and 10338 deletions

View File

@@ -0,0 +1,86 @@
/**
* @file shake_detector.h
* @brief Shake detection interface using QMI8658 IMU sensor
*
* This module provides motion detection capabilities using the QMI8658
* accelerometer/gyroscope. It detects shake gestures and can trigger
* emotional responses in the display system.
*/
#ifndef SHAKE_DETECTOR_H
#define SHAKE_DETECTOR_H
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
// ----------------------------------------------------------------------------
// Configuration
// ----------------------------------------------------------------------------
// Acceleration deviation threshold to detect shake (in G)
#define SHAKE_ACCEL_THRESHOLD 0.5f
// Debounce time between shake detections (milliseconds)
#define SHAKE_DEBOUNCE_MS 2000
// Number of samples to average for baseline calibration
#define SHAKE_BASELINE_SAMPLES 10
// ----------------------------------------------------------------------------
// Type Definitions
// ----------------------------------------------------------------------------
/**
* @brief Shake event types with associated emotions
*/
typedef enum {
SHAKE_NONE = 0, // No shake detected
SHAKE_SURPRISED, // Quick shake - surprised emotion
SHAKE_SAD, // Shake detected - sad emotion
SHAKE_ANGRY // Shake detected - angry emotion
} ShakeEvent;
// ----------------------------------------------------------------------------
// Public API
// ----------------------------------------------------------------------------
/**
* @brief Initialize the shake detector and IMU sensor
*
* Configures the QMI8658 accelerometer and gyroscope for shake detection.
* The I2C bus must be initialized before calling this function.
*
* @return true on successful initialization, false on failure
*/
bool shakeDetectorInit(void);
/**
* @brief Poll the shake detector for events
*
* Should be called periodically (e.g., every 50ms) to check for shakes.
* Performs baseline calibration on first several calls.
*
* @return The detected shake event, or SHAKE_NONE if no shake
*/
ShakeEvent shakeDetectorUpdate(void);
/**
* @brief Get raw accelerometer readings
*
* Retrieves the latest accelerometer values in G units.
*
* @param x Pointer to store X-axis acceleration
* @param y Pointer to store Y-axis acceleration
* @param z Pointer to store Z-axis acceleration
* @return true on success, false on failure
*/
bool shakeDetectorGetRawAccel(float *x, float *y, float *z);
#ifdef __cplusplus
}
#endif
#endif // SHAKE_DETECTOR_H