130 lines
		
	
	
		
			3.7 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			130 lines
		
	
	
		
			3.7 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
|  | /****************************************************************************
 | ||
|  | 
 | ||
|  | Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED. | ||
|  | 
 | ||
|  | This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT | ||
|  | be copied by any method or incorporated into another program without | ||
|  | the express written consent of Aerospace C.Power. This Information or any portion | ||
|  | thereof remains the property of Aerospace C.Power. The Information contained herein | ||
|  | is believed to be accurate and Aerospace C.Power assumes no responsibility or | ||
|  | liability for its use in any way and conveys no license or title under | ||
|  | any patent or copyright and makes no representation or warranty that this | ||
|  | Information is free from patent or copyright infringement. | ||
|  | 
 | ||
|  | ****************************************************************************/ | ||
|  | 
 | ||
|  | #ifndef _APP_CONFIG_H_
 | ||
|  | #define _APP_CONFIG_H_
 | ||
|  | 
 | ||
|  | #include "app_flash.h"
 | ||
|  | #include "app_types.h"
 | ||
|  | 
 | ||
|  | #ifdef __cplusplus
 | ||
|  | extern "C" { | ||
|  | #endif
 | ||
|  | 
 | ||
|  | #define APP_GRP_MAC_ADDR         "\xff\xff\xff\x00\x00\x00"
 | ||
|  | 
 | ||
|  | #define APP_DEFAULT_BAUND_RATE   (115200)
 | ||
|  | #define APP_DEFAULT_DATA_BITS    (8)
 | ||
|  | #define APP_DEFAULT_STOP_BITS    (1)
 | ||
|  | #define APP_DEFAULT_PARITY       (2)
 | ||
|  | #define APP_DEFAULT_THDVALUE     (IOT_UART_DEFAULT_THDVALUE)
 | ||
|  | #define APP_MAX_THDVALUE         (IOT_UART_MAX_THDVALUE)
 | ||
|  | #define APP_DEFAULT_JOIN_NOTIFY  (1)
 | ||
|  | #define APP_DEFAULT_FREQ_BAND    PLC_LIB_FREQ_BAND_1
 | ||
|  | 
 | ||
|  | typedef enum { | ||
|  |     APP_HW_IPL_YY01         = 0x640B0100,   /* 100.11.1.0, yonglin */ | ||
|  |     APP_HW_Q111N_ISC        = 0x65140100,   /* 101.20.1.0 */ | ||
|  |     APP_HW_Q111N_ISF        = 0x660A0100,   /* 102.10.1.0 */ | ||
|  |     APP_HW_Q111N_H          = 0x670A0100,   /* 103.10.1.0 */ | ||
|  |     APP_HW_Q111N_HS         = 0x680A0100,   /* 104.10.1.0 */ | ||
|  |     APP_HW_Q111N_ISG        = 0x690A0100,   /* 105.10.1.0 */ | ||
|  |     APP_HW_LEDC_P           = 0x6A0A0100,   /* 106.10.1.0, ledc with psram */ | ||
|  |     APP_HW_LEDC             = 0x6A0A0108,   /* 106.10.1.8, ledc without psram */ | ||
|  |     APP_HW_HTZD_STA_1_PHASE = 0x290A0909,   /* 41.10.09.09 */ | ||
|  |     APP_HW_HTZD_CCO_3_PHASE = 0x330A0100,   /* 51.10.01.00 */ | ||
|  |     APP_HW_PV_STA_RSD_EI11_V1_0 = 0x610A0100,   /* 97.10.01.00 */ | ||
|  |     APP_HW_PV_STA_RSD_EI12_V1_0 = 0x600A0100,   /* 96.10.01.00 */ | ||
|  |     APP_HW_PV_STA_MPPT_V1_0 = 0x63140100,   /* 99.20.01.00 */ | ||
|  |     APP_HW_UNKNOW | ||
|  | } app_hw_ver_e; | ||
|  | 
 | ||
|  | typedef struct { | ||
|  |     nv_ftm_factory_id factory; | ||
|  | } app_config; | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief app_get_hw_ver() - get hardware version. | ||
|  |  * | ||
|  |  * @param None. | ||
|  |  * | ||
|  |  * @return app_hw_ver_e : hardware version; | ||
|  |  */ | ||
|  | app_hw_ver_e app_get_hw_ver(void); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief app_get_factory_from_nv() - get app factory config from custom flash. | ||
|  |  * | ||
|  |  * @param [out] param: app factory config. | ||
|  |  * | ||
|  |  * @return ERR_OK : get config done; | ||
|  |  * @return Others : get config failed; | ||
|  |  */ | ||
|  | uint16_t app_get_factory_from_nv(nv_ftm_factory_id *param); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief app_save_factory_to_nv() - save app factory config to custom flash. | ||
|  |  * | ||
|  |  * @param None. | ||
|  |  * | ||
|  |  * @return ERR_OK : save done; | ||
|  |  * @return Others : save failed; | ||
|  |  */ | ||
|  | uint16_t app_save_factory_to_nv(void); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief app_restore_factory() - set app factory config to default. | ||
|  |  * | ||
|  |  * @param None. | ||
|  |  * | ||
|  |  * @return None. | ||
|  |  */ | ||
|  | void app_restore_factory(void); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief app_load_nv_conf() - load config from custom flash. | ||
|  |  * | ||
|  |  * @param None. | ||
|  |  * | ||
|  |  * @return None. | ||
|  |  */ | ||
|  | void app_load_nv_conf(void); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief app_pib_restore_factory() - restore the pib config to factory, | ||
|  |  *          include uart param, sta scan band, work band, white list. | ||
|  |  * | ||
|  |  * @param None. | ||
|  |  * | ||
|  |  * @return None. | ||
|  |  */ | ||
|  | void app_pib_restore_factory(void); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief app_pib_conf_init() - check uart config in pib. if invalid, restore | ||
|  |  *          the pib config to factory. | ||
|  |  * | ||
|  |  * @param None. | ||
|  |  * | ||
|  |  * @return None. | ||
|  |  */ | ||
|  | void app_pib_conf_init(void); | ||
|  | 
 | ||
|  | #ifdef __cplusplus
 | ||
|  | } | ||
|  | #endif
 | ||
|  | 
 | ||
|  | #endif  /* _APP_CONFIG_H_ */
 |