Modular v1
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
/* Device Configuration - Permite configurar diferentes tipos de dispositivos Zigbee */
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* ========================= SELEÇÃO DO TIPO DE DISPOSITIVO ========================= */
|
||||
/* Descomente APENAS UMA das opções abaixo para definir o tipo de dispositivo */
|
||||
|
||||
#define DEVICE_TYPE_RELAY /* Relé controlável (on/off light) */
|
||||
// #define DEVICE_TYPE_TEMP_SENSOR /* Sensor de temperatura */
|
||||
// #define DEVICE_TYPE_DOOR_SENSOR /* Sensor de porta/janela */
|
||||
// #define DEVICE_TYPE_MOTION_SENSOR /* Sensor de movimento */
|
||||
|
||||
/* ========================= CONFIGURAÇÃO DE HARDWARE ========================= */
|
||||
|
||||
/* GPIOs comuns (usados por todos os tipos) */
|
||||
#define GPIO_BUTTON_PAIRING 9 /* Botão para pareamento/factory reset */
|
||||
#define GPIO_LED_RGB 8 /* LED RGB indicador de status */
|
||||
|
||||
/* GPIOs específicos por tipo de dispositivo */
|
||||
#ifdef DEVICE_TYPE_RELAY
|
||||
#define GPIO_OUTPUT_RELAY 4 /* Relé de saída */
|
||||
#define HAS_BUTTON_TOGGLE 1 /* Botão também faz toggle do relé */
|
||||
#endif
|
||||
|
||||
#ifdef DEVICE_TYPE_TEMP_SENSOR
|
||||
#define GPIO_SENSOR_I2C_SDA 6 /* I2C SDA para sensor de temperatura */
|
||||
#define GPIO_SENSOR_I2C_SCL 7 /* I2C SCL para sensor de temperatura */
|
||||
#define SENSOR_UPDATE_INTERVAL 30000 /* Intervalo de atualização em ms */
|
||||
#endif
|
||||
|
||||
#ifdef DEVICE_TYPE_DOOR_SENSOR
|
||||
#define GPIO_SENSOR_REED 5 /* Reed switch para sensor de porta */
|
||||
#define HAS_TAMPER_DETECTION 0 /* Detecção de violação (anti-tamper) */
|
||||
#endif
|
||||
|
||||
#ifdef DEVICE_TYPE_MOTION_SENSOR
|
||||
#define GPIO_SENSOR_PIR 5 /* Sensor PIR para detecção de movimento */
|
||||
#define PIR_TIMEOUT_MS 60000 /* Timeout para resetar movimento detectado */
|
||||
#endif
|
||||
|
||||
/* ========================= FUNCIONALIDADES OPCIONAIS ========================= */
|
||||
|
||||
#define FEATURE_LED_INDICATOR 1 /* Habilita LED RGB indicador */
|
||||
#define FEATURE_LONG_PRESS_RESET 1 /* Habilita factory reset por long press (5s) */
|
||||
#define FEATURE_OTA_UPDATE 0 /* Habilita atualização Over-The-Air */
|
||||
|
||||
/* ========================= CONFIGURAÇÕES AVANÇADAS ========================= */
|
||||
|
||||
#define BUTTON_LONG_PRESS_MS 5000 /* Tempo para long press (factory reset) */
|
||||
#define LED_BRIGHTNESS_NORMAL 50 /* Brilho normal do LED (0-255) */
|
||||
#define LED_BRIGHTNESS_DIM 10 /* Brilho reduzido do LED (0-255) */
|
||||
|
||||
/* ========================= VALIDAÇÃO ========================= */
|
||||
|
||||
/* Verifica se pelo menos um tipo de dispositivo foi selecionado */
|
||||
#if !defined(DEVICE_TYPE_RELAY) && !defined(DEVICE_TYPE_TEMP_SENSOR) && \
|
||||
!defined(DEVICE_TYPE_DOOR_SENSOR) && !defined(DEVICE_TYPE_MOTION_SENSOR)
|
||||
#error "Nenhum tipo de dispositivo selecionado! Defina um DEVICE_TYPE_* em device_config.h"
|
||||
#endif
|
||||
|
||||
/* Verifica se mais de um tipo foi selecionado */
|
||||
#if (defined(DEVICE_TYPE_RELAY) + defined(DEVICE_TYPE_TEMP_SENSOR) + \
|
||||
defined(DEVICE_TYPE_DOOR_SENSOR) + defined(DEVICE_TYPE_MOTION_SENSOR)) > 1
|
||||
#error "Múltiplos tipos de dispositivo selecionados! Defina apenas um DEVICE_TYPE_*"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user