MeterLogger
rfinit.c
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2016 Vowstar
3  *
4  * FileName: init.c
5  *
6  * Description: System and user APP initialization.
7  *
8  * Modification history:
9  * 2016/03/24, v1.0 create this file.
10 *******************************************************************************/
11 
12 #include "ets_sys.h"
13 #include "osapi.h"
14 #include "user_interface.h"
15 
16 /******************************************************************************
17 * FunctionName : user_rf_cal_sector_set
18 * Description : SDK just reversed 4 sectors, used for rf init data and paramters.
19 * We add this function to force users to set rf cal sector, since
20 * we don't know which sector is free in user's application.
21 * sector map for last several sectors : ABCCC
22 * A : rf cal
23 * B : rf init data
24 * C : sdk parameters
25 * Parameters : none
26 * Returns : rf cal sector
27 *******************************************************************************/
29 user_rf_cal_sector_set(void)
30 {
31  enum flash_size_map size_map = system_get_flash_size_map();
32  uint32 rf_cal_sec = 0;
33 
34  switch (size_map) {
36  rf_cal_sec = 128 - 5;
37  break;
38 
40  rf_cal_sec = 256 - 5;
41  break;
42 
45  rf_cal_sec = 512 - 5;
46  break;
47 
50  rf_cal_sec = 1024 - 5;
51  break;
52 
53  default:
54  rf_cal_sec = 0;
55  break;
56  }
57 
58  return rf_cal_sec;
59 }
60 
61 void __attribute__((weak))
62 user_rf_pre_init(void)
63 {
64  // Warning: IF YOU DON'T KNOW WHAT YOU ARE DOING, DON'T TOUCH THESE CODE
65 
66  // Control RF_CAL by esp_init_data_default.bin(0~127byte) 108 byte when wakeup
67  // Will low current
68  // system_phy_set_rfoption(0);
69 
70  // Process RF_CAL when wakeup.
71  // Will high current
73 
74  // Set Wi-Fi Tx Power, Unit: 0.25dBm, Range: [0, 82]
76 }
enum flash_size_map system_get_flash_size_map(void)
flash_size_map
#define ICACHE_FLASH_ATTR
Definition: c_types.h:99
void system_phy_set_max_tpw(uint8 max_tpw)
unsigned int uint32
Definition: c_types.h:54
uint32 ICACHE_FLASH_ATTR __attribute__((weak))
Definition: rfinit.c:28
void system_phy_set_rfoption(uint8 option)