#ifndef _PARAMETER_H
#define _PARAMETER_H
#include "user.h"
#define PARAM_ADDR FLASH_DATA_EEPROM_START_PHYSICAL_ADDRESS
#define PARA_DEFAULT {0x01,\
    0x35,0x19,0x13,0x07,\
    0x00,0xF9,0x13,0x07,\
    0x00,0x00,0x01,0x00,\
    0x00,0x00,0x00,0x00,\
    0x01,\
    0x03,0x04,0x70,0x00,\
    0x0a,0x0a,0x00,0x00,\
    0x00,0x00,0x00,0x00,\
    0x01,0x74,0x01,0x74,0x02,0x00,0x07,0x65,0x03,0x00,\
    0x01,\
    0x00,\
    0x00,\
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
    0x00,0x00,0x00,0x00}//LockID[3]空速;（SF:7-12,BW:7.8kHz-500kHz，共6*10,(0-3B)）默认5.4Kbps
//Lora锁有0-83共84个信道，即410Mhz-494Mhz//默认433Mhz
//网关共有0-93共94个信道，即410Mhz-504Mhz，推荐使用 84-93共10个信道，即495Mhz-504Mhz//默认500Mhz
typedef struct
{
    uint8_t FixedPara;//bool FixedPara;
    uint8_t LockID[4];
    uint8_t PcID[4];
    uint8_t HardVersion[4];
    uint8_t SoftVersion[4];
    uint8_t VariablePara;//bool VariablePara;
    uint8_t QmcFixPara[4];
    uint8_t MotorFixedPara[4];
    uint8_t LoraConfigPara[4];
    uint8_t PhotorResPara[10];
    uint8_t OperationPara;
    uint8_t AutoFlag;
    uint8_t CarFlag;
    //bool OperationPara;
    //bool AutoFlag;
    //bool CarFlag;
    uint8_t QmcBase[3][4];
    uint8_t PhoResBase[4];
}PARAMETER;

extern PARAMETER SystemPara;
void EEPROM_ReadByte(u32 addr, u8 *buf, u16 len);
void EEPROM_WriteByte(u32 addr, u8 *buf, u16 len);
void EEPROM_Erase(u32 addr, u16 len);
void FixedParaDeal(void);
void FixedParaChange(bool State);
void LoraParaRead(void);
#endif
