Structure that parameterizes RAIL_RX_CHANNEL_HOPPING_MODE_MULTI_SENSE.

Every RAIL_RxChannelHoppingConfigEntry_t or RAIL_RxDutyCycleConfig_t that uses RAIL_RX_CHANNEL_HOPPING_MODE_MULTI_SENSE must allocate one of these structures in global read-write memory to provide the settings for this mode and for RAIL to use during hopping or duty cycling. A pointer to this structure, cast appropriately, is what is passed in the corresponding RAIL_RxChannelHoppingConfigEntry_t::parameter or RAIL_RxDutyCycleConfig_t::parameter.

The contents of this structure must be initialized prior to each RAIL_ConfigRxChannelHopping() or RAIL_ConfigRxDutyCycle() call and must not be touched thereafter until the next such call. RAIL may change these contents during configuration or operation.

This mode of operation functions algorithmically like this pseudocode:

extern bool channelHopping; // true if channel hopping, false if duty cycling
extern RAIL_RxChannelHoppingConfigEntry_t *hopConfigEntry; // current channel

static RAIL_RxChannelHoppingConfigMultiMode_t *multiParams;
static RAIL_Time_t rxStartTime;
static bool preambleSensed;

static void hopOrSuspendRx(uint32_t delay)
{
  disableDemodEvents();
  disableTimerEvents();
  stopTimer();
  if (channelHopping) {
    hopToNextChannel(delay, &hopConfigEntry); // updates hopConfigEntry
  } else {
    suspendRx(delay);
  }
  onStartRx(); // resume receive after delay (on new channel if hopping)
}

void onStartRx(void) // called upon entry to receive
{
  rxStartTime = RAIL_GetTime();
  multiParams = (RAIL_RxChannelHoppingConfigMultiMode_t *)
                (void *)hopConfigEntry->parameter;
  startTimer(rxStartTime + multiParams->timingSense);
  preambleSensed = false;
  enableTimerEvents(); // timer will trigger onTimerEvent() handler
  enableDemodEvents(); // demod will trigger onDemodEvent() handler
}

void onTimerEvent(void) // called when timer expires
{
  hopOrSuspendRx(hopConfigEntry->delay);
}

void onDemodEvent(void) // called when demodulator state changes
{
  if (DEMOD_TIMING_SENSED) {
    stopTimer();
    startTimer(rxStartTime + multiParams->syncDetect);
  }
  if (DEMOD_TIMING_LOST) {
    stopTimer();
    uint32_t newTimeout = RAIL_GetTime() + multiParams->timingReSense;
    uint32_t limitTimeout;
    if (preambleSensed) {
      limitTimeout = rxStartTime + multiParams->syncDetect;
    } else {
      limitTimeout = rxStartTime + multiParams->preambleSense;
    }
    if (newTimeout > limitTimeout) {
      newTimeout = limitTimeout;
    }
    if (newTimeout > RAIL_GetTime()) {
      startTimer(newTimeout);
    } else {
      hopOrSuspendRx(hopConfigEntry->delay);
    }
  }
  if (DEMOD_PREAMBLE_SENSED) {
    preambleSensed = true;
  }
  if (DEMOD_PREAMBLE_LOST) {
    preambleSensed = false;
  }
  if (DEMOD_SYNC_DETECTED) {
    disableDemodEvents();
    disableTimerEvents();
    stopTimer();
    receivePacket(); // stay on channel to receive frame
    hopOrSuspendRx(0); // continue RX per state transitions with no delay
  }
}

Public Attributes#

uint32_t

Switch to the next channel if sync is not detected before this time, in microseconds, measured from entry to Rx.

uint32_t

Switch to the next channel if timing was sensed but then lost after this time, in microseconds, measured from entry to Rx – unless preamble had been sensed in which case any switching is deferred to timingReSense and, if timing is regained, to syncDetect.

uint32_t

Switch to the next channel if timing is not sensed before this time, in microseconds, measured from entry to Rx.

uint32_t

Switch to the next channel if timing was sensed but then lost and not regained before this time, in microseconds, measured from when timing was lost.

uint32_t

Set this to 0.

Public Attribute Documentation#

syncDetect#

uint32_t RAIL_RxChannelHoppingConfigMultiMode_t::syncDetect

Switch to the next channel if sync is not detected before this time, in microseconds, measured from entry to Rx.

This must be greater than preambleSense and less than RAIL_RX_CHANNEL_HOPPING_MAX_SENSE_TIME_US.


Definition at line 4248 of file common/rail_types.h

preambleSense#

uint32_t RAIL_RxChannelHoppingConfigMultiMode_t::preambleSense

Switch to the next channel if timing was sensed but then lost after this time, in microseconds, measured from entry to Rx – unless preamble had been sensed in which case any switching is deferred to timingReSense and, if timing is regained, to syncDetect.

This must be greater than timingSense and less than RAIL_RX_CHANNEL_HOPPING_MAX_SENSE_TIME_US.


Definition at line 4257 of file common/rail_types.h

timingSense#

uint32_t RAIL_RxChannelHoppingConfigMultiMode_t::timingSense

Switch to the next channel if timing is not sensed before this time, in microseconds, measured from entry to Rx.

This must be greater than 2 and less than RAIL_RX_CHANNEL_HOPPING_MAX_SENSE_TIME_US.


Definition at line 4264 of file common/rail_types.h

timingReSense#

uint32_t RAIL_RxChannelHoppingConfigMultiMode_t::timingReSense

Switch to the next channel if timing was sensed but then lost and not regained before this time, in microseconds, measured from when timing was lost.

This must be less than RAIL_RX_CHANNEL_HOPPING_MAX_SENSE_TIME_US.


Definition at line 4271 of file common/rail_types.h

status#

uint32_t RAIL_RxChannelHoppingConfigMultiMode_t::status

Set this to 0.

This field, along with the others, may be used internally by RAIL during configuration or operation.


Definition at line 4276 of file common/rail_types.h