2024-01-09 12:54:05 +01:00
|
|
|
/**
|
|
|
|
* @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
|
|
|
|
*/
|
|
|
|
|
2022-01-07 21:02:27 +01:00
|
|
|
#ifndef _COMMON_H_
|
|
|
|
#define _COMMON_H_
|
|
|
|
|
2022-01-07 23:36:02 +01:00
|
|
|
#define Q(x) #x
|
|
|
|
#define QUOTE(x) Q(x)
|
2023-09-25 07:17:38 +02:00
|
|
|
#define SET_BIT(value, bitPosition) ((value) |= (1U << (bitPosition)))
|
2022-01-07 23:36:02 +01:00
|
|
|
|
2024-01-09 12:54:05 +01:00
|
|
|
// Conditional compilation based on PCB revision
|
2023-03-02 17:38:57 +01:00
|
|
|
#if PCB_REV == 1
|
2022-08-19 00:10:42 +02:00
|
|
|
#define GPIO_BUTTON D7
|
|
|
|
#define GPIO_LED D8
|
|
|
|
#define GPIO_TRIGGER D6
|
|
|
|
#define GPIO_PUMP D5
|
2023-03-02 17:38:57 +01:00
|
|
|
#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
|
2022-08-21 11:28:58 +02:00
|
|
|
#elif PCB_REV == 4
|
2022-08-19 00:10:42 +02:00
|
|
|
#define GPIO_BUTTON D4
|
|
|
|
#define GPIO_LED D3
|
|
|
|
#define GPIO_TRIGGER D6
|
|
|
|
#define GPIO_PUMP D0
|
|
|
|
#define GPIO_CS_CAN D8
|
|
|
|
#endif
|
2022-01-07 21:02:27 +01:00
|
|
|
|
|
|
|
#ifndef HOST_NAME
|
2022-01-31 09:26:10 +01:00
|
|
|
#define HOST_NAME "ChainLube_%06X" // Use printf-Formatting - Chip-ID (uin32_t) will be added
|
2022-01-07 21:02:27 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef OTA_DELAY
|
2022-01-31 09:26:10 +01:00
|
|
|
#define OTA_DELAY 50 // ticks -> 10ms / tick
|
2022-01-07 21:02:27 +01:00
|
|
|
#endif
|
|
|
|
|
2022-08-24 23:08:29 +02:00
|
|
|
#define LUBE_PULSE_LENGHT_MS 160
|
|
|
|
#define LUBE_PULSE_PAUSE_MS 340
|
|
|
|
|
2024-01-09 12:54:05 +01:00
|
|
|
// Pump pulse parameters
|
2022-08-24 23:08:29 +02:00
|
|
|
// -> 2Hz PumpPulse
|
2024-01-09 12:54:05 +01:00
|
|
|
// -> 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
|
2022-08-24 23:08:29 +02:00
|
|
|
#define DEFAULT_PUMP_DOSE 7
|
|
|
|
|
|
|
|
#define STARTUP_DELAY 5000
|
2022-08-19 08:16:33 +02:00
|
|
|
#define SHUTDOWN_DELAY_MS 5000
|
|
|
|
|
2024-01-09 12:54:05 +01:00
|
|
|
#endif
|