From be274132d681009ae2b5a9a16ebf88f0bbf0dd82 Mon Sep 17 00:00:00 2001 From: Christoph Hagen Date: Sat, 10 Feb 2024 11:30:52 +0100 Subject: [PATCH] Extract configurations to separate files --- .../configurations/EthernetConfiguration.h | 31 +++++++++++++++ include/configurations/KeyConfiguration.h | 12 ++++++ include/controller.h | 39 +------------------ 3 files changed, 45 insertions(+), 37 deletions(-) create mode 100644 include/configurations/EthernetConfiguration.h create mode 100644 include/configurations/KeyConfiguration.h diff --git a/include/configurations/EthernetConfiguration.h b/include/configurations/EthernetConfiguration.h new file mode 100644 index 0000000..7264a35 --- /dev/null +++ b/include/configurations/EthernetConfiguration.h @@ -0,0 +1,31 @@ +#pragma once + +#include + +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]; + +}; \ No newline at end of file diff --git a/include/configurations/KeyConfiguration.h b/include/configurations/KeyConfiguration.h new file mode 100644 index 0000000..1e0e58e --- /dev/null +++ b/include/configurations/KeyConfiguration.h @@ -0,0 +1,12 @@ +#pragma once + +#include + +struct KeyConfiguration { + + const uint8_t* remoteKey; + + const uint8_t* localKey; + + uint32_t challengeExpiryMs; +}; diff --git a/include/controller.h b/include/controller.h index aec521b..6407a3b 100644 --- a/include/controller.h +++ b/include/controller.h @@ -4,43 +4,8 @@ #include "servo.h" #include "message.h" #include - -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]; - -}; - -struct KeyConfiguration { - - const uint8_t* remoteKey; - - const uint8_t* localKey; - - uint32_t challengeExpiryMs; -}; +#include "configurations/EthernetConfiguration.h" +#include "configurations/KeyConfiguration.h" class SesameController: public ServerConnectionCallbacks {