Skip to content

Commit

Permalink
Split rx and tx config variables
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Swoboda committed Dec 27, 2024
1 parent e1f2e6e commit 576676f
Showing 1 changed file with 55 additions and 19 deletions.
74 changes: 55 additions & 19 deletions components/sx127x.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,35 +37,71 @@ Configuration variables:

- **rst_pin** (**Required**, :ref:`Pin Schema <config-pin_schema>`): Reset pin.
- **nss_pin** (**Required**, :ref:`Pin Schema <config-pin_schema>`): SPI select pin.
- **dio0_pin** (**Optional**, :ref:`Pin Schema <config-pin_schema>`): Digital IO pin 0.
- **dio2_pin** (**Optional**, :ref:`Pin Schema <config-pin_schema>`): Digital IO pin 2.
- **frequency** (**Required**, int): Frequency in Hz of the transceiver.
- **modulation** (**Required**, enum): Modulation can be ``OOK`` or ``FSK``.
- **payload_length** (**Optional**, int): If set to a length greater than zero packet mode is enabled, otherwise continuous mode is used. In packet mode, packets are received with the on_packet trigger and sent via the send_packet automation. In continuous mode raw data appears on DIO2 and is handled by remote receiver / transmitter.
- **bitrate** (**Optional**, int): Bit rate of the signal. Required by packet mode and recommended in continuous mode, example 4800.
- **bitsync** (**Optional**, bool): Enables the rx bit syncronizer.
- **sync_value** (**Optional**, list): Synchronization bytes found after the preamble and before the payload. Required by packet mode.
- **preamble_size** (**Optional**, int): Length of the preamble in bytes. Preamble detector is disabled if the size is 0. Required by packet mode.
- **payload_length** (**Optional**, int): If greater than zero packet mode is enabled, otherwise
continuous mode is used. In packet mode, packets are received with the on_packet trigger and
sent via the send_packet automation. In continuous mode raw data appears on the DIO2 pin.
- **bitrate** (**Optional**, int): Bit rate of the signal. Required in packet mode and recommended
in continuous mode. Normally the inverse of the the bit duration, eg 1 / 208 us is 4800 bps.
- **bitsync** (**Optional**, bool): Enables the receive bit syncronizer. Required in packet mode
and recommended in continuous mode. Note if there is no preamble plus high noise or low signal
levels it may be better to turn it off.
- **sync_value** (**Optional**, list): Synchronization bytes found after the preamble and before the
payload. Required in packet mode.
- **preamble_size** (**Optional**, int): Length of the preamble in bytes. Preamble detector is disabled
if the size is 0. Required in packet mode.
- **preamble_polarity** (**Optional**, int): Polarity of the preamble, either 0xAA or 0x55.
- **preamble_errors** (**Optional**, int): Number of chip errors tolerated over the preamble, 4 chips per bit.
- **rx_start** (**Optional**, bool): Start the receiver on boot or after transmit.
- **rx_bandwidth** (**Optional**, enum): Receive bandwidth can be ``2_6kHz``, ``3_1kHz``, ``3_9kHz``, ``5_2kHz``, ``6_3kHz``, ``7_8kHz``, ``10_4kHz``, ``12_5kHz``, ``15_6kHz``, ``20_8kHz``, ``25_0kHz``, ``31_3kHz``, ``41_7kHz``, ``50_0kHz``, ``62_5kHz``, ``83_3kHz``, ``100_0kHz``, ``125_0kHz``, ``166_7kHz``, ``200_0kHz`` or ``250_0kHz``.
- **rx_floor** (**Optional**, float): When receiving FSK in continuous mode, without a preamble configured, rx_floor is used to trigger the receiver. When receiving OOK in continuous mode rx_floor should be set appropriately for your environment / device / antenna. If the floor is set too high (ie closer to 0) the radio will ignore everything. If the floor is set too low (ie closer to -128) noise will overwhelm remote receiver. A good starting point is -90 dBm.
- **rx_duration** (**Optional**, int or :ref:`config-time`): Requires DIO0 and DIO2 to be configured in continuous mode. The FSK demodulator unlike OOK cannot be gated by signal strength. In order to reduce noise DIO2 can be automatically gated until the receiver is triggered by either rssi or a preamble detection. Once triggered DIO2 is ungated temporarily for ``rx_duration``. It is recommended to use ``rx_duration`` for debug only and instead use packet mode for FSK.
- **pa_pin** (**Optional**, enum): Transmitter output, can be ``BOOST`` or ``RFO``.
- **pa_power** (**Optional**, int): Transmitter power, range is 0 to 17 dBm.
- **shaping** (**Optional**, enum): Transmitter data shaping, valid values for OOK are ``CUTOFF_BR_X_2``, ``CUTOFF_BR_X_1`` or ``NONE``, valid values for FSK are ``GAUSSIAN_BT_0_3``, ``GAUSSIAN_BT_0_5``, ``GAUSSIAN_BT_1_0`` or ``NONE``. Note only recommended in packet mode, in continuous mode the data on DIO2 must to be synchronized with the bit clock on DIO1.
- **fsk_fdev** (**Optional**, int): Transmitter frequency deviation, valid values range from 0 to 100,000 Hz.
- **fsk_ramp** (**Optional**, enum): Transmitter PA ramp, valid values are ``10us``, ``12us``, ``15us``, ``20us``, ``25us``, ``31us``, ``40us``, ``50us``, ``62us``, ``100us``, ``125us``, ``250us``, ``500us``, ``1000us``, ``2000us`` or ``3400us``.
- **preamble_errors** (**Optional**, int): Number of chip errors tolerated over the preamble.

Receiver configuration variables:
*********************************

- **dio0_pin** (**Optional**, :ref:`Pin Schema <config-pin_schema>`): Digital IO pin 0, required in
packet mode.
- **dio2_pin** (**Optional**, :ref:`Pin Schema <config-pin_schema>`): Digital IO pin 2, required for
``rx_duration``.
- **rx_start** (**Optional**, bool): Start the receiver automatically on boot.
- **rx_bandwidth** (**Optional**, enum): Receive bandwidth can be ``2_6kHz``, ``3_1kHz``, ``3_9kHz``,
``5_2kHz``, ``6_3kHz``, ``7_8kHz``, ``10_4kHz``, ``12_5kHz``, ``15_6kHz``, ``20_8kHz``, ``25_0kHz``,
``31_3kHz``, ``41_7kHz``, ``50_0kHz``, ``62_5kHz``, ``83_3kHz``, ``100_0kHz``, ``125_0kHz``,
``166_7kHz``, ``200_0kHz`` or ``250_0kHz``.
- **rx_floor** (**Optional**, float): When receiving FSK in continuous mode, without a preamble
configured, rx_floor is used to trigger the receiver. When receiving OOK in continuous mode rx_floor
should be set appropriately for your environment / device / antenna. If the floor is set too high
(ie closer to 0) the radio will ignore everything. If the floor is set too low (ie closer to -128)
noise will overwhelm remote receiver. A good starting point is -90 dBm.
- **rx_duration** (**Optional**, int or :ref:`config-time`): Requires DIO0 and DIO2 to be configured in
continuous mode. The FSK demodulator unlike OOK cannot be gated by signal strength. In order to
reduce noise DIO2 can be automatically gated until the receiver is triggered by either rssi or a
preamble detection. Once triggered DIO2 is ungated temporarily for ``rx_duration``. It is recommended
to use ``rx_duration`` for debug only and instead use packet mode for FSK.

Transmit configuration variables:
*********************************

- **pa_pin** (**Optional**, enum): Transmitter output pin, can be ``BOOST`` or ``RFO``.
- **pa_power** (**Optional**, int): Transmitter power, range is from 0 to 17 dBm.
- **shaping** (**Optional**, enum): Transmitter data shaping. OOK can be ``CUTOFF_BR_X_2``,
``CUTOFF_BR_X_1`` or ``NONE``. FSK can be ``GAUSSIAN_BT_0_3``, ``GAUSSIAN_BT_0_5``,
``GAUSSIAN_BT_1_0`` or ``NONE``. Not remocommended in continuous mode as the data on DIO2
must to be synchronized with the bit clock on DIO1.
- **fsk_fdev** (**Optional**, int): Transmitter frequency deviation, values range from 0 to 100,000 Hz.
- **fsk_ramp** (**Optional**, enum): Transmitter PA ramp, can be ``10us``, ``12us``, ``15us``,
``20us``, ``25us``, ``31us``, ``40us``, ``50us``, ``62us``, ``100us``, ``125us``, ``250us``, ``500us``,
``1000us``, ``2000us`` or ``3400us``.

.. note::

The config can be changed at runtime using lambdas. Settings, except for mode changes, will only be applied after calling configure. See :apiref:`sx127x/sx127x.h`.
Configuration variables can be changed at runtime using lambdas. Settings will only be applied
after calling configure. See :apiref:`sx127x/sx127x.h`.

Automations:
------------

- **on_packet** (*Optional*, :ref:`Automation <automation>`): An automation to perform in packet mode when a packet has been decoded. A variable x of type std::vector<uint8_t> is passed to the automation for use in lambdas.
- **on_packet** (*Optional*, :ref:`Automation <automation>`): An automation to perform in packet mode
when a packet has been decoded. A variable x of type std::vector<uint8_t> is passed to the automation
for use in lambdas.

.. code-block:: yaml
Expand Down

0 comments on commit 576676f

Please sign in to comment.