Files
ate0005/main/ate0005.h
T
2026-11-04 09:12:31 +03:00

99 lines
5.3 KiB
C

/**
* @file ate0005.h
*
* @brief Configuration and interface definitions of the ATE0005 universal
* optical 2-channel angle gauge and tachometer.
*
* This header aggregates the includes required by the application and defines
* the FreeRTOS task priorities and stack sizes, the operating mode constants
* with the main menu labels, the WiFi access point and station parameters and
* the GPIO pin mapping of the peripherals of the ATE0005 device running on the
* ESP32 platform.
*
* Key features:
* - Task priorities and stack sizes for the inclinometer, tachometer, encoder,
* expander and statistics tasks
* - Operating mode constants and the matching main menu labels
* - WiFi access point and station configuration with the remote syslog server
* address
* - I2C bus, LCD expander and optical device GPIO pin definitions
*
* @note The GPIO definitions match the connectors of the ATE0005 board and
* must not be changed without a hardware revision.
* @note The optical device of each channel is shared by the inclinometer and
* the tachometer of the same channel.
*/
#pragma once
#include "nvs_flash.h"
#include "esp_wifi.h"
#include "esp_timer.h"
#include "zh_160x_i2c.h"
#include "zh_encoder.h"
#include "zh_inclinometer.h"
#include "zh_tachometer.h"
#include "zh_ota_server.h"
#include "zh_espnow.h"
#include "zh_syslog.h"
#define STATS_TASK_PRIORITY tskIDLE_PRIORITY /*!< Priority of the statistics logging task */
#define STATS_TASK_STACK_SIZE (configMINIMAL_STACK_SIZE + 1280) /*!< Stack size for the statistics logging task */
#define A_INCLINOMETER_TASK_PRIORITY tskIDLE_PRIORITY + 5 /*!< Priority of the A inclinometer processing task */
#define A_INCLINOMETER_TASK_STACK_SIZE (configMINIMAL_STACK_SIZE + 512) /*!< Stack size for the A inclinometer processing task */
#define B_INCLINOMETER_TASK_PRIORITY tskIDLE_PRIORITY + 5 /*!< Priority of the B inclinometer processing task */
#define B_INCLINOMETER_TASK_STACK_SIZE (configMINIMAL_STACK_SIZE + 512) /*!< Stack size for the B inclinometer processing task */
#define A_TACHOMETER_TASK_PRIORITY tskIDLE_PRIORITY + 5 /*!< Priority of the A tachometer processing task */
#define A_TACHOMETER_TASK_STACK_SIZE (configMINIMAL_STACK_SIZE + 512) /*!< Stack size for the A tachometer processing task */
#define B_TACHOMETER_TASK_PRIORITY tskIDLE_PRIORITY + 5 /*!< Priority of the B tachometer processing task */
#define B_TACHOMETER_TASK_STACK_SIZE (configMINIMAL_STACK_SIZE + 512) /*!< Stack size for the B tachometer processing task */
#define ENCODER_TASK_PRIORITY tskIDLE_PRIORITY + 4 /*!< Priority of the mode encoder task */
#define ENCODER_TASK_STACK_SIZE configMINIMAL_STACK_SIZE /*!< Stack size for the mode encoder task */
#define EXPANDER_TASK_PRIORITY tskIDLE_PRIORITY + 4 /*!< Priority of the PCF8574 expander task */
#define EXPANDER_TASK_STACK_SIZE configMINIMAL_STACK_SIZE /*!< Stack size for the PCF8574 expander task */
#define MODE_ANGLE_ANGLE 0 /*!< Operating mode: both inclinometers active */
#define MAIN_MENU_ANGLE_ANGLE_NAME "ANGLE/ANGLE" /*!< Menu label for angle/angle mode */
#define MODE_TACHO_TACHO 1 /*!< Operating mode: both tachometers active */
#define MAIN_MENU_TACHO_TACHO_NAME "TACHO/TACHO" /*!< Menu label for tachometer/tachometer mode */
#define MODE_ANGLE_TACHO 2 /*!< Operating mode: A inclinometer and B tachometer active */
#define MAIN_MENU_ANGLE_TACHO_NAME "ANGLE/TACHO" /*!< Menu label for angle/tachometer mode */
#define MODE_REMOTE 3 /*!< Operating mode: remote control via ESP-NOW */
#define MAIN_MENU_REMOTE_NAME "REMOTE" /*!< Menu label for remote mode */
#define WIFI_AP_SSID "ATE0005" /*!< WiFi AP SSID */
#define WIFI_AP_PASS "repairlab" /*!< WiFi AP password */
#define WIFI_AP_CHANNEL 1 /*!< WiFi AP channel */
#define MAX_AP_CONNECTION 4 /*!< Maximum number of stations connected to AP */
#define WIFI_STA_SSID "rick_professor" /*!< WiFi STA SSID */
#define WIFI_STA_PASS "repairlab" /*!< WiFi STA password */
#define WIFI_STA_MAXIMUM_RETRY 10 /*!< Maximum number of reconnection attempts for STA mode */
#define SYSLOG_IP "77.51.201.8" /*!< IP address of the remote syslog server */
#define I2C_SCL_GPIO GPIO_NUM_22 /*!< I2C clock line GPIO */
#define I2C_SDA_GPIO GPIO_NUM_21 /*!< I2C data line GPIO */
#define LCD_I2C_ADDRESS 0x20 /*!< I2C address of the LCD PCF8574 expander (U2) */
#define MODE_ENCODER_NUMBER 1 /*!< Encoder instance number (Connector EN1) */
#define MODE_ENCODER_A_GPIO GPIO_NUM_27 /*!< Mode encoder A-phase GPIO */
#define MODE_ENCODER_B_GPIO GPIO_NUM_26 /*!< Mode encoder B-phase GPIO */
#define MODE_ENCODER_S_GPIO GPIO_NUM_25 /*!< Mode encoder switch GPIO */
#define A_OPTICAL_DEVICE_A_GPIO GPIO_NUM_14 /*!< Optical device A-phase GPIO for channel A (Connector EN2) */
#define A_OPTICAL_DEVICE_B_GPIO GPIO_NUM_13 /*!< Optical device B-phase GPIO for channel A */
#define B_OPTICAL_DEVICE_A_GPIO GPIO_NUM_18 /*!< Optical device A-phase GPIO for channel B (Connector EN3) */
#define B_OPTICAL_DEVICE_B_GPIO GPIO_NUM_19 /*!< Optical device B-phase GPIO for channel B */
#ifdef __cplusplus
extern "C"
{
#endif
#ifdef __cplusplus
}
#endif