All checks were successful
Build ESP32 BMC Firmware / build (push) Successful in 1m7s
92 lines
3.0 KiB
C
92 lines
3.0 KiB
C
#ifndef BMC_CONFIG_H
|
|
#define BMC_CONFIG_H
|
|
|
|
#include "driver/gpio.h"
|
|
#include "driver/uart.h"
|
|
|
|
// ============================================================================
|
|
// Ethernet Configuration (W5500 SPI)
|
|
// ============================================================================
|
|
#define ETH_SPI_HOST SPI2_HOST
|
|
#define ETH_SPI_MISO_GPIO GPIO_NUM_12
|
|
#define ETH_SPI_MOSI_GPIO GPIO_NUM_11
|
|
#define ETH_SPI_SCLK_GPIO GPIO_NUM_13
|
|
#define ETH_SPI_CS_GPIO GPIO_NUM_14
|
|
#define ETH_SPI_INT_GPIO GPIO_NUM_10
|
|
#define ETH_SPI_RST_GPIO GPIO_NUM_9
|
|
|
|
// MAC address (can be customized)
|
|
#define ETH_MAC_ADDR {0x02, 0x00, 0x00, 0x12, 0x34, 0x56}
|
|
|
|
// Network configuration (used if DHCP fails or is disabled)
|
|
#define BMC_USE_DHCP 1
|
|
#define BMC_STATIC_IP "192.168.1.100"
|
|
#define BMC_NETMASK "255.255.255.0"
|
|
#define BMC_GATEWAY "192.168.1.1"
|
|
|
|
// ============================================================================
|
|
// UART Serial Configuration
|
|
// ============================================================================
|
|
#define BMC_UART_NUM UART_NUM_1
|
|
#define BMC_UART_TX_GPIO GPIO_NUM_43
|
|
#define BMC_UART_RX_GPIO GPIO_NUM_44
|
|
#define BMC_UART_BAUD_RATE 115200
|
|
#define BMC_UART_BUF_SIZE 2048
|
|
#define BMC_UART_TASK_STACK 4096
|
|
#define BMC_UART_TASK_PRIO 5
|
|
|
|
// ============================================================================
|
|
// HTTP Server Configuration
|
|
// ============================================================================
|
|
#define BMC_HTTP_PORT 80
|
|
#define BMC_HTTP_MAX_CONN 17
|
|
#define BMC_HTTP_STACK_SIZE 8192
|
|
|
|
// HTTP Basic Authentication
|
|
#define BMC_HTTP_AUTH_ENABLED 1
|
|
#define BMC_HTTP_AUTH_USERNAME "admin"
|
|
#define BMC_HTTP_AUTH_PASSWORD "admin"
|
|
#define BMC_HTTP_AUTH_REALM "ESP32 BMC"
|
|
|
|
// ============================================================================
|
|
// GPIO Configuration
|
|
// ============================================================================
|
|
|
|
// Number of user-configurable GPIOs
|
|
#define BMC_GPIO_COUNT 1
|
|
|
|
// GPIO pin definitions with names and default modes
|
|
typedef struct {
|
|
gpio_num_t pin;
|
|
const char *name;
|
|
gpio_mode_t mode;
|
|
int default_value;
|
|
bool inverted; // Active-low logic
|
|
bool is_input_only; // Some pins are input-only
|
|
} bmc_gpio_def_t;
|
|
|
|
// Predefined GPIO assignments
|
|
#define BMC_GPIO_POWER GPIO_NUM_37
|
|
|
|
// Default GPIO configuration table
|
|
static const bmc_gpio_def_t bmc_gpio_defaults[BMC_GPIO_COUNT] = {
|
|
// Power control outputs
|
|
{BMC_GPIO_POWER, "POWER", GPIO_MODE_OUTPUT, 1 /* AC power ON */, true, false},
|
|
};
|
|
|
|
// ============================================================================
|
|
// Power Control Timing
|
|
// ============================================================================
|
|
#define BMC_RESET_PULSE_MS 200
|
|
|
|
// ============================================================================
|
|
// Logging Tags
|
|
// ============================================================================
|
|
#define TAG_BMC "BMC"
|
|
#define TAG_GPIO "GPIO"
|
|
#define TAG_UART "UART"
|
|
#define TAG_ETH "ETH"
|
|
#define TAG_HTTP "HTTP"
|
|
|
|
#endif // BMC_CONFIG_H
|