1
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
32
33
34
35
36
37
38
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/* ... */
#include <stdio.h>
#include <string.h>
#include "ieee802154_cmd.h"
#include "esp_system.h"
#include "esp_log.h"
#include "esp_console.h"
#include "esp_vfs_dev.h"
#include "esp_vfs_fat.h"
#include "nvs.h"
#include "nvs_flash.h"
#include "esp_ieee802154.h"
#include "esp_phy_init.h"
#include "cmd_system.h"
#include "ieee802154_debug.h"14 includes
#define PROMPT_STR "ieee802154"
static void initialize_nvs(void)
{
esp_err_t err = nvs_flash_init();
if (err == ESP_ERR_NVS_NO_FREE_PAGES || err == ESP_ERR_NVS_NEW_VERSION_FOUND) {
ESP_ERROR_CHECK(nvs_flash_erase());
err = nvs_flash_init();
}{...}
ESP_ERROR_CHECK(err);
}{ ... }
void app_main(void)
{
esp_ieee802154_enable();
esp_console_repl_t *repl = NULL;
esp_console_repl_config_t repl_config = ESP_CONSOLE_REPL_CONFIG_DEFAULT();
/* ... */
repl_config.prompt = PROMPT_STR ">";
repl_config.max_cmdline_length = 256;
initialize_nvs();
esp_console_register_help_command();
register_ieee802154_cmd();
register_system_common();
#if CONFIG_IEEE802154_DEBUG
register_ieee802154_debug_cmd();
#endif
esp_console_dev_uart_config_t hw_config = ESP_CONSOLE_DEV_UART_CONFIG_DEFAULT();
ESP_ERROR_CHECK(esp_console_new_repl_uart(&hw_config, &repl_config, &repl));
ESP_ERROR_CHECK(esp_console_start_repl(repl));
}{ ... }