kopia lustrzana https://github.com/SP8EBC/ParaTNC
reworked configuration handler for STM32L476 target
rodzic
eff75dac55
commit
d6733f2662
|
@ -13,10 +13,32 @@
|
|||
extern const int __config_section_first_crc;
|
||||
extern const int __config_section_second_crc;
|
||||
|
||||
//extern const int __config_section_first_pgm_counter;
|
||||
//extern const int __config_section_second_pgm_counter;
|
||||
extern const uint16_t config_data_pgm_cntr_first;
|
||||
extern const uint16_t config_data_pgm_cntr_second;
|
||||
extern const uint16_t * config_data_pgm_cntr_first_ptr;
|
||||
extern const uint16_t * config_data_pgm_cntr_second_ptr;
|
||||
|
||||
#define config_data_pgm_cntr_first *(config_data_pgm_cntr_first_ptr)
|
||||
#define config_data_pgm_cntr_second *(config_data_pgm_cntr_second_ptr)
|
||||
|
||||
extern const config_data_mode_t * config_data_mode_first_ptr;
|
||||
extern const config_data_basic_t * config_data_basic_first_ptr;
|
||||
extern const config_data_wx_sources_t * config_data_wx_sources_first_ptr;
|
||||
extern const config_data_umb_t * config_data_umb_first_ptr;
|
||||
extern const config_data_rtu_t * config_data_rtu_first_ptr;
|
||||
|
||||
extern const config_data_mode_t * config_data_mode_second_ptr;
|
||||
extern const config_data_basic_t * config_data_basic_second_ptr;
|
||||
extern const config_data_wx_sources_t * config_data_wx_sources_second_ptr;
|
||||
extern const config_data_umb_t * config_data_umb_second_ptr;
|
||||
extern const config_data_rtu_t * config_data_rtu_second_ptr;
|
||||
|
||||
#ifdef PARAMETEO
|
||||
extern const config_data_gsm_t * config_data_gsm_first_ptr;
|
||||
extern const config_data_gsm_t * config_data_gsm_second_ptr;
|
||||
extern const config_data_gsm_t * config_data_gsm_default_ptr;
|
||||
|
||||
extern const config_data_gsm_t config_data_gsm_default;
|
||||
|
||||
#else
|
||||
|
||||
extern const config_data_basic_t config_data_basic_first;
|
||||
extern const config_data_mode_t config_data_mode_first;
|
||||
|
@ -30,9 +52,9 @@ extern const config_data_umb_t config_data_umb_second;
|
|||
extern const config_data_rtu_t config_data_rtu_second;
|
||||
extern const config_data_wx_sources_t config_data_wx_sources_second;
|
||||
|
||||
#ifdef PARAMETEO
|
||||
extern const config_data_gsm_t config_data_gsm_default;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* CONFIG_DATA_EXTERNS_H_ */
|
||||
|
|
|
@ -240,32 +240,6 @@ SECTIONS
|
|||
__config_section_first_start = 0x0801E800; /* Page 122 and 123 */
|
||||
__config_section_second_start = 0x0801F000; /* Page 124 and 125 */
|
||||
__config_section_third_start = 0x0801F800; /* Page 126 and 127 */
|
||||
|
||||
.config_section_default __config_section_default_start :
|
||||
{
|
||||
FILL(0xDD)
|
||||
|
||||
. = ALIGN(4);
|
||||
|
||||
start = .;
|
||||
|
||||
KEEP(*(.config_section_default));
|
||||
|
||||
. = start + 0x10;
|
||||
KEEP(*(.config_section_default.mode));
|
||||
|
||||
. = start + 0x20;
|
||||
KEEP(*(.config_section_default.basic));
|
||||
|
||||
. = start + 0x100;
|
||||
KEEP(*(.config_section_default.sources));
|
||||
|
||||
. = start + 0x120;
|
||||
KEEP(*(.config_section_default.umb));
|
||||
|
||||
. = start + 0x140;
|
||||
KEEP(*(.config_section_default.rtu));
|
||||
}
|
||||
|
||||
.config_section_first __config_section_first_start :
|
||||
{
|
||||
|
@ -277,19 +251,19 @@ SECTIONS
|
|||
|
||||
KEEP(*(.config_section_first));
|
||||
|
||||
. = start + 0x10;
|
||||
. = start + 0x20;
|
||||
KEEP(*(.config_section_first.mode));
|
||||
|
||||
. = start + 0x20;
|
||||
. = start + 0x40;
|
||||
KEEP(*(.config_section_first.basic));
|
||||
|
||||
. = start + 0x100;
|
||||
. = start + 0x120;
|
||||
KEEP(*(.config_section_first.sources));
|
||||
|
||||
. = start + 0x120;
|
||||
. = start + 0x140;
|
||||
KEEP(*(.config_section_first.umb));
|
||||
|
||||
. = start + 0x140;
|
||||
. = start + 0x160;
|
||||
KEEP(*(.config_section_first.rtu));
|
||||
|
||||
. = 0x7FC;
|
||||
|
@ -307,19 +281,19 @@ SECTIONS
|
|||
|
||||
KEEP(*(.config_section_second));
|
||||
|
||||
. = start + 0x10;
|
||||
. = start + 0x20;
|
||||
KEEP(*(.config_section_second.mode));
|
||||
|
||||
. = start + 0x20;
|
||||
. = start + 0x40;
|
||||
KEEP(*(.config_section_second.basic));
|
||||
|
||||
. = start + 0x100;
|
||||
. = start + 0x120;
|
||||
KEEP(*(.config_section_second.sources));
|
||||
|
||||
. = start + 0x120;
|
||||
. = start + 0x140;
|
||||
KEEP(*(.config_section_second.umb));
|
||||
|
||||
. = start + 0x140;
|
||||
. = start + 0x160;
|
||||
KEEP(*(.config_section_second.rtu));
|
||||
|
||||
. = 0x7FC;
|
||||
|
|
|
@ -58,14 +58,6 @@ _estack = 0x20018000; /* end of RAM */
|
|||
_Min_Heap_Size = 0x200; /* required amount of heap */
|
||||
_Min_Stack_Size = 0x400; /* required amount of stack */
|
||||
|
||||
__config_section_default_start = 0x0801E000; /* Page 120 and 121 */
|
||||
__config_section_default_checksum = 0x0801E7FC; /* Page 120 and 121 */
|
||||
__config_section_first_start = 0x0801E800; /* Page 122 and 123 */
|
||||
__config_section_first_checksum = 0x0801E7FC; /* Page 122 and 123 */
|
||||
__config_section_second_start = 0x0801F000; /* Page 124 and 125 */
|
||||
__config_section_second_checksum = 0x0801EFFC; /* Page 124 and 125 */
|
||||
__config_section_third_start = 0x0801F800; /* Page 126 and 127 */
|
||||
|
||||
/* Specify the memory areas */
|
||||
MEMORY
|
||||
{
|
||||
|
@ -207,68 +199,6 @@ SECTIONS
|
|||
}
|
||||
|
||||
.ARM.attributes 0 : { *(.ARM.attributes) }
|
||||
|
||||
.config_section_default __config_section_default_start : ALIGN(4)
|
||||
{
|
||||
FILL(0xDD)
|
||||
|
||||
KEEP(*(.config_section_default));
|
||||
|
||||
KEEP(*(.config_section_default.mode));
|
||||
|
||||
KEEP(*(.config_section_default.basic));
|
||||
|
||||
KEEP(*(.config_section_default.sources));
|
||||
|
||||
KEEP(*(.config_section_default.umb));
|
||||
|
||||
KEEP(*(.config_section_default.rtu));
|
||||
} >FLASH
|
||||
|
||||
.config_section_first __config_section_first_start : ALIGN(4)
|
||||
{
|
||||
FILL(0xAA)
|
||||
|
||||
KEEP(*(.config_section_first));
|
||||
|
||||
KEEP(*(.config_section_first.mode));
|
||||
|
||||
KEEP(*(.config_section_first.basic));
|
||||
|
||||
KEEP(*(.config_section_first.sources));
|
||||
|
||||
KEEP(*(.config_section_first.umb));
|
||||
|
||||
KEEP(*(.config_section_first.rtu));
|
||||
|
||||
KEEP(*(.config_section_first.crc));
|
||||
|
||||
} >FLASH
|
||||
|
||||
.config_section_second __config_section_second_start : ALIGN(4)
|
||||
{
|
||||
FILL(0xBB)
|
||||
|
||||
KEEP(*(.config_section_second));
|
||||
|
||||
KEEP(*(.config_section_second.mode));
|
||||
|
||||
KEEP(*(.config_section_second.basic));
|
||||
|
||||
KEEP(*(.config_section_second.sources));
|
||||
|
||||
KEEP(*(.config_section_second.umb));
|
||||
|
||||
KEEP(*(.config_section_second.rtu));
|
||||
|
||||
KEEP(*(.config_section_second.crc));
|
||||
|
||||
} >FLASH
|
||||
|
||||
.config_section_third __config_section_third_start : ALIGN(4)
|
||||
{
|
||||
KEEP(*(.config_section_third))
|
||||
} >FLASH
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
#include "station_config.h"
|
||||
|
||||
#ifndef STM32L471xx
|
||||
|
||||
#ifndef _RTU_SLAVE_LENGHT_1
|
||||
#define _RTU_SLAVE_LENGHT_1 0x1
|
||||
|
@ -466,43 +467,45 @@ const config_data_rtu_t __attribute__((section(".config_section_first.rtu"))) co
|
|||
.slave_6_unsigned_signed = 0
|
||||
};
|
||||
|
||||
#ifdef PARAMETEO
|
||||
//#ifdef PARAMETEO
|
||||
//
|
||||
//const config_data_gsm_t __attribute__((section(".config_section_first.gsm"))) config_data_gsm_first = {
|
||||
// .pin = "\0\0\0\0\0",
|
||||
//
|
||||
// .apn = _GSM_APN_NAME, // PlusGSM - abonament
|
||||
// //.apn = "plus\0", // PlusGSM - karta
|
||||
// //.apn = "virgin-internet\0", // Virgin Mobile
|
||||
//
|
||||
// .username = _GSM_APN_USER,
|
||||
//
|
||||
// .password = _GSM_APN_PASS,
|
||||
//
|
||||
//#ifdef _GSM_API_ENABLE
|
||||
// .api_enable = 1,
|
||||
//#else
|
||||
// .api_enable = 0,
|
||||
//#endif
|
||||
//
|
||||
// // 78.88.56.14
|
||||
// //.api_base_url = "http://78.88.56.14:8080/",
|
||||
// .api_base_url = _GSM_API_BASE_URL, // 22910
|
||||
// //.api_base_url = "http://193.33.111.22:8080/meteo_backend",
|
||||
//
|
||||
// .api_station_name = _GSM_API_STATION_NAME,
|
||||
//
|
||||
//#ifdef _GSM_APRSIS_ENABLE
|
||||
// .aprsis_enable = 1,
|
||||
//#else
|
||||
// .aprsis_enable = 0,
|
||||
//#endif
|
||||
//
|
||||
// .aprsis_passcode = _GSM_APRSIS_PASSCODE,
|
||||
//
|
||||
// .aprsis_server_port = _GSM_APRSIS_PORT,
|
||||
//
|
||||
// .aprsis_server_address = _GSM_APRSIS_ADDRES
|
||||
//
|
||||
//};
|
||||
//#endif
|
||||
|
||||
const config_data_gsm_t __attribute__((section(".config_section_first.gsm"))) config_data_gsm_first = {
|
||||
.pin = "\0\0\0\0\0",
|
||||
|
||||
.apn = _GSM_APN_NAME, // PlusGSM - abonament
|
||||
//.apn = "plus\0", // PlusGSM - karta
|
||||
//.apn = "virgin-internet\0", // Virgin Mobile
|
||||
|
||||
.username = _GSM_APN_USER,
|
||||
|
||||
.password = _GSM_APN_PASS,
|
||||
|
||||
#ifdef _GSM_API_ENABLE
|
||||
.api_enable = 1,
|
||||
#else
|
||||
.api_enable = 0,
|
||||
#endif
|
||||
|
||||
// 78.88.56.14
|
||||
//.api_base_url = "http://78.88.56.14:8080/",
|
||||
.api_base_url = _GSM_API_BASE_URL, // 22910
|
||||
//.api_base_url = "http://193.33.111.22:8080/meteo_backend",
|
||||
|
||||
.api_station_name = _GSM_API_STATION_NAME,
|
||||
|
||||
#ifdef _GSM_APRSIS_ENABLE
|
||||
.aprsis_enable = 1,
|
||||
#else
|
||||
.aprsis_enable = 0,
|
||||
#endif
|
||||
|
||||
.aprsis_passcode = _GSM_APRSIS_PASSCODE,
|
||||
|
||||
.aprsis_server_port = _GSM_APRSIS_PORT,
|
||||
|
||||
.aprsis_server_address = _GSM_APRSIS_ADDRES
|
||||
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
#include "station_config.h"
|
||||
|
||||
#ifndef STM32L471xx
|
||||
|
||||
#ifndef _RTU_SLAVE_LENGHT_1
|
||||
#define _RTU_SLAVE_LENGHT_1 0x1
|
||||
#endif
|
||||
|
@ -462,42 +464,44 @@ const config_data_rtu_t __attribute__((section(".config_section_second.rtu"))) c
|
|||
|
||||
#ifdef PARAMETEO
|
||||
|
||||
const config_data_gsm_t __attribute__((section(".config_section_second.gsm"))) config_data_gsm_second = {
|
||||
.pin = "\0\0\0\0\0",
|
||||
//const config_data_gsm_t __attribute__((section(".config_section_second.gsm"))) config_data_gsm_second = {
|
||||
// .pin = "\0\0\0\0\0",
|
||||
//
|
||||
// .apn = _GSM_APN_NAME, // PlusGSM - abonament
|
||||
// //.apn = "plus\0", // PlusGSM - karta
|
||||
// //.apn = "virgin-internet\0", // Virgin Mobile
|
||||
//
|
||||
// .username = _GSM_APN_USER,
|
||||
//
|
||||
// .password = _GSM_APN_PASS,
|
||||
//
|
||||
//#ifdef _GSM_API_ENABLE
|
||||
// .api_enable = 1,
|
||||
//#else
|
||||
// .api_enable = 0,
|
||||
//#endif
|
||||
//
|
||||
// // 78.88.56.14
|
||||
// //.api_base_url = "http://78.88.56.14:8080/",
|
||||
// .api_base_url = _GSM_API_BASE_URL, // 22910
|
||||
// //.api_base_url = "http://193.33.111.22:8080/meteo_backend",
|
||||
//
|
||||
// .api_station_name = _GSM_API_STATION_NAME,
|
||||
//
|
||||
//#ifdef _GSM_APRSIS_ENABLE
|
||||
// .aprsis_enable = 1,
|
||||
//#else
|
||||
// .aprsis_enable = 0,
|
||||
//#endif
|
||||
//
|
||||
// .aprsis_passcode = _GSM_APRSIS_PASSCODE,
|
||||
//
|
||||
// .aprsis_server_port = _GSM_APRSIS_PORT,
|
||||
//
|
||||
// .aprsis_server_address = _GSM_APRSIS_ADDRES
|
||||
//};
|
||||
|
||||
.apn = _GSM_APN_NAME, // PlusGSM - abonament
|
||||
//.apn = "plus\0", // PlusGSM - karta
|
||||
//.apn = "virgin-internet\0", // Virgin Mobile
|
||||
|
||||
.username = _GSM_APN_USER,
|
||||
|
||||
.password = _GSM_APN_PASS,
|
||||
|
||||
#ifdef _GSM_API_ENABLE
|
||||
.api_enable = 1,
|
||||
#else
|
||||
.api_enable = 0,
|
||||
#endif
|
||||
|
||||
// 78.88.56.14
|
||||
//.api_base_url = "http://78.88.56.14:8080/",
|
||||
.api_base_url = _GSM_API_BASE_URL, // 22910
|
||||
//.api_base_url = "http://193.33.111.22:8080/meteo_backend",
|
||||
|
||||
.api_station_name = _GSM_API_STATION_NAME,
|
||||
|
||||
#ifdef _GSM_APRSIS_ENABLE
|
||||
.aprsis_enable = 1,
|
||||
#else
|
||||
.aprsis_enable = 0,
|
||||
#endif
|
||||
|
||||
.aprsis_passcode = _GSM_APRSIS_PASSCODE,
|
||||
|
||||
.aprsis_server_port = _GSM_APRSIS_PORT,
|
||||
|
||||
.aprsis_server_address = _GSM_APRSIS_ADDRES
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -25,12 +25,75 @@
|
|||
#include <stm32l4xx_ll_crc.h>
|
||||
#endif
|
||||
|
||||
/**
|
||||
* STM32L476RE, last flash memory page
|
||||
* 0x0807F800 - 0x0807FFFF; 2 K; Page 383
|
||||
*
|
||||
* __config_section_default_start = 0x0801E000;
|
||||
__config_section_first_start = 0x0801E800; // page 61, 0x3D
|
||||
__config_section_second_start = 0x0801F000; // page 62, 0x3E
|
||||
__config_section_third_start = 0x0801F800; // page 63, 0x3F
|
||||
*
|
||||
*/
|
||||
|
||||
#define CONFIG_SECTION_FIRST_START 0x0801E800
|
||||
#define CONFIG_SECTION_SECOND_START 0x0801F000
|
||||
#define CONFIG_SECTION_DEFAULT_START 0x0801E000
|
||||
|
||||
#define CONFIG_MODE_PGM_CNTR 0x0
|
||||
#define CONFIG_MODE_OFSET 0x20 // Current size: 0xF
|
||||
#define CONFIG_BASIC_OFFSET 0x40 // Current size: 0x9C
|
||||
#define CONFIG_SOURCES_OFFSET 0x120 // Current size: 0x4
|
||||
#define CONFIG_UMB_OFFSET 0x140 // Current size: 0xE
|
||||
#define CONFIG_RTU_OFFSET 0x160 // Current size: 0x54
|
||||
#define CONFIG_GSM_OFFSET 0x200 // Current size: 0xF8
|
||||
#define CONFIG__END__OFFSET 0x300
|
||||
|
||||
#include <string.h>
|
||||
|
||||
const uint32_t * config_section_first_start = (uint32_t *)0x0801E800;
|
||||
const uint32_t * config_section_second_start = (uint32_t *)0x0801F000;
|
||||
const uint32_t * config_section_default_start = (uint32_t *)0x0801E000;
|
||||
const uint32_t * const config_section_first_start = (const uint32_t *)CONFIG_SECTION_FIRST_START;
|
||||
const uint32_t * const config_section_second_start = (const uint32_t *)CONFIG_SECTION_SECOND_START;
|
||||
const uint32_t * const config_section_default_start = (const uint32_t *)CONFIG_SECTION_DEFAULT_START;
|
||||
|
||||
#ifdef STM32L471xx
|
||||
const uint16_t * config_data_pgm_cntr_first_ptr = (uint16_t*)(CONFIG_SECTION_FIRST_START + CONFIG_MODE_PGM_CNTR);
|
||||
const uint16_t * config_data_pgm_cntr_second_ptr = (uint16_t*)(CONFIG_SECTION_SECOND_START + CONFIG_MODE_PGM_CNTR);
|
||||
|
||||
const config_data_mode_t * config_data_mode_first_ptr = (const config_data_mode_t * ) (CONFIG_SECTION_FIRST_START + CONFIG_MODE_OFSET);
|
||||
const config_data_basic_t * config_data_basic_first_ptr = (const config_data_basic_t *) (CONFIG_SECTION_FIRST_START + CONFIG_BASIC_OFFSET);
|
||||
const config_data_wx_sources_t * config_data_wx_sources_first_ptr = (const config_data_wx_sources_t *)(CONFIG_SECTION_FIRST_START + CONFIG_SOURCES_OFFSET);
|
||||
const config_data_umb_t * config_data_umb_first_ptr = (const config_data_umb_t *) (CONFIG_SECTION_FIRST_START + CONFIG_UMB_OFFSET);
|
||||
const config_data_rtu_t * config_data_rtu_first_ptr = (const config_data_rtu_t *) (CONFIG_SECTION_FIRST_START + CONFIG_RTU_OFFSET);
|
||||
const config_data_gsm_t * config_data_gsm_first_ptr = (const config_data_gsm_t *) (CONFIG_SECTION_FIRST_START + CONFIG_GSM_OFFSET);
|
||||
|
||||
const config_data_mode_t * config_data_mode_second_ptr = (const config_data_mode_t * ) (CONFIG_SECTION_SECOND_START + CONFIG_MODE_OFSET);
|
||||
const config_data_basic_t * config_data_basic_second_ptr = (const config_data_basic_t *) (CONFIG_SECTION_SECOND_START + CONFIG_BASIC_OFFSET);
|
||||
const config_data_wx_sources_t * config_data_wx_sources_second_ptr = (const config_data_wx_sources_t *)(CONFIG_SECTION_SECOND_START + CONFIG_SOURCES_OFFSET);
|
||||
const config_data_umb_t * config_data_umb_second_ptr = (const config_data_umb_t *) (CONFIG_SECTION_SECOND_START + CONFIG_UMB_OFFSET);
|
||||
const config_data_rtu_t * config_data_rtu_second_ptr = (const config_data_rtu_t *) (CONFIG_SECTION_SECOND_START + CONFIG_RTU_OFFSET);
|
||||
const config_data_gsm_t * config_data_gsm_second_ptr = (const config_data_gsm_t *) (CONFIG_SECTION_SECOND_START + CONFIG_GSM_OFFSET);
|
||||
|
||||
const config_data_gsm_t * config_data_gsm_default_ptr = (const config_data_gsm_t *)&config_data_gsm_default;
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef STM32F10X_MD_VL
|
||||
const uint16_t * config_data_pgm_cntr_first_ptr = &config_data_pgm_cntr_first;
|
||||
const uint16_t * config_data_pgm_cntr_second_ptr = &config_data_pgm_cntr_second;
|
||||
|
||||
const config_data_mode_t * config_data_mode_first_ptr = &config_data_mode_first;
|
||||
const config_data_basic_t * config_data_basic_first_ptr = &config_data_basic_first;
|
||||
const config_data_wx_sources_t * config_data_wx_sources_first_ptr = &config_data_wx_sources_first;
|
||||
const config_data_umb_t * config_data_umb_first_ptr = &config_data_umb_first;
|
||||
const config_data_rtu_t * config_data_rtu_first_ptr = &config_data_rtu_first;
|
||||
|
||||
const config_data_mode_t * config_data_mode_second_ptr = &config_data_mode_second;
|
||||
const config_data_basic_t * config_data_basic_second_ptr = &config_data_basic_second;
|
||||
const config_data_wx_sources_t * config_data_wx_sources_second_ptr = &config_data_wx_sources_second;
|
||||
const config_data_umb_t * config_data_umb_second_ptr = &config_data_umb_second;
|
||||
const config_data_rtu_t * config_data_rtu_second_ptr = &config_data_rtu_second;
|
||||
|
||||
#endif
|
||||
|
||||
#define CRC_OFFSET 0x7FC
|
||||
#define CRC_16B_WORD_OFFSET CRC_OFFSET / 2
|
||||
|
@ -180,27 +243,27 @@ uint32_t configuration_handler_restore_default_first(void) {
|
|||
switch (config_struct_it) {
|
||||
case 0: // mode
|
||||
source = (uint16_t *) &config_data_mode_default;
|
||||
target = (uint16_t *) &config_data_mode_first;
|
||||
target = (uint16_t *) config_data_mode_first_ptr;
|
||||
size = sizeof(config_data_mode_t) / 2;
|
||||
break;
|
||||
case 1: // basic
|
||||
source = (uint16_t *) &config_data_basic_default;
|
||||
target = (uint16_t *) &config_data_basic_first;
|
||||
target = (uint16_t *) config_data_basic_first_ptr;
|
||||
size = sizeof(config_data_basic_t) / 2;
|
||||
break;
|
||||
case 2: // sources
|
||||
source = (uint16_t *) &config_data_wx_sources_default;
|
||||
target = (uint16_t *) &config_data_wx_sources_first;
|
||||
target = (uint16_t *) config_data_wx_sources_first_ptr;
|
||||
size = sizeof(config_data_wx_sources_t) / 2;
|
||||
break;
|
||||
case 3:
|
||||
source = (uint16_t *) &config_data_umb_default;
|
||||
target = (uint16_t *) &config_data_umb_first;
|
||||
target = (uint16_t *) config_data_umb_first_ptr;
|
||||
size = sizeof(config_data_umb_t) / 2;
|
||||
break;
|
||||
case 4:
|
||||
source = (uint16_t *) &config_data_rtu_default;
|
||||
target = (uint16_t *) &config_data_rtu_first;
|
||||
target = (uint16_t *) config_data_rtu_first_ptr;
|
||||
size = sizeof(config_data_umb_t) / 2;
|
||||
break;
|
||||
}
|
||||
|
@ -339,27 +402,27 @@ uint32_t configuration_handler_restore_default_second(void) {
|
|||
switch (config_struct_it) {
|
||||
case 0: // mode
|
||||
source = (uint16_t *) &config_data_mode_default;
|
||||
target = (uint16_t *) &config_data_mode_second;
|
||||
target = (uint16_t *) config_data_mode_second_ptr;
|
||||
size = sizeof(config_data_mode_t) / 2;
|
||||
break;
|
||||
case 1: // basic
|
||||
source = (uint16_t *) &config_data_basic_default;
|
||||
target = (uint16_t *) &config_data_basic_second;
|
||||
target = (uint16_t *) config_data_basic_second_ptr;
|
||||
size = sizeof(config_data_basic_t) / 2;
|
||||
break;
|
||||
case 2: // sources
|
||||
source = (uint16_t *) &config_data_wx_sources_default;
|
||||
target = (uint16_t *) &config_data_wx_sources_second;
|
||||
target = (uint16_t *) config_data_wx_sources_second_ptr;
|
||||
size = sizeof(config_data_wx_sources_t) / 2;
|
||||
break;
|
||||
case 3:
|
||||
source = (uint16_t *) &config_data_umb_default;
|
||||
target = (uint16_t *) &config_data_umb_second;
|
||||
target = (uint16_t *) config_data_umb_second_ptr;
|
||||
size = sizeof(config_data_umb_t) / 2;
|
||||
break;
|
||||
case 4:
|
||||
source = (uint16_t *) &config_data_rtu_default;
|
||||
target = (uint16_t *) &config_data_rtu_second;
|
||||
target = (uint16_t *) config_data_rtu_second_ptr;
|
||||
size = sizeof(config_data_umb_t) / 2;
|
||||
break;
|
||||
}
|
||||
|
@ -459,7 +522,18 @@ uint32_t configuration_handler_restore_default_second(void) {
|
|||
void configuration_handler_load_configuration(configuration_handler_region_t region) {
|
||||
|
||||
#ifdef STM32L471xx
|
||||
main_config_data_gsm = &config_data_gsm_default;
|
||||
if (region == REGION_DEFAULT) {
|
||||
main_config_data_gsm = config_data_gsm_default_ptr;
|
||||
}
|
||||
else if (region == REGION_FIRST) {
|
||||
main_config_data_gsm = config_data_gsm_first_ptr;
|
||||
}
|
||||
else if (region == REGION_SECOND) {
|
||||
main_config_data_gsm = config_data_gsm_second_ptr;
|
||||
}
|
||||
else {
|
||||
;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (region == REGION_DEFAULT) {
|
||||
|
@ -470,18 +544,18 @@ void configuration_handler_load_configuration(configuration_handler_region_t reg
|
|||
main_config_data_rtu = &config_data_rtu_default;
|
||||
}
|
||||
else if (region == REGION_FIRST) {
|
||||
main_config_data_mode = &config_data_mode_first;
|
||||
main_config_data_basic = &config_data_basic_first;
|
||||
main_config_data_wx_sources = &config_data_wx_sources_first;
|
||||
main_config_data_umb = &config_data_umb_first;
|
||||
main_config_data_rtu = &config_data_rtu_first;
|
||||
main_config_data_mode = config_data_mode_first_ptr;
|
||||
main_config_data_basic = config_data_basic_first_ptr;
|
||||
main_config_data_wx_sources = config_data_wx_sources_first_ptr;
|
||||
main_config_data_umb = config_data_umb_first_ptr;
|
||||
main_config_data_rtu = config_data_rtu_first_ptr;
|
||||
}
|
||||
else if (region == REGION_SECOND) {
|
||||
main_config_data_mode = &config_data_mode_second;
|
||||
main_config_data_basic = &config_data_basic_second;
|
||||
main_config_data_wx_sources = &config_data_wx_sources_second;
|
||||
main_config_data_umb = &config_data_umb_second;
|
||||
main_config_data_rtu = &config_data_rtu_second;
|
||||
main_config_data_mode = config_data_mode_second_ptr;
|
||||
main_config_data_basic = config_data_basic_second_ptr;
|
||||
main_config_data_wx_sources = config_data_wx_sources_second_ptr;
|
||||
main_config_data_umb = config_data_umb_second_ptr;
|
||||
main_config_data_rtu = config_data_rtu_second_ptr;
|
||||
}
|
||||
else {
|
||||
;
|
||||
|
|
Ładowanie…
Reference in New Issue