/** * @file common.h * * @brief Header file for common definitions and macros in the ChainLube application. * * This file defines common macros, GPIO configurations, and other shared constants * for the ChainLube project. It includes definitions for GPIO pins, OTA delays, pulse lengths, * and other common settings used across the project. * * @author Marcel Peterkau * @date 09.01.2024 */ #ifndef _COMMON_H_ #define _COMMON_H_ #define Q(x) #x #define QUOTE(x) Q(x) #define SET_BIT(value, bitPosition) ((value) |= (1U << (bitPosition))) // Conditional compilation based on PCB revision #if PCB_REV == 1 #define GPIO_BUTTON D7 #define GPIO_LED D8 #define GPIO_TRIGGER D6 #define GPIO_PUMP D5 #elif PCB_REV == 2 #define GPIO_BUTTON D7 #define GPIO_LED D8 #define GPIO_TRIGGER D6 #define GPIO_PUMP D5 #elif PCB_REV == 3 #define GPIO_BUTTON D4 #define GPIO_LED D3 #define GPIO_TRIGGER D6 #define GPIO_PUMP D0 #define GPIO_CS_CAN D8 #elif PCB_REV == 4 #define GPIO_BUTTON D4 #define GPIO_LED D3 #define GPIO_TRIGGER D6 #define GPIO_PUMP D0 #define GPIO_CS_CAN D8 #endif #ifndef HOST_NAME #define HOST_NAME "ChainLube_%06X" // Use printf-Formatting - Chip-ID (uin32_t) will be added #endif #ifndef OTA_DELAY #define OTA_DELAY 50 // ticks -> 10ms / tick #endif #define LUBE_PULSE_LENGHT_MS 160 #define LUBE_PULSE_PAUSE_MS 340 // Pump pulse parameters // -> 2Hz PumpPulse // -> 49.7cc / h @ 2Hz // -> 49.7 ml / h @ 2Hz // -> 828.4µl / min @ 2Hz // -> 828.3µl / 60s // -> 13.81µl / 1s // -> 6.90µl / Pulse #define DEFAULT_PUMP_DOSE 7 #define STARTUP_DELAY 5000 #define SHUTDOWN_DELAY_MS 5000 #endif