point-2-point demo

Dependencies:   sx12xx_hal

radio chip selection

Radio chip driver is not included, because these options are available.
If you're using SX1272 or SX1276, then import sx127x driver into your program.
if you're using SX1261 or SX1262, then import sx126x driver into your program.
if you're using SX1280, then import sx1280 driver into your program.
If you're using NAmote72 or Murata discovery, then you must import only sx127x driver.

TX trigger selection

Edit main.h to define DIGITAL_TRIGGER or ANALOG_TRIGGER to chose whether transmit is initiated by digital pin (button/jumper) or analog pin(s) level change.

This project is intended to be used on two LoRa shields.

Each board sits in continuous RX mode, waiting for request packet.
If the received packet has good CRC, the packet is acknowledged along with read of ADC sample from the replying device.
The original request packet also contains instruction to set level of output pin.

Both sides of the link are running the same code, and each can initiate a transmission at any time.
No addressing is used, so only two nodes can operate on the radio channel.

Committer:
Wayne Roberts
Date:
Wed Aug 01 15:04:11 2018 -0700
Revision:
5:e35b1b281466
move analog to separate source file

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Wayne Roberts 5:e35b1b281466 1 #include "mbed.h"
Wayne Roberts 5:e35b1b281466 2
Wayne Roberts 5:e35b1b281466 3 #define DIGITAL_TRIGGER
Wayne Roberts 5:e35b1b281466 4 //#define ANALOG_TRIGGER
Wayne Roberts 5:e35b1b281466 5
Wayne Roberts 5:e35b1b281466 6 void trigger_init(void);
Wayne Roberts 5:e35b1b281466 7 void trigger_mainloop(void);
Wayne Roberts 5:e35b1b281466 8
Wayne Roberts 5:e35b1b281466 9 /* from main.cpp: */
Wayne Roberts 5:e35b1b281466 10 void radio_tx(uint8_t*, uint8_t);
Wayne Roberts 5:e35b1b281466 11
Wayne Roberts 5:e35b1b281466 12 /* from uart_cmds.cpp: */
Wayne Roberts 5:e35b1b281466 13 void uart_service(void);
Wayne Roberts 5:e35b1b281466 14 bool parse_radio_rx(uint8_t*);
Wayne Roberts 5:e35b1b281466 15
Wayne Roberts 5:e35b1b281466 16 #define ACK_BIT 0x80
Wayne Roberts 5:e35b1b281466 17
Wayne Roberts 5:e35b1b281466 18 #define CMD_OUT_PIN 0x01
Wayne Roberts 5:e35b1b281466 19 #define CMD_OUT_PIN_ACK (CMD_OUT_PIN | ACK_BIT)
Wayne Roberts 5:e35b1b281466 20
Wayne Roberts 5:e35b1b281466 21 #define CMD_PWM_A 0x02
Wayne Roberts 5:e35b1b281466 22 #define CMD_PWM_A_ACK (CMD_PWM_A | ACK_BIT)
Wayne Roberts 5:e35b1b281466 23
Wayne Roberts 5:e35b1b281466 24 #define CMD_PWM_B 0x03
Wayne Roberts 5:e35b1b281466 25 #define CMD_PWM_B_ACK (CMD_PWM_B | ACK_BIT)
Wayne Roberts 5:e35b1b281466 26
Wayne Roberts 5:e35b1b281466 27 #define CMD_PWM_C 0x04
Wayne Roberts 5:e35b1b281466 28 #define CMD_PWM_C_ACK (CMD_PWM_C | ACK_BIT)
Wayne Roberts 5:e35b1b281466 29
Wayne Roberts 5:e35b1b281466 30 #define CMD_PWM_D 0x05
Wayne Roberts 5:e35b1b281466 31 #define CMD_PWM_D_ACK (CMD_PWM_D | ACK_BIT)