Extract configurations to separate files

This commit is contained in:
Christoph Hagen 2024-02-10 11:30:52 +01:00
parent 2a6db822ff
commit be274132d6
3 changed files with 45 additions and 37 deletions

View File

@ -0,0 +1,31 @@
#pragma once
#include <stdint.h>
struct EthernetConfiguration {
// The MAC address of the ethernet connection
uint8_t macAddress[6];
// The master-in slave-out pin of the SPI connection for the Ethernet module
int8_t spiPinMiso;
// The master-out slave-in pin of the SPI connection for the Ethernet module
int8_t spiPinMosi;
// The slave clock pin of the SPI connection for the Ethernet module
int8_t spiPinSclk;
// The slave-select pin of the SPI connection for the Ethernet module
int8_t spiPinSS;
unsigned long dhcpLeaseTimeoutMs;
unsigned long dhcpLeaseResponseTimeoutMs;
// The static IP address to assign if DHCP fails
uint8_t manualIp[4];
// The IP address of the DNS server, if DHCP fails
uint8_t manualDnsAddress[4];
};

View File

@ -0,0 +1,12 @@
#pragma once
#include <stdint.h>
struct KeyConfiguration {
const uint8_t* remoteKey;
const uint8_t* localKey;
uint32_t challengeExpiryMs;
};

View File

@ -4,43 +4,8 @@
#include "servo.h" #include "servo.h"
#include "message.h" #include "message.h"
#include <ESPAsyncWebServer.h> #include <ESPAsyncWebServer.h>
#include "configurations/EthernetConfiguration.h"
struct EthernetConfiguration { #include "configurations/KeyConfiguration.h"
// The MAC address of the ethernet connection
uint8_t macAddress[6];
// The master-in slave-out pin of the SPI connection for the Ethernet module
int8_t spiPinMiso;
// The master-out slave-in pin of the SPI connection for the Ethernet module
int8_t spiPinMosi;
// The slave clock pin of the SPI connection for the Ethernet module
int8_t spiPinSclk;
// The slave-select pin of the SPI connection for the Ethernet module
int8_t spiPinSS;
unsigned long dhcpLeaseTimeoutMs;
unsigned long dhcpLeaseResponseTimeoutMs;
// The static IP address to assign if DHCP fails
uint8_t manualIp[4];
// The IP address of the DNS server, if DHCP fails
uint8_t manualDnsAddress[4];
};
struct KeyConfiguration {
const uint8_t* remoteKey;
const uint8_t* localKey;
uint32_t challengeExpiryMs;
};
class SesameController: public ServerConnectionCallbacks { class SesameController: public ServerConnectionCallbacks {