From b3832a3d1b31da3a1b4e8ab5d95508f7d95d970f Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Tue, 16 Feb 2021 12:31:45 +0100 Subject: [PATCH] network specific configuration --- cube/User/Inc/config.h | 4 +++- cube/User/Src/config.c | 2 +- cube/User/Src/wizHelper.c | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cube/User/Inc/config.h b/cube/User/Inc/config.h index 08fdf9b..85163a6 100644 --- a/cube/User/Inc/config.h +++ b/cube/User/Inc/config.h @@ -14,7 +14,9 @@ typedef struct __attribute__((__packed__)) s_configBlock { char sharedSecret[SHA256_BLOCK_SIZE]; char sinkServer[48]; union { - uint8_t macAddress[6]; + struct { + uint8_t macAddress[6]; + } lan; } networkspecific; uint8_t filler[22]; } t_configBlock; diff --git a/cube/User/Src/config.c b/cube/User/Src/config.c index e609698..c134cb8 100644 --- a/cube/User/Src/config.c +++ b/cube/User/Src/config.c @@ -10,7 +10,7 @@ t_configBlock defaultConfigBlock = { .configMagic = CONFIG_MAGIC, .deviceName = "MainsCnt", - .networkspecific.macAddress = { 0x00, 0xA0, 0x57, 0x05, 0x3E, 0x0F }, + .networkspecific.lan.macAddress = { 0x00, 0xA0, 0x57, 0x05, 0x3E, 0x0F }, .ntpServer = "0.de.pool.ntp.org", .deviceId = "MainsCnt01", .sharedSecret = "sharedSecretGanzGeheim", diff --git a/cube/User/Src/wizHelper.c b/cube/User/Src/wizHelper.c index 2707344..2e9cd52 100644 --- a/cube/User/Src/wizHelper.c +++ b/cube/User/Src/wizHelper.c @@ -211,7 +211,7 @@ static void wizPhyLinkHandler(void *handle) { int wizInit() { config = getConfig(); netInfo.dhcp = NETINFO_DHCP; - memcpy(netInfo.mac, config->networkspecific.macAddress, 6); + memcpy(netInfo.mac, config->networkspecific.lan.macAddress, 6); coloredMsg(LOG_BLUE, "wizI, resetting Ethernet module"); wizReset(true);