From b066a81492076d8819049442efa7658084b572ce Mon Sep 17 00:00:00 2001 From: Morgan Allen Date: Sat, 28 Jul 2018 23:33:49 -0700 Subject: [PATCH] more docs --- README.md | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2c685eb..bc0478c 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Provides SPI driver for SX1276/SX1278 LoRa radio -## Usage +## Install Designed to be used as `esp-idf component`. Suggested using as `git submodule` @@ -16,3 +16,43 @@ git submodule update Uses built in KConfig. Run `make menuconfig` and find config under `Component config` -> `LORA32`. Defaults targeted to TTGO LoRa OLED boards. + +## Use +This is the most basic usage. Setting up the LoRa instance, setting it's receive handler, running init then sending a message. + +``` + lora32_cfg_t lora; + lora = lora32_create(); + lora.receive = &handle_lora_receive; + + lora32_init(&lora); + + lora32_send(&lora, "Hello, LoRa", 10); + +``` + +## API + +### `lora32_cfg_t static lora32_create()` +Creates a new LoRa instance + +### `uint8_t lora32_init(lora32_cfg_t *config)` +Initialized LoRa instance. This configures GPIOs, SPI, LoRa radio and receive handlers + +Returns 1 on success. + +### `uint8_t lora32_data_available(lora32_cfg_t *lora)` +Indicates if data is presently available. + +### `uint8_t lora32_parse_packet(lora32_cfg_t *lora, uint8_t size)` + +### `void lora32_send(lora32_cfg_t *config, uint8_t *data, uint8_t len)` +Transmits data over the LoRa radio. + +### `void lora32_set_spreadfactor(lora32_cfg_t *lora, uint8_t factor)` +Sets LoRa Spread Factor. + +Accepts `6`-`12`. + +### `void lora32_dump_regs(lora32_cfg_t *lora)` +Dumps all registers from SX1276