esp_netif_lora_example/main/main.c

22 lines
528 B
C
Raw Normal View History

2023-12-30 00:19:08 -05:00
#include <string.h>
#include "esp_log.h"
2023-12-28 21:57:12 -05:00
#include "esp_mac.h"
#include "esp_wifi.h"
#include "nvs_flash.h"
2023-12-30 00:19:08 -05:00
#include "esp_netif_lora.h"
2023-12-28 21:57:12 -05:00
void app_main() {
2023-12-30 00:19:08 -05:00
esp_netif_lora_config_t config;
2023-12-28 21:57:12 -05:00
esp_efuse_mac_get_default((uint8_t*)&config.mac);
esp_netif_set_ip4_addr(&config.ip_info.ip, 10, 10 , 0, config.mac[5]);
esp_netif_set_ip4_addr(&config.ip_info.gw, 10, 10 , 0, 1);
esp_netif_set_ip4_addr(&config.ip_info.netmask, 255, 255 , 255, 0);
2023-12-30 00:19:08 -05:00
esp_log_level_set("LoRa32", ESP_LOG_INFO);
esp_netif_lora_init(&config);
2023-12-28 21:57:12 -05:00
}