• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Inteform/esp32-lora-library: Low-level Lora (SX127_) library for the ESP-32 IDF

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

Inteform/esp32-lora-library

开源软件地址(OpenSource Url):

https://github.com/Inteform/esp32-lora-library

开源编程语言(OpenSource Language):

C 98.3%

开源软件介绍(OpenSource Introduction):

esp32-lora-library

What is it

esp32-lora-library is a C component to be integrated into ESP32-IDF for sending and receiving data through a LoRa transceiver based on Semtech's SX127_ ICs.

The library itself is based on sandeepmistry's arduino-LoRa (https://github.com/sandeepmistry/arduino-LoRa) library for Arduino.

How to install

Simply clone the repository and copy the components/lora directory into your ESP-IDF project directory or into the components/ path of your $IDF_PATH (it will be public to all your projects). You can then simply #include "lora.h" and use its functions. Using make menuconfig there will be LoRa Options to configure (like pin numbers)

git clone https://github.com/Inteform/esp32-lora-library
cp -r esp32-lora-library/components /path/to/my/esp32/project
cd /path/to/my/esp32/project
make menuconfig
make
#etc

Basic usage

A simple sender program...

#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "lora.h"

void task_tx(void *p)
{
   for(;;) {
      vTaskDelay(pdMS_TO_TICKS(5000));
      lora_send_packet((uint8_t*)"Hello", 5);
      printf("packet sent...\n");
   }
}

void app_main()
{
   lora_init();
   lora_set_frequency(915e6);
   lora_enable_crc();
   xTaskCreate(&task_tx, "task_tx", 2048, NULL, 5, NULL);
}

Meanwhile in the receiver program...

#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "lora.h"

uint8_t but[32];

void task_rx(void *p)
{
   int x;
   for(;;) {
      lora_receive();    // put into receive mode
      while(lora_received()) {
         x = lora_receive_packet(buf, sizeof(buf));
         buf[x] = 0;
         printf("Received: %s\n", buf);
         lora_receive();
      }
      vTaskDelay(1);
   }
}

void app_main()
{
   lora_init();
   lora_set_frequency(915e6);
   lora_enable_crc();
   xTaskCreate(&task_rx, "task_rx", 2048, NULL, 5, NULL);
}

Connection with the RF module

By default, the pins used to control the RF transceiver are--

Pin Signal
CS IO15
RST IO32
MISO IO13
MOSI IO12
SCK IO14

but you can reconfigure the pins using make menuconfig and changing the options in the "LoRa Options --->"




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
jorgecasas/php-ml: PHP Machine Learning library发布时间:2022-08-15
下一篇:
everest-architecture/component-library-guidedoc发布时间:2022-08-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap